Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

windows

Open toplevel windows with title, app ID, workspace, output and state flags.

list {
    source = mantle.windows:map(function(windows)
        return windows and windows.windows or {}
    end),
    key = function(window) return window.id end,
    itemfn = function(window)
        return button {
            on_click = function() mantle.windows:focus(window.id) end,
            children = {
                text { content = window.title, foreground = window.focused and "#89B4FA" or "#CDD6F4" },
            },
        }
    end,
}

State

mantle.windows:get() returns WindowsState, nil before the first push. A field marked ? may be absent.

mantle.windows payload; nil with no niri, Hyprland or wlr-foreign-toplevel backend.

FieldTypeDescription
sourcestring"niri", "hyprland", or "wlr_foreign_toplevel".
windowsWindowEntry[]Sorted by workspace_id, then backend order; windows without one last.

WindowEntry

One toplevel window. nil optional fields are ones the backend does not report.

FieldTypeDescription
app_idstringWayland app_id (Hyprland’s class); empty when unset.
floating?booleanWhether the window floats rather than tiles; nil on wlr.
focusedbooleanWhether the window has keyboard focus.
fullscreen?booleanWhether the window is fullscreen; nil on niri.
idstringOpaque, backend-shaped id for the windows actions; compare it, never parse it.
maximized?booleanWhether the window is maximized; nil on niri.
minimized?booleanWhether the window is minimized; nil except on wlr.
output?stringConnector name; nil when unknown. On wlr, the earliest-entered output the window is still on.
titlestringWindow title; empty when unset.
workspace_id?integerWorkspaceEntry.id; nil on wlr and on Hyprland special workspaces.

Actions

Call each as mantle.windows:<action>(arguments...); ? marks an argument you may omit.

ActionArgumentsDescription
focusid: stringFocuses a window.
closeid: stringAsks the compositor to close the window.
set_fullscreenid: string, fullscreen: booleanSets fullscreen on or off; no-op on niri.
set_minimizedid: string, minimized: booleanSets minimized on or off; wlr only.
set_maximizedid: string, maximized: booleanSets maximized on or off; no-op on niri.

Backend

niri and Hyprland share the workspaces reader; any other compositor needs zwlr_foreign_toplevel_manager_v1 (backend table).

BackendReportsWrites
nirifloatingfocus, close
Hyprlandfloating, fullscreen, maximizedfocus, close, set_fullscreen, set_maximized
wlr foreign-toplevelfullscreen, maximized, minimizedEvery action

A flag a backend does not report is nil; an action it lacks is logged at debug level and dropped.

Gotchas

TrapFix
if window.fullscreen == false never matches on niriThe flag is nil there. Test truthiness, or branch on source
output is nil for a window on a monitor plugged in after startupwlr binds outputs once, at connect. Restart the Supervisor after a hotplug if a dock sorts by output

See also: workspaces for the focused window and per-output workspaces.

Source: supervisor/src/capabilities/windows/