Text · 1910 bytes Raw Blame History
1 # Numbered Workspaces
2
3 tarmac provides 10 numbered workspaces (1–10) per monitor.
4
5 ## Switching workspaces
6
7 ```lua
8 gar.bind("mod+1", "workspace 1")
9 gar.bind("mod+2", "workspace 2")
10 -- ... etc
11 gar.bind("mod+0", "workspace 10")
12 ```
13
14 Or generate all at once:
15
16 ```lua
17 for i = 1, 9 do
18 gar.bind("mod+" .. i, "workspace " .. i)
19 end
20 gar.bind("mod+0", "workspace 10")
21 ```
22
23 Via IPC:
24
25 ```bash
26 tarmacctl workspace 3
27 ```
28
29 ## Moving windows to workspaces
30
31 ```lua
32 gar.bind("mod+shift+1", "move-to-workspace 1")
33 gar.bind("mod+shift+2", "move-to-workspace 2")
34 -- ... etc
35 ```
36
37 ```bash
38 tarmacctl move-to-workspace 5
39 ```
40
41 The window is removed from the current workspace's BSP tree and inserted into the target workspace's tree. If the target workspace is not visible, the window is hidden.
42
43 ## Cycling workspaces
44
45 ```lua
46 gar.bind("mod+tab", "workspace next")
47 gar.bind("mod+shift+tab", "workspace prev")
48 ```
49
50 This cycles through workspaces in order (1→2→3...→10→1). Empty workspaces are included in the cycle.
51
52 ## Workspace state
53
54 Each workspace maintains:
55
56 - Its own BSP tree (layout of tiled windows)
57 - A list of floating windows with independent geometry
58 - A focused window reference
59 - Whether it's currently visible on a monitor
60
61 ## Assigning windows to workspaces via rules
62
63 ```lua
64 gar.rule({ app_bundle = "com.apple.Safari" }, { workspace = 2 })
65 gar.rule({ app_name = "Slack" }, { workspace = 3 })
66 ```
67
68 When a matching window is first detected, it's placed on the specified workspace instead of the active one.
69
70 ## Querying workspace state
71
72 Via IPC:
73
74 ```bash
75 tarmacctl get-workspaces
76 ```
77
78 Returns JSON with all workspaces, their window count, and which monitor they're on:
79
80 ```json
81 {
82 "success": true,
83 "data": [
84 { "id": 1, "monitor": 0, "windows": 3, "focused": true },
85 { "id": 2, "monitor": 0, "windows": 1, "focused": false },
86 { "id": 3, "monitor": 1, "windows": 0, "focused": false }
87 ]
88 }
89 ```
90