Skip to content

Class WindowList ​

Every open window, as wm.windows.

Implements: List<Window>

  • all() and get() list the visible windows from back to front, then the hidden ones.
  • A window is in the list from when the app creates it, before it has content, until it closes.
lua
for _, window in ipairs(wm.windows:all()) do
	if window.app_id == "foot" then
		window.box.opacity = 0.95
	end
end

Methods ​

wm.windows:under(point: Point) -> Window?under ​

The frontmost window that would get a click at point, in global coordinates.

  • Windows with box.input false are skipped.
  • A rounded corner's cut-away part doesn't count, unless a popup is there.
  • nil when there is none, and while the session is locked.
lua
local hovered = wm.windows:under(pointer:position())
if hovered then hovered.box:raise() end

wm.windows:on(event: "new_window", fn: function) -> functionon ​

Other window events are on each window.

Errors for any other event name.

Events ​

Listen with wm.windows:on(name, fn), which returns a function that stops listening.

"new_window" (window: Window)new_window ​

An app created a window. Add per-window listeners and settings here.

  • It has no content yet: window.size is nil until first_content.
  • After a reload it fires once for each window that already exists. A window that has already drawn gets first_content again right after.
lua
wm.windows:on("new_window", function(window)
	window.decoration = "server"
	window:on("first_content", function(window)
		seat:focus(window)
	end)
end)