Skip to main content

layer

A layer object is one layer-shell surface: an external bar, launcher, wallpaper, or lock helper that placed itself with the wlr-layer-shell protocol. The layer global is the class. The surface's facts live on the object; how it is sized, answered, and granted the keyboard is Lua policy in kiln.defaults, replaceable wholesale.

layer.on("map", function(l)
print("layer surface mapped:", l.namespace, "on", l.screen.name)
end)

Properties

All seeded from the protocol on map and refreshed on every commit. Treat them as facts.

PropertyTypeDefaultDescription
handlenumberseededThe C-side identity; the key for core.layer_configure.
namespacestringseededThe surface's self-declared namespace ("waybar", "wallpaper", ...).
outputstring or nilseededThe output the client asked for; nil means it left the choice to the compositor.
screenscreenderivedThe resolved screen: the named output, else the focused screen.
layerstringseededProtocol layer: background, bottom, top, or overlay.
interactivitystringseededKeyboard interactivity: "none", "on_demand", or "exclusive".
anchorstableseeded{top, bottom, left, right} booleans.
margintableseeded{top, right, bottom, left} in pixels.
exclusivenumberseededThe exclusive zone the surface reserves.
desired_w, desired_hnumberseededThe size the surface asked for; 0 on an axis means stretch when anchored to both opposite edges.
mappedbooleantrue on mapLiveness.
w, hnumberset by policyThe answered size, written by whichever handler calls core.layer_configure.
kb_grantedbooleanfalseWhether the keyboard policy currently grants the surface the seat.

As with every kiln object, unknown keys store and emit property::<key>.

Signals

SignalPayloadEmitted when
mapnoneThe surface's initial commit. It blocks until a handler answers with core.layer_configure.
commitnoneThe surface committed new facts (anchors, margins, size, interactivity).
unmapnoneThe surface unmapped.
destroynoneThe surface is gone.
property::<any>new valueAny property write that changed the value.

Policy

Layer surfaces carry no built-in behavior; three replaceable policies on kiln.defaults decide everything (see defaults):

PolicyRuns onDecides
kiln.defaults.layer(l)map, commitHow the surface is sized and answered; stock behavior in the defaults reference.
kiln.defaults.layer_keyboard(l)map, commitWhether the surface gets the keyboard. Stock: exclusive takes the seat, on_demand stays inert.
kiln.defaults.layer_release(l)unmap, destroyCleanup; the stock one returns the seat to the focused client if the surface held it.

Replace any of them with a plain assignment before the surface maps. A broken layer policy means the surface is visibly absent, never a compositor-synthesized answer.

See also