Class Seat
A group of input devices with one keyboard focus and one pointer, from wm.input.seats. Hazel has one seat, seat0, with every device on it.
Properties
seat.name: stringname read only
The seat's name, such as "seat0".
seat.clipboard: SeatClipboardclipboard read only
This seat's clipboard.
Methods
seat:pointer() -> Pointer?pointer
The seat's pointer.
- nil while no pointer device is on the seat.
seat:keyboard() -> Keyboard?keyboard
The seat's keyboard.
Adding a keyboard device replaces it. Look it up again rather than keeping an old one.
nil while no keyboard device is on the seat.
seat:focused() -> Window | Layer | nilfocused
What this seat's keyboard is focused on. Check kind to tell a window from a layer.
- nil when nothing is focused, when the lock screen has focus, and when the seat has no keyboard.
lua
local function focused_window()
local target = seat:focused()
if target and target.kind == "window" then return target end
endseat:focus(target: Window | Layer | nil) -> nilfocus
Moves this seat's keyboard focus to target. nil clears it.
- Does nothing for a hidden window, when the seat has no keyboard, and while the session is locked.
- The window's
focusevent fires after this returns.
lua
local function focus_and_raise(target)
seat:focus(target)
if target and target.kind == "window" then target.box:raise() end
end
focus_and_raise(window)Operators
seat == other -> booleanseat == other
True when both are the same seat.