Class WindowList
Every open window, as wm.windows.
Implements: List<Window>
all()andget()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
endMethods
wm.windows:under(point: Point) -> Window?under
The frontmost window that would get a click at point, in global coordinates.
- Windows with
box.inputfalse 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() endwm.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.sizeis nil untilfirst_content. - After a reload it fires once for each window that already exists. A window that has already drawn gets
first_contentagain right after.
lua
wm.windows:on("new_window", function(window)
window.decoration = "server"
window:on("first_content", function(window)
seat:focus(window)
end)
end)