Skip to main content

layer_surface somewm-only

Lua class for Wayland layer shell surfaces (panels, launchers, lock screens).

Class Methods

MethodReturnsDescription
layer_surface.get()tableAll active layer surfaces
layer_surface.connect_signal(name, fn)-Connect to class signal
layer_surface.disconnect_signal(name, fn)-Disconnect from class signal

Properties (read-only)

PropertyTypeDescription
namespacestringApp identifier ("waybar", "rofi", "wofi")
layerstring"background", "bottom", "top", "overlay"
keyboard_interactivestring"none", "exclusive", "on_demand"
exclusive_zonenumberPixels reserved on screen edge
anchortable{top=bool, bottom=bool, left=bool, right=bool}
margintable{top=n, bottom=n, left=n, right=n}
geometrytable{x=n, y=n, width=n, height=n}
screenscreenScreen the surface is on
mappedbooleanWhether surface is visible
pidnumberProcess ID
validbooleanWhether Lua object is alive
focusablebooleanWhether keyboard_interactive ~= "none"

Properties (read/write)

PropertyTypeDescription
has_keyboard_focusbooleanGrant or revoke keyboard focus

Signals

SignalArgumentsDescription
request::managel, context, hintsSurface appeared
request::unmanagel, context, hintsSurface closing
request::keyboardl, context, hintsSurface wants keyboard
property::has_keyboard_focuslFocus state changed

Layers

LayerZ-orderTypical use
backgroundlowestWallpaper widgets
bottom-Desktop icons
top-Panels, docks
overlayhighestLaunchers, lock screens

ruled.layer_surface

MethodDescription
append_rule(rule)Add a rule
remove_rule(id)Remove rule by ID
apply(l)Apply rules to surface

Rule matching properties

namespace, layer, keyboard_interactive, screen, pid, focusable

Rule example

ruled.layer_surface.append_rule {
rule_any = { namespace = { "rofi", "wofi" } },
properties = { has_keyboard_focus = true },
}

Default behavior

  • Grants keyboard to exclusive surfaces on top/overlay layers
  • Restores focus to previous client when surface closes
  • Click-to-refocus on layer surfaces

See Also