Skip to main content

screen

A screen is one output. The screen global is the class; instances appear when outputs are added and carry the tag selection, the workarea, and the bars a config registers. A config builds its per-monitor world in the added signal.

screen.on("added", function(s)
tag.new { name = "1", screen = s }
tag.new { name = "2", screen = s }
kiln.ui.bar(s, { edge = "top" }, function()
kiln.widgets.taglist(s)
kiln.ui.spacer()
kiln.widgets.clock()
end)
end)

Properties

PropertyTypeDefaultDescription
workareatablederived{x, y, width, height} left after bars and exclusive layer surfaces, read back from the last solve. Read only.
canvastablederived{x, y, width, height} of the whole root element from the last solve, bars included. Read only; nil before the first solve.
scalenumber1Fractional output scale. Read comes from the output list; writing drives the output's scale. Logical geometry is unchanged by scale.
selected_tagtag or nilderivedSugar for selected_tags[1]. Writing a tag means {t}; writing nil writes {}, which the tag layer refuses to leave empty.
selected_tagslist of tags{}The selection fact. Writing it redraws, runs the tag-switch reveal animation, and pushes tag history.
namestringseededThe output name (for example "eDP-1"). Read only.
width, heightnumberseededOutput size in logical pixels, re-seeded every frame. Do not write.
tagslist of tags{}The screen's tags, in creation order. tag.new appends. Read only.
barslist{}The registered bars, as {cfg, fn} pairs. kiln.ui.bar appends; each reserves workarea on the edge its cfg names, any of the four. Read only.

Class functions and fields

MethodDescription
screen.all()Every screen, in add order.
screen.focusedPlain field: the focused screen. Follows c:focus() and pointer motion.
screen.on(name, fn) / screen.off(name, fn)Class-level signals.

Signals

SignalPayloadEmitted when
addednoneA new output appears (also restated for each screen on reload). This is where a config creates tags and bars for the screen.
changednoneThe output's mode, scale, position, or enabled state changed. Re-read core.output.list() for the new facts; layer surfaces re-answer automatically on the next frame. A config rarely needs to do anything here.
removednoneThe output is gone. The standard library has already rehomed its clients to a survivor's selected tag before this fires; use it for cleanup of your own per-screen state.
property::<any>new valueAny property write that changed the value. Notably property::selected_tags fires on every tag switch.

See also