state.go RawHistoryFolder
1package ports
2
3// State carries core → state publisher a snapshot of what is on screen, for
4// scripts (bars, status lines). Workspace numbers count from 1.
5type State struct {
6 // Output is the focused output; "" before the first one.
7 Output string
8 Outputs []OutputState
9 // Window is the focused window, nil when none.
10 Window *WindowState
11 Windows []WindowState
12 // Workspaces is every workspace of every output.
13 Workspaces []WorkspaceState
14}
15
16// WorkspaceState is one workspace and its tiled columns, left to right in
17// layout order. Rects are logical pixels in the output's coordinates.
18type WorkspaceState struct {
19 ID uint64
20 Number int // numbered workspace, 0 for a hidden/named one
21 Name string // configured name, "" if dynamic
22 Output string
23 Visible bool // on screen on its output
24 Overflow string // "fixed", "scroll", "cascade"
25 Columns []ColumnState
26}
27
28// ColumnState is one column and its tiled windows.
29type ColumnState struct {
30 Rect Rect // column area, view offset applied (may be off-screen)
31 Windows []TileState // top to bottom
32}
33
34// TileState is one tiled window and its settled rectangle.
35type TileState struct {
36 ID WindowID
37 Rect Rect
38}
39
40// OutputState is one output: its workspace on screen and how many numbered
41// workspaces it has. Active is 0 while a hidden (named) workspace is shown.
42type OutputState struct {
43 Name string
44 Active int
45 Count int
46 Workspace string // configured name of the workspace on screen, "" if unnamed
47 // WorkspaceID is the core ID of the workspace on screen (WorkspaceInfo.ID).
48 WorkspaceID uint64
49}
50
51// WindowState is one mapped window and where it is.
52type WindowState struct {
53 ID WindowID
54 AppID string
55 PID int
56 Output string
57 // Workspace is the window's numbered workspace, 0 for a hidden one.
58 Workspace int
59 // WorkspaceID is the core ID of the window's workspace, numbered or not
60 // (WorkspaceInfo.ID); WorkspaceName is its configured name, "" for a
61 // dynamic one (WorkspaceInfo.Configured).
62 WorkspaceID uint64
63 WorkspaceName string
64 // Visible means on the workspace on screen (it may be behind a
65 // fullscreen window).
66 Visible bool
67 // IdleInhibit is set while the window keeps the session from idling.
68 IdleInhibit bool `json:",omitempty"`
69 // Floating is set for native floats and stashed windows.
70 Floating bool
71 // StashIndex is the 1-based place of a stashed window in its stash of
72 // StashCount windows; both are 0 outside the stash.
73 StashIndex, StashCount int
74 // Column and Row are the 1-based place of a tiled window: its column in
75 // layout order (not geometry under fixed overflow), its row top to
76 // bottom in that column; both are 0 for floating windows.
77 Column, Row int
78 // Hidden is set for a stashed window while its stash is hidden.
79 Hidden bool
80}