strand

workspaces

Workspaces, from ext-workspace-v1; Hyprland, niri and sway IPC fill in what the protocol does not cover yet.

FieldType
all[Workspace]Every workspace, keyed by id.
focusedWorkspace?The focused workspace, if any.
configured[Workspace]The workspaces the compositor's config places on a screen that do not exist yet (Hyprland's numbered workspace rules, sway's workspace … output …), keyed by id: empty and inactive, made by ws.focus(). workspaces.slots(screen) puts them in place.
Method
fn on(screen: Screen) -> [Workspace]The workspaces on screen: for ws in workspaces.on(screen).
fn slots(screen: Screen) -> [Workspace]A bar's slots on screen: its workspaces and the configured ones not made yet, by their number (Hyprland's id, else the number their name starts with), then the rest: for ws in workspaces.slots(screen) { Dot ws }, each switched to with ws.focus().
action focus(target: int | text)Switches to a workspace by number (int) or by name (text), making it where the compositor makes workspaces it is switched to (Hyprland, sway): on click { workspaces.focus(4) }. A number is the same on every compositor: Hyprland's workspace 4, sway's workspace number 4, niri's fourth workspace of the focused screen. A workspace record is switched to with ws.focus(), not by its id.

This page as Markdownllms.txt