1{
2 config,
3 pkgs,
4 ...
5}:
6{
7 services.aerospace = {
8 enable = config.shared.darwin.tiling.enable;
9 settings = {
10 # Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization
11 enable-normalization-flatten-containers = true;
12 enable-normalization-opposite-orientation-for-nested-containers = true;
13
14 # See: https://nikitabobko.github.io/AeroSpace/guide#layouts
15 # The 'accordion-padding' specifies the size of accordion padding
16 # You can set 0 to disable the padding feature
17 accordion-padding = 0;
18
19 # Possible values: tiles|accordion
20 default-root-container-layout = "tiles";
21
22 # Possible values: horizontal|vertical|auto
23 # "auto" means: wide monitor (anything wider than high) gets horizontal orientation,
24 # tall monitor (anything higher than wide) gets vertical orientation
25 default-root-container-orientation = "auto";
26
27 key-mapping.preset = "qwerty";
28
29 gaps = {
30 inner = {
31 horizontal = 0;
32 vertical = 0;
33 };
34 outer = {
35 left = 0;
36 bottom = 0;
37 top = 10;
38 right = 0;
39 };
40 };
41 # You can effectively turn off macOS "Hide application" (cmd-h) feature by toggling this flag
42 # Useful if you don't use this macOS feature, but accidentally hit cmd-h or cmd-alt-h key
43 # Also see: https://nikitabobko.github.io/AeroSpace/goodies#disable-hide-app
44 automatically-unhide-macos-hidden-apps = true;
45
46 mode.main.binding = {
47 # See: https://nikitabobko.github.io/AeroSpace/commands#layout
48 alt-slash = "layout tiles horizontal vertical";
49 alt-comma = "layout accordion horizontal vertical";
50
51 # See: https://nikitabobko.github.io/AeroSpace/commands#focus
52 alt-h = "focus left";
53 alt-j = "focus down";
54 alt-k = "focus up";
55 alt-l = "focus right";
56
57 # See: https://nikitabobko.github.io/AeroSpace/commands#move
58 alt-shift-h = "move left";
59 alt-shift-j = "move down";
60 alt-shift-k = "move up";
61 alt-shift-l = "move right";
62
63 # See: https://nikitabobko.github.io/AeroSpace/commands#resize
64 alt-minus = "resize smart -50";
65 alt-equal = "resize smart +50";
66
67 # See: https://nikitabobko.github.io/AeroSpace/commands#workspace
68 alt-1 = "workspace 1";
69 alt-2 = "workspace 2";
70 alt-3 = "workspace 3";
71 alt-4 = "workspace 4";
72 alt-5 = "workspace 5";
73 alt-6 = "workspace 6";
74 alt-7 = "workspace 7";
75 alt-8 = "workspace 8";
76 alt-9 = "workspace 9";
77
78 # See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace
79 alt-shift-1 = "move-node-to-workspace 1";
80 alt-shift-2 = "move-node-to-workspace 2";
81 alt-shift-3 = "move-node-to-workspace 3";
82 alt-shift-4 = "move-node-to-workspace 4";
83 alt-shift-5 = "move-node-to-workspace 5";
84 alt-shift-6 = "move-node-to-workspace 6";
85 alt-shift-7 = "move-node-to-workspace 7";
86 alt-shift-8 = "move-node-to-workspace 8";
87 alt-shift-9 = "move-node-to-workspace 9";
88
89 cmd-h = [ ]; # Disable "hide application"
90 cmd-alt-h = [ ]; # Disable "hide others"
91
92 # # See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth
93 # alt-tab = "workspace-back-and-forth";
94 # # See: https://nikitabobko.github.io/AeroSpace/commands#move-workspace-to-monitor
95 # alt-shift-tab = "move-workspace-to-monitor --wrap-around next";
96
97 # See: https://nikitabobko.github.io/AeroSpace/commands#mode
98 alt-shift-semicolon = "mode service";
99 };
100 mode.service.binding = {
101 esc = [
102 "reload-config"
103 "mode main"
104 ];
105 r = [
106 "flatten-workspace-tree"
107 "mode main"
108 ]; # reset layout
109 f = [
110 "layout floating tiling"
111 "mode main"
112 ]; # Toggle between floating and tiling layout
113 backspace = [
114 "close-all-windows-but-current"
115 "mode main"
116 ];
117
118 # sticky is not yet supported https://github.com/nikitabobko/AeroSpace/issues/2
119 #s = ["layout sticky tiling", "mode main"]
120
121 alt-shift-h = [
122 "join-with left"
123 "mode main"
124 ];
125 alt-shift-j = [
126 "join-with down"
127 "mode main"
128 ];
129 alt-shift-k = [
130 "join-with up"
131 "mode main"
132 ];
133 alt-shift-l = [
134 "join-with right"
135 "mode main"
136 ];
137
138 down = "volume down";
139 up = "volume up";
140 shift-down = [
141 "volume set 0"
142 "mode main"
143 ];
144 };
145 after-startup-command = [
146 "exec-and-forget sketchybar"
147 "exec-and-forget open /Applications/SwipeAeroSpace.app"
148 ];
149 exec-on-workspace-change = [
150 "/bin/bash"
151 "-c"
152 "/run/current-system/sw/bin/sketchybar --trigger aerospace_workspace_change FOCUSED_WORKSPACE=$AEROSPACE_FOCUSED_WORKSPACE PREV_WORKSPACE=$AEROSPACE_PREV_WORKSPACE"
153 ];
154
155 on-window-detected = [
156 #Ghostty currently renders tabs as individual processes
157 #Fix comes from https://ghostty.org/docs/help/macos-tiling-wms
158 {
159 "if" = {
160 app-id = "com.mitchellh.ghostty";
161 };
162 run = [ "layout floating" ];
163 check-further-callbacks = true;
164 }
165 ];
166 };
167 };
168}