authorgravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-05-07 13:21:11-07:00
committergravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-05-07 13:21:11-07:00
log3bd8fa4e7a7736b59301babb7680b965b08a6cc8
treee716f05af15d0d34bd482ec19db929c571e0aff7
parent91c676f3f54a4a3e68ea02c7d0dd48e21538345d
signature Commit is signed but in an unrecognized format.

updated tiling options to not push changes to non-users


7 files changed, 429 insertions(+), 550 deletions(-)

lib/mkSystem.nix+13-12
......@@ -38,6 +38,11 @@
3838 hostHomePath = hostDir + "/home.nix";
3939 userHomePath = userDir + "/home.nix";
4040
41 pathOrNull = a:
42 if pathExists a
43 then a
44 else null;
45
4146 # Arguments passed to all module files
4247 args = {
4348 inherit inputs;
......@@ -94,15 +99,11 @@ in
9499 )
95100
96101 # The user-wide configuration.nix
97 (
98 if pathExists userConfigPath
99 then userConfigPath
100 else null
101 )
102 (pathOrNull userConfigPath)
102103 # The host-wide configuration.nix
103104 (
104 if host != null && pathExists hostConfigPath
105 then hostConfigPath
105 if host != null
106 then pathOrNull hostConfigPath
106107 else null
107108 )
108109
......@@ -127,15 +128,15 @@ in
127128 // {
128129 mainHomeImports = builtins.filter (f: f != null) [
129130 (
130 if pathExists userHomePath
131 then userHomePath
132 else null
131 pathOrNull userHomePath
133132 )
134133 (
135 if host != null && pathExists hostHomePath
136 then hostHomePath
134 if host != null
135 then pathOrNull hostHomePath
137136 else null
138137 )
138 #Can't have conditional import path
139 ../modules/macos/tiling/sketchybar-home.nix
139140 ];
140141 };
141142 # can't find how to make this an array without the param
modules/macos/tiling/aerospace.nix+32-25
......@@ -1,4 +1,8 @@
1{config,pkgs, ...}: {
1{
2 config,
3 pkgs,
4 ...
5}: {
26 services.aerospace = {
37 enable = config.shared.darwin.tiling.enable;
48 settings = {
......@@ -60,34 +64,34 @@
6064 alt-equal = "resize smart +50";
6165
6266 # See: https://nikitabobko.github.io/AeroSpace/commands#workspace
63 cmd-1 = "workspace 1";
64 cmd-2 = "workspace 2";
65 cmd-3 = "workspace 3";
66 cmd-4 = "workspace 4";
67 cmd-5 = "workspace 5";
68 cmd-6 = "workspace 6";
69 cmd-7 = "workspace 7";
70 cmd-8 = "workspace 8";
71 cmd-9 = "workspace 9";
67 alt-1 = "workspace 1";
68 alt-2 = "workspace 2";
69 alt-3 = "workspace 3";
70 alt-4 = "workspace 4";
71 alt-5 = "workspace 5";
72 alt-6 = "workspace 6";
73 alt-7 = "workspace 7";
74 alt-8 = "workspace 8";
75 alt-9 = "workspace 9";
7276
7377 # See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace
74 cmd-shift-1 = "move-node-to-workspace 1";
75 cmd-shift-2 = "move-node-to-workspace 2";
76 cmd-shift-3 = "move-node-to-workspace 3";
77 cmd-shift-4 = "move-node-to-workspace 4";
78 cmd-shift-5 = "move-node-to-workspace 5";
79 cmd-shift-6 = "move-node-to-workspace 6";
80 cmd-shift-7 = "move-node-to-workspace 7";
81 cmd-shift-8 = "move-node-to-workspace 8";
82 cmd-shift-9 = "move-node-to-workspace 9";
78 alt-shift-1 = "move-node-to-workspace 1";
79 alt-shift-2 = "move-node-to-workspace 2";
80 alt-shift-3 = "move-node-to-workspace 3";
81 alt-shift-4 = "move-node-to-workspace 4";
82 alt-shift-5 = "move-node-to-workspace 5";
83 alt-shift-6 = "move-node-to-workspace 6";
84 alt-shift-7 = "move-node-to-workspace 7";
85 alt-shift-8 = "move-node-to-workspace 8";
86 alt-shift-9 = "move-node-to-workspace 9";
8387
8488 cmd-h = []; # Disable "hide application"
8589 cmd-alt-h = []; # Disable "hide others"
8690
87 # See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth
88 alt-tab = "workspace-back-and-forth";
89 # See: https://nikitabobko.github.io/AeroSpace/commands#move-workspace-to-monitor
90 alt-shift-tab = "move-workspace-to-monitor --wrap-around next";
91 # # See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth
92 # alt-tab = "workspace-back-and-forth";
93 # # See: https://nikitabobko.github.io/AeroSpace/commands#move-workspace-to-monitor
94 # alt-shift-tab = "move-workspace-to-monitor --wrap-around next";
9195
9296 # See: https://nikitabobko.github.io/AeroSpace/commands#mode
9397 alt-shift-semicolon = "mode service";
......@@ -112,7 +116,7 @@
112116 };
113117 after-startup-command = [
114118 "exec-and-forget sketchybar"
115 "exec-and-forget open /Applications/SwipeAeroSpace.app"
119 # "exec open /Applications/SwipeAeroSpace.app"
116120 ];
117121 exec-on-workspace-change = [
118122 "/bin/bash"
......@@ -124,8 +128,11 @@
124128 #Ghostty currently renders tabs as individual processes
125129 #Fix comes from https://ghostty.org/docs/help/macos-tiling-wms
126130 {
127 "if".app-id = "com.mitchellh.ghostty";
131 "if" = {
132 app-id = "com.mitchellh.ghostty";
133 };
128134 run = ["layout tiling"];
135 check-further-callbacks = true;
129136 }
130137 ];
131138 };
modules/macos/tiling/default.nix+1-1
......@@ -1,4 +1,4 @@
1{ lib, ... }: let
1{lib, ...}: let
22 inherit (lib) types;
33in {
44 imports = [
modules/macos/tiling/sketchybar-home.nix+368-364
......@@ -1,5 +1,6 @@
11{
22 pkgs,
3 lib,
34 config,
45 ...
56}: let
......@@ -7,393 +8,396 @@
78 # folder = "~/.dotfiles/files/sketchybar";
89 folder = ../../../files/sketchybar;
910in {
10 home.file = {
11 sketchybarrc = {
12 executable = true;
13 target = ".config/sketchybar/sketchybarrc";
14 text = ''
15 #!/usr/bin/env sh
11 home.file =
12 lib.attrsets.mapAttrs (file: value: (
13 lib.attrsets.overrideExisting value {enable = config.shared.darwin.tiling.enable;}
14 )) {
15 sketchybarrc = {
16 executable = true;
17 target = ".config/sketchybar/sketchybarrc";
18 text = ''
19 #!/usr/bin/env sh
1620
17 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
18 source "$HOME/.config/sketchybar/icons.sh" # Loads all defined icons
21 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
22 source "$HOME/.config/sketchybar/icons.sh" # Loads all defined icons
1923
20 ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured
21 PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored
24 ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured
25 PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored
2226
23 FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants
24 PADDINGS=3 # All paddings use this value (icon, label, background)
27 FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants
28 PADDINGS=3 # All paddings use this value (icon, label, background)
2529
26 # Setting up and starting the helper process
27 HELPER=git.felix.helper
28 killall helper
29 cd $HOME/.config/sketchybar/helper && make
30 $HOME/.config/sketchybar/helper/helper $HELPER > /dev/null 2>&1 &
30 # Setting up and starting the helper process
31 HELPER=git.felix.helper
32 killall helper
33 cd $HOME/.config/sketchybar/helper && make
34 $HOME/.config/sketchybar/helper/helper $HELPER > /dev/null 2>&1 &
3135
32 # Unload the macOS on screen indicator overlay for volume change
33 # launchctl unload -F /System/Library/LaunchAgents/com.apple.OSDUIHelper.plist > /dev/null 2>&1 &
36 # Unload the macOS on screen indicator overlay for volume change
37 # launchctl unload -F /System/Library/LaunchAgents/com.apple.OSDUIHelper.plist > /dev/null 2>&1 &
3438
35 # Setting up the general bar appearance and default values
36 ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \
37 color=$BAR_COLOR \
38 shadow=off \
39 position=top \
40 sticky=on \
41 padding_right=0 \
42 padding_left=0 \
43 corner_radius=12 \
44 y_offset=0 \
45 margin=2 \
46 blur_radius=0 \
47 notch_width=0 \
48 --default updates=when_shown \
49 icon.font="$FONT:Bold:14.0" \
50 icon.color=$ICON_COLOR \
51 icon.padding_left=$PADDINGS \
52 icon.padding_right=$PADDINGS \
53 label.font="$FONT:Semibold:13.0" \
54 label.color=$LABEL_COLOR \
55 label.padding_left=$PADDINGS \
56 label.padding_right=$PADDINGS \
57 background.padding_right=$PADDINGS \
58 background.padding_left=$PADDINGS \
59 background.height=26 \
60 background.corner_radius=9 \
61 popup.background.border_width=2 \
62 popup.background.corner_radius=11 \
63 popup.background.border_color=$POPUP_BORDER_COLOR \
64 popup.background.color=$POPUP_BACKGROUND_COLOR \
65 popup.background.shadow.drawing=on
39 # Setting up the general bar appearance and default values
40 ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \
41 color=$BAR_COLOR \
42 shadow=off \
43 position=top \
44 sticky=on \
45 padding_right=0 \
46 padding_left=0 \
47 corner_radius=12 \
48 y_offset=0 \
49 margin=2 \
50 blur_radius=0 \
51 notch_width=0 \
52 --default updates=when_shown \
53 icon.font="$FONT:Bold:14.0" \
54 icon.color=$ICON_COLOR \
55 icon.padding_left=$PADDINGS \
56 icon.padding_right=$PADDINGS \
57 label.font="$FONT:Semibold:13.0" \
58 label.color=$LABEL_COLOR \
59 label.padding_left=$PADDINGS \
60 label.padding_right=$PADDINGS \
61 background.padding_right=$PADDINGS \
62 background.padding_left=$PADDINGS \
63 background.height=26 \
64 background.corner_radius=9 \
65 popup.background.border_width=2 \
66 popup.background.corner_radius=11 \
67 popup.background.border_color=$POPUP_BORDER_COLOR \
68 popup.background.color=$POPUP_BACKGROUND_COLOR \
69 popup.background.shadow.drawing=on
6670
67 # Left
68 source "$ITEM_DIR/apple.sh"
69 source "$ITEM_DIR/spaces.sh"
70 source "$ITEM_DIR/front_app.sh"
71 # Left
72 source "$ITEM_DIR/apple.sh"
73 source "$ITEM_DIR/spaces.sh"
74 source "$ITEM_DIR/front_app.sh"
7175
72 # Center
73 # source "$ITEM_DIR/spotify.sh"
74 source "$ITEM_DIR/calendar.sh"
76 # Center
77 # source "$ITEM_DIR/spotify.sh"
78 source "$ITEM_DIR/calendar.sh"
7579
76 # Right
77 # source "$ITEM_DIR/brew.sh"
78 # source "$ITEM_DIR/github.sh"
79 source "$ITEM_DIR/volume.sh"
80 # source "$ITEM_DIR/divider.sh"
81 # source "$ITEM_DIR/cpu.sh"
80 # Right
81 # source "$ITEM_DIR/brew.sh"
82 # source "$ITEM_DIR/github.sh"
83 source "$ITEM_DIR/volume.sh"
84 # source "$ITEM_DIR/divider.sh"
85 # source "$ITEM_DIR/cpu.sh"
8286
83 # Forcing all item scripts to run (never do this outside of sketchybarrc)
84 ${pkgs.sketchybar}/bin/sketchybar --update
87 # Forcing all item scripts to run (never do this outside of sketchybarrc)
88 ${pkgs.sketchybar}/bin/sketchybar --update
8589
86 echo "sketchybar configuation loaded.."
87 '';
88 };
89 icons = {
90 executable = true;
91 target = ".config/sketchybar/icons.sh";
92 source = folder + /icons.sh;
93 };
94 colors = {
95 executable = true;
96 target = ".config/sketchybar/colors.sh";
97 text = ''
98 #!/usr/bin/env sh
99 # Color Palette
100 export BLACK=0xff4c4f69
101 export WHITE=0xffeff1f5
102 export RED=0xffd20f39
103 export GREEN=0xff40a02b
104 export BLUE=0xff1e66f5
105 export YELLOW=0xffdf8e1d
106 export ORANGE=0xfffe640b
107 export MAGENTA=0xffea76cb
108 export GREY=0xff9ca0b0
109 export TRANSPARENT=0xff000000
110 export BLUE2=0xff7287fd
111 export FLAMINGO=0xffdd7878
90 echo "sketchybar configuation loaded.."
91 '';
92 };
93 icons = {
94 executable = true;
95 target = ".config/sketchybar/icons.sh";
96 source = folder + /icons.sh;
97 };
98 colors = {
99 executable = true;
100 target = ".config/sketchybar/colors.sh";
101 text = ''
102 #!/usr/bin/env sh
103 # Color Palette
104 export BLACK=0xff4c4f69
105 export WHITE=0xffeff1f5
106 export RED=0xffd20f39
107 export GREEN=0xff40a02b
108 export BLUE=0xff1e66f5
109 export YELLOW=0xffdf8e1d
110 export ORANGE=0xfffe640b
111 export MAGENTA=0xffea76cb
112 export GREY=0xff9ca0b0
113 export TRANSPARENT=0xff000000
114 export BLUE2=0xff7287fd
115 export FLAMINGO=0xffdd7878
112116
113 # General bar colors
114 export BAR_COLOR=0xeff1f5ff # Color of the bar
115 export ICON_COLOR=0xff4c4f69
116 export LABEL_COLOR=0xff4c4f69 # Color of all labels
117 export BACKGROUND_1=0xffbcc0cc
118 export BACKGROUND_2=0xffbcc0cc
117 # General bar colors
118 export BAR_COLOR=0xeff1f5ff # Color of the bar
119 export ICON_COLOR=0xff4c4f69
120 export LABEL_COLOR=0xff4c4f69 # Color of all labels
121 export BACKGROUND_1=0xffbcc0cc
122 export BACKGROUND_2=0xffbcc0cc
119123
120 export POPUP_BACKGROUND_COLOR=$BLACK
121 export POPUP_BORDER_COLOR=$WHITE
124 export POPUP_BACKGROUND_COLOR=$BLACK
125 export POPUP_BORDER_COLOR=$WHITE
122126
123 export SHADOW_COLOR=$BLACK
124 '';
125 };
126 items_apple = {
127 executable = true;
128 target = ".config/sketchybar/items/apple.sh";
129 source = folder + /items/executable_apple.sh;
130 };
131 items_brew = {
132 executable = true;
133 target = ".config/sketchybar/items/brew.sh";
134 source = folder + /items/executable_brew.sh;
135 };
136 items_calendar = {
137 executable = true;
138 target = ".config/sketchybar/items/calendar.sh";
139 text = ''
140 #!/usr/bin/env sh
127 export SHADOW_COLOR=$BLACK
128 '';
129 };
130 items_apple = {
131 executable = true;
132 target = ".config/sketchybar/items/apple.sh";
133 source = folder + /items/executable_apple.sh;
134 };
135 items_brew = {
136 executable = true;
137 target = ".config/sketchybar/items/brew.sh";
138 source = folder + /items/executable_brew.sh;
139 };
140 items_calendar = {
141 executable = true;
142 target = ".config/sketchybar/items/calendar.sh";
143 text = ''
144 #!/usr/bin/env sh
141145
142 sketchybar --add item calendar center \
143 --set calendar icon=cal \
144 display=1 \
145 icon.font="$FONT:Black:12.0" \
146 icon.padding_right=0 \
147 label.width=50 \
148 label.align=right \
149 background.padding_left=15 \
150 update_freq=30 \
151 script="$PLUGIN_DIR/calendar.sh" \
152 click_script="$PLUGIN_DIR/zen.sh"
153 '';
154 };
155 items_cpu = {
156 executable = true;
157 target = ".config/sketchybar/items/cpu.sh";
158 source = folder + /items/executable_cpu.sh;
159 };
160 items_divider = {
161 executable = true;
162 target = ".config/sketchybar/items/divider.sh";
163 source = folder + /items/executable_divider.sh;
164 };
165 items_front_app = {
166 executable = true;
167 target = ".config/sketchybar/items/front_app.sh";
168 text = ''
169 #!/usr/bin/env sh
170 FRONT_APP_SCRIPT='sketchybar --set $NAME label="$INFO"'
171 sketchybar --add event window_focus \
172 --add event windows_on_spaces \
173 --add item system.aerospace left \
174 --set system.aerospace script="$PLUGIN_DIR/aerospace.sh" \
175 icon.font="$FONT:Bold:16.0" \
176 label.drawing=off \
177 icon.width=30 \
178 icon=$YABAI_GRID \
179 icon.color=$BLACK \
180 updates=on \
181 display=active \
182 --subscribe system.aerospace window_focus \
183 windows_on_spaces \
184 mouse.clicked \
185 --add item front_app left \
186 --set front_app script="$FRONT_APP_SCRIPT" \
187 icon.drawing=off \
188 background.padding_left=0 \
189 background.padding_right=10 \
190 label.color=$BLACK \
191 label.font="$FONT:Black:12.0" \
192 display=active \
193 --subscribe front_app front_app_switched
194 '';
195 };
196 items_github = {
197 executable = true;
198 target = ".config/sketchybar/items/github.sh";
199 source = folder + /items/executable_github.sh;
200 };
201 items_spaces = {
202 executable = true;
203 target = ".config/sketchybar/items/spaces.sh";
204 # label.background.color=$BACKGROUND_2
205 text = ''
206 ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_workspace_change
207 ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_mode_change
208 for sid in $(${pkgs.aerospace}/bin/aerospace list-workspaces --all); do
209 ${pkgs.sketchybar}/bin/sketchybar --add item space.$sid left \
210 --subscribe space.$sid aerospace_workspace_change \
211 --subscribe space.$sid aerospace_mode_change \
212 --set space.$sid \
213 icon=$sid \
214 icon.padding_left=22 \
215 icon.padding_right=22 \
216 icon.highlight_color=$WHITE \
217 icon.highlight=off \
218 icon.color=0xff4c566a \
219 background.padding_left=-8 \
220 background.padding_right=-8 \
221 background.color=$BACKGROUND_1 \
222 background.drawing=on \
223 script="$PLUGIN_DIR/aerospace.sh $sid" \
224 click_script="aerospace workspace $sid" \
225 label.font="Iosevka Nerd Font:Regular:16.0" \
226 label.padding_right=33 \
227 label.background.height=26 \
228 label.background.drawing=on \
229 label.background.corner_radius=9 \
230 label.drawing=off
231 done
232 ${pkgs.sketchybar}/bin/sketchybar --add item separator left \
233 --set separator icon= \
234 icon.font="Iosevka Nerd Font:Regular:16.0" \
235 background.padding_left=26 \
236 background.padding_right=15 \
237 label.drawing=off \
238 display=active \
239 icon.color=$GREEN
240 '';
241 };
242 items_spotify = {
243 executable = true;
244 target = ".config/sketchybar/items/spotify.sh";
245 source = folder + /items/executable_spotify.sh;
246 };
247 items_volume = {
248 executable = true;
249 target = ".config/sketchybar/items/volume.sh";
250 text = ''
251 INITIAL_WIDTH=$(osascript -e 'set ovol to output volume of (get volume settings)')
252 ${pkgs.sketchybar}/bin/sketchybar --add item volume right \
253 --subscribe volume volume_change \
254 --set volume script="$PLUGIN_DIR/volume.sh" \
255 updates=on \
256 icon.background.drawing=on \
257 icon.background.color=$FLAMINGO \
258 icon.background.height=8 \
259 icon.background.corner_radius=3 \
260 icon.width=$INITIAL_WIDTH \
261 width=100 \
262 icon.align=right \
263 label.drawing=off \
264 background.drawing=on \
265 background.color=$BACKGROUND_2 \
266 background.height=8 \
267 background.corner_radius=3 \
268 align=left
146 sketchybar --add item calendar center \
147 --set calendar icon=cal \
148 display=1 \
149 icon.font="$FONT:Black:12.0" \
150 icon.padding_right=0 \
151 label.width=50 \
152 label.align=right \
153 background.padding_left=15 \
154 update_freq=30 \
155 script="$PLUGIN_DIR/calendar.sh" \
156 click_script="$PLUGIN_DIR/zen.sh"
157 '';
158 };
159 items_cpu = {
160 executable = true;
161 target = ".config/sketchybar/items/cpu.sh";
162 source = folder + /items/executable_cpu.sh;
163 };
164 items_divider = {
165 executable = true;
166 target = ".config/sketchybar/items/divider.sh";
167 source = folder + /items/executable_divider.sh;
168 };
169 items_front_app = {
170 executable = true;
171 target = ".config/sketchybar/items/front_app.sh";
172 text = ''
173 #!/usr/bin/env sh
174 FRONT_APP_SCRIPT='sketchybar --set $NAME label="$INFO"'
175 sketchybar --add event window_focus \
176 --add event windows_on_spaces \
177 --add item system.aerospace left \
178 --set system.aerospace script="$PLUGIN_DIR/aerospace.sh" \
179 icon.font="$FONT:Bold:16.0" \
180 label.drawing=off \
181 icon.width=30 \
182 icon=$YABAI_GRID \
183 icon.color=$BLACK \
184 updates=on \
185 display=active \
186 --subscribe system.aerospace window_focus \
187 windows_on_spaces \
188 mouse.clicked \
189 --add item front_app left \
190 --set front_app script="$FRONT_APP_SCRIPT" \
191 icon.drawing=off \
192 background.padding_left=0 \
193 background.padding_right=10 \
194 label.color=$BLACK \
195 label.font="$FONT:Black:12.0" \
196 display=active \
197 --subscribe front_app front_app_switched
198 '';
199 };
200 items_github = {
201 executable = true;
202 target = ".config/sketchybar/items/github.sh";
203 source = folder + /items/executable_github.sh;
204 };
205 items_spaces = {
206 executable = true;
207 target = ".config/sketchybar/items/spaces.sh";
208 # label.background.color=$BACKGROUND_2
209 text = ''
210 ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_workspace_change
211 ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_mode_change
212 for sid in $(${pkgs.aerospace}/bin/aerospace list-workspaces --all); do
213 ${pkgs.sketchybar}/bin/sketchybar --add item space.$sid left \
214 --subscribe space.$sid aerospace_workspace_change \
215 --subscribe space.$sid aerospace_mode_change \
216 --set space.$sid \
217 icon=$sid \
218 icon.padding_left=22 \
219 icon.padding_right=22 \
220 icon.highlight_color=$WHITE \
221 icon.highlight=off \
222 icon.color=0xff4c566a \
223 background.padding_left=-8 \
224 background.padding_right=-8 \
225 background.color=$BACKGROUND_1 \
226 background.drawing=on \
227 script="$PLUGIN_DIR/aerospace.sh $sid" \
228 click_script="aerospace workspace $sid" \
229 label.font="Iosevka Nerd Font:Regular:16.0" \
230 label.padding_right=33 \
231 label.background.height=26 \
232 label.background.drawing=on \
233 label.background.corner_radius=9 \
234 label.drawing=off
235 done
236 ${pkgs.sketchybar}/bin/sketchybar --add item separator left \
237 --set separator icon= \
238 icon.font="Iosevka Nerd Font:Regular:16.0" \
239 background.padding_left=26 \
240 background.padding_right=15 \
241 label.drawing=off \
242 display=active \
243 icon.color=$GREEN
244 '';
245 };
246 items_spotify = {
247 executable = true;
248 target = ".config/sketchybar/items/spotify.sh";
249 source = folder + /items/executable_spotify.sh;
250 };
251 items_volume = {
252 executable = true;
253 target = ".config/sketchybar/items/volume.sh";
254 text = ''
255 INITIAL_WIDTH=$(osascript -e 'set ovol to output volume of (get volume settings)')
256 ${pkgs.sketchybar}/bin/sketchybar --add item volume right \
257 --subscribe volume volume_change \
258 --set volume script="$PLUGIN_DIR/volume.sh" \
259 updates=on \
260 icon.background.drawing=on \
261 icon.background.color=$FLAMINGO \
262 icon.background.height=8 \
263 icon.background.corner_radius=3 \
264 icon.width=$INITIAL_WIDTH \
265 width=100 \
266 icon.align=right \
267 label.drawing=off \
268 background.drawing=on \
269 background.color=$BACKGROUND_2 \
270 background.height=8 \
271 background.corner_radius=3 \
272 align=left
269273
270 ${pkgs.sketchybar}/bin/sketchybar --add alias "Control Center,Sound" right \
271 --rename "Control Center,Sound" volume_alias \
272 --set volume_alias icon.drawing=off \
273 label.drawing=off \
274 alias.color=$BLUE2 \
275 background.padding_right=0 \
276 background.padding_left=5 \
277 width=50 \
278 align=right \
279 click_script="$PLUGIN_DIR/volume_click.sh"
274 ${pkgs.sketchybar}/bin/sketchybar --add alias "Control Center,Sound" right \
275 --rename "Control Center,Sound" volume_alias \
276 --set volume_alias icon.drawing=off \
277 label.drawing=off \
278 alias.color=$BLUE2 \
279 background.padding_right=0 \
280 background.padding_left=5 \
281 width=50 \
282 align=right \
283 click_script="$PLUGIN_DIR/volume_click.sh"
280284
281 '';
282 };
283 plugins_brew = {
284 executable = true;
285 target = ".config/sketchybar/plugins/brew.sh";
286 source = folder + /plugins/executable_brew.sh;
287 };
288 plugins_calendar = {
289 executable = true;
290 target = ".config/sketchybar/plugins/calendar.sh";
291 source = folder + /plugins/executable_calendar.sh;
292 };
293 plugins_github = {
294 executable = true;
295 target = ".config/sketchybar/plugins/github.sh";
296 source = folder + /plugins/executable_github.sh;
297 };
298 plugins_icon_map = {
299 executable = true;
300 target = ".config/sketchybar/plugins/icon_map.sh";
301 source = folder + /plugins/executable_icon_map.sh;
302 };
303 plugins_space = {
304 executable = true;
305 target = ".config/sketchybar/plugins/space.sh";
306 source = folder + /plugins/executable_space.sh;
307 };
308 plugins_spotify = {
309 executable = true;
310 target = ".config/sketchybar/plugins/spotify.sh";
311 source = folder + /plugins/executable_spotify.sh;
312 };
313 plugins_volume = {
314 executable = true;
315 target = ".config/sketchybar/plugins/volume.sh";
316 text = ''
317 #!/usr/bin/env sh
318 WIDTH=100
285 '';
286 };
287 plugins_brew = {
288 executable = true;
289 target = ".config/sketchybar/plugins/brew.sh";
290 source = folder + /plugins/executable_brew.sh;
291 };
292 plugins_calendar = {
293 executable = true;
294 target = ".config/sketchybar/plugins/calendar.sh";
295 source = folder + /plugins/executable_calendar.sh;
296 };
297 plugins_github = {
298 executable = true;
299 target = ".config/sketchybar/plugins/github.sh";
300 source = folder + /plugins/executable_github.sh;
301 };
302 plugins_icon_map = {
303 executable = true;
304 target = ".config/sketchybar/plugins/icon_map.sh";
305 source = folder + /plugins/executable_icon_map.sh;
306 };
307 plugins_space = {
308 executable = true;
309 target = ".config/sketchybar/plugins/space.sh";
310 source = folder + /plugins/executable_space.sh;
311 };
312 plugins_spotify = {
313 executable = true;
314 target = ".config/sketchybar/plugins/spotify.sh";
315 source = folder + /plugins/executable_spotify.sh;
316 };
317 plugins_volume = {
318 executable = true;
319 target = ".config/sketchybar/plugins/volume.sh";
320 text = ''
321 #!/usr/bin/env sh
322 WIDTH=100
319323
320 volume_change() {
321 # INITIAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width")
322 # if [ "$INITIAL_WIDTH" -eq "0" ]; then
323 # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=$WIDTH icon.width=$INFO
324 # else
325 # ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO width=$WIDTH
326 # fi
327 ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO
324 volume_change() {
325 # INITIAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width")
326 # if [ "$INITIAL_WIDTH" -eq "0" ]; then
327 # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=$WIDTH icon.width=$INFO
328 # else
329 # ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO width=$WIDTH
330 # fi
331 ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO
328332
329333
330 # sleep 5
331 # FINAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width")
332 # if [ "$FINAL_WIDTH" -eq "$INFO" ]; then
333 # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=0 icon.width=0
334 # fi
335 }
336
337 case "$SENDER" in
338 "volume_change") volume_change
339 ;;
340 esac
341 '';
342 };
343 plugins_volume_click = {
344 executable = true;
345 target = ".config/sketchybar/plugins/volume_click.sh";
346 text = ''
347 #!/usr/bin/env sh
348 MUTED=$(osascript -e 'output muted of (get volume settings)')
349 if [ "$MUTED" = "false" ]; then
350 osascript -e 'set volume output muted true'
351 else
352 osascript -e 'set volume output muted false'
353 fi
354 '';
355 };
356 plugins_zen = {
357 executable = true;
358 target = ".config/sketchybar/plugins/zen.sh";
359 source = folder + /plugins/executable_zen.sh;
360 };
361 plugins_aerospace = {
362 executable = true;
363 target = ".config/sketchybar/plugins/aerospace.sh";
364 text = ''
365 #!/usr/bin/env bash
366 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
334 # sleep 5
335 # FINAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width")
336 # if [ "$FINAL_WIDTH" -eq "$INFO" ]; then
337 # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=0 icon.width=0
338 # fi
339 }
367340
368 highlight_focused_workspace() {
369 if [[ "$1" = "$FOCUSED_WORKSPACE" ]]
370 then
371 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0
341 case "$SENDER" in
342 "volume_change") volume_change
343 ;;
344 esac
345 '';
346 };
347 plugins_volume_click = {
348 executable = true;
349 target = ".config/sketchybar/plugins/volume_click.sh";
350 text = ''
351 #!/usr/bin/env sh
352 MUTED=$(osascript -e 'output muted of (get volume settings)')
353 if [ "$MUTED" = "false" ]; then
354 osascript -e 'set volume output muted true'
372355 else
373 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic
356 osascript -e 'set volume output muted false'
374357 fi
375 }
358 '';
359 };
360 plugins_zen = {
361 executable = true;
362 target = ".config/sketchybar/plugins/zen.sh";
363 source = folder + /plugins/executable_zen.sh;
364 };
365 plugins_aerospace = {
366 executable = true;
367 target = ".config/sketchybar/plugins/aerospace.sh";
368 text = ''
369 #!/usr/bin/env bash
370 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
376371
377 illuminate_mode() {
378 if [[ "$mode" = "service" ]]
379 then
380 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE
381 elif [[ "$mode" = "resize" ]]
382 then
383 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN
384 else
385 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1
386 fi
387 }
388 case "$SENDER" in
389 "aerospace_workspace_change")
390 highlight_focused_workspace $1
391 ;;
392 "aerospace_mode_change")
393 illuminate_mode
394 ;;
395 esac
396 '';
372 highlight_focused_workspace() {
373 if [[ "$1" = "$FOCUSED_WORKSPACE" ]]
374 then
375 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0
376 else
377 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic
378 fi
379 }
380
381 illuminate_mode() {
382 if [[ "$mode" = "service" ]]
383 then
384 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE
385 elif [[ "$mode" = "resize" ]]
386 then
387 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN
388 else
389 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1
390 fi
391 }
392 case "$SENDER" in
393 "aerospace_workspace_change")
394 highlight_focused_workspace $1
395 ;;
396 "aerospace_mode_change")
397 illuminate_mode
398 ;;
399 esac
400 '';
401 };
397402 };
398 };
399403}
modules/macos/tiling/sketchybar.nix+6-146
......@@ -1,150 +1,10 @@
1{config,pkgs, ...}: {
1{
2 config,
3 pkgs,
4 ...
5}: {
26 services.sketchybar = {
37 enable = config.shared.darwin.tiling.enable;
4 config = ''
5 # This is a demo config to showcase some of the most important commands.
6 # It is meant to be changed and configured, as it is intentionally kept sparse.
7 # For a (much) more advanced configuration example see my dotfiles:
8 # https://github.com/FelixKratz/dotfiles
9
10 PLUGIN_DIR="$CONFIG_DIR/plugins"
11
12 ##### Bar Appearance #####
13 # Configuring the general appearance of the bar.
14 # These are only some of the options available. For all options see:
15 # https://felixkratz.github.io/SketchyBar/config/bar
16 # If you are looking for other colors, see the color picker:
17 # https://felixkratz.github.io/SketchyBar/config/tricks#color-picker
18
19 sketchybar --bar position=top height=40 blur_radius=30 color=0x04313244
20
21 # Colours
22 SURFACE=0xff313244
23
24 ##### Changing Defaults #####
25 # We now change some default values, which are applied to all further items.
26 # For a full list of all available item properties see:
27 # https://felixkratz.github.io/SketchyBar/config/items
28
29 default=(
30 padding_left=5
31 padding_right=5
32 icon.font="Hack Nerd Font:Bold:17.0"
33 label.font="Hack Nerd Font:Bold:14.0"
34 icon.color=0xffcdd6f4
35 label.color=0xffcdd6f4
36 icon.padding_left=8
37 icon.padding_right=4
38 label.padding_left=4
39 label.padding_right=8
40 background.padding_left=2
41 background.padding_right=2
42 background.color=$SURFACE \
43 background.corner_radius=10 \
44 background.height=30 \
45 background.border_width=1 \
46 )
47 sketchybar --default "$\{default[@]}"
48
49 sketchybar --add event aerospace_workspace_change
50
51 for sid in $(aerospace list-workspaces --all); do
52 sketchybar --add item space.$sid left \
53 --subscribe space.$sid aerospace_workspace_change \
54 --set space.$sid \
55 background.border_width=1 \
56 background.border_color=0xffb4befe \
57 background.corner_radius=5 \
58 background.height=20 \
59 icon.padding_left=0 \
60 icon.padding_right=0 \
61 label.padding_right=6 \
62 label="$sid" \
63 click_script="aerospace workspace $sid" \
64 script="$CONFIG_DIR/plugins/aerospace.sh $sid"
65 done
66
67 ##### Adding Left Items #####
68 # We add some regular items to the left side of the bar, where
69 # only the properties deviating from the current defaults need to be set
70
71 sketchybar --add item chevron left \
72 --set chevron icon= label.drawing=off background.drawing=off \
73 icon.color=0xfff5e0dc \
74 --add item front_app left \
75 --set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \
76 label.color=0xff94e2d5 \
77 label.padding_left=8 \
78 background.border_color=0xff94e2d5 \
79 --subscribe front_app front_app_switched
80
81 ##### Adding Right Items #####
82 # In the same way as the left items we can add items to the right side.
83 # Additional position (e.g. center) are available, see:
84 # https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar
85
86 # Some items refresh on a fixed cycle, e.g. the clock runs its script once
87 # every 10s. Other items respond to events they subscribe to, e.g. the
88 # volume.sh script is only executed once an actual change in system audio
89 # volume is registered. More info about the event system can be found here:
90 # https://felixkratz.github.io/SketchyBar/config/events
91
92 sketchybar --add item clock right \
93 --set clock update_freq=10 icon=󰃰 script="$PLUGIN_DIR/clock.sh" \
94 icon.color=0xfffab387 \
95 label.color=0xffcdd6f4 \
96 background.color=$SURFACE \
97 background.corner_radius=10 \
98 background.height=30 \
99 --add item volume right \
100 --set volume script="$PLUGIN_DIR/volume.sh" \
101 label.color=0xffcdd6f4 \
102 background.color=$SURFACE \
103 background.corner_radius=10 \
104 background.height=30 \
105 --subscribe volume volume_change \
106 --add item battery right \
107 --set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \
108 label.color=0xffcdd6f4 \
109 background.color=$SURFACE \
110 background.corner_radius=10 \
111 background.height=30 \
112 --subscribe battery system_woke power_source_change
113
114 sketchybar -m --add item mullvad right \
115 --set mullvad icon= \
116 icon.color=0xfff38ba8 \
117 background.color=$SURFACE \
118 background.corner_radius=10 \
119 background.height=30 \
120 background.border_width=1 \
121 background.border_color=0xfff38ba8 \
122 label.padding_left=0 \
123 label.padding_right=0 \
124 icon.padding_left=6 \
125 update_freq=5 \
126 script="$PLUGIN_DIR/mullvad.sh"
127
128 # Add event
129 sketchybar -m --add event song_update com.apple.iTunes.playerInfo
130
131 # Add Music Item
132 sketchybar -m --add item music right \
133 --set music script="$PLUGIN_DIR/music.sh" \
134 click_script="$PLUGIN_DIR/music_click.sh" \
135 label.padding_right=10 \
136 label.color=0xffcdd6f4 \
137 background.color=$SURFACE \
138 background.corner_radius=10 \
139 background.height=30 \
140 background.border_width=1 \
141 background.border_color=0xfff38ba8 \
142 drawing=off \
143 --subscribe music song_update
144
145 ##### Force all scripts to run the first time (never do this in a script) #####
146 sketchybar --update
147
148 '';
8 package = pkgs.sketchybar;
1499 };
15010}
users/natalie/configuration.nix+8-2
......@@ -1,5 +1,10 @@
11# Applied to all systems
2{pkgs, ...}: {
2{
3 inputs,
4 pkgs,
5 host,
6 ...
7}: {
38 services.tailscale.enable = true;
49 fonts.packages = with pkgs; [
510 nerd-fonts.fira-code
......@@ -7,11 +12,12 @@
712 iosevka
813 nerd-fonts.symbols-only
914 nerd-fonts.iosevka
15 inputs.apple-fonts.packages.${pkgs.system}.sf-pro
1016 ];
1117
1218 # configuration for shared modules.
1319 # all custom options in 'shared' for clarity.
1420 shared.darwin = {
15 tiling.enable = true; # use tiling window manager
21 tiling.enable = host.darwin; # use tiling window manager
1622 };
1723}
users/natalie/home.nix+1
......@@ -9,6 +9,7 @@
99 bat.enable = true;
1010 hyfetch.enable = true;
1111 direnv.enable = true;
12 fish.enable = true;
1213 # sort-lines:end
1314 };
1415