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 @@...@@ -38,6 +38,11 @@
38 hostHomePath = hostDir + "/home.nix";38 hostHomePath = hostDir + "/home.nix";
39 userHomePath = userDir + "/home.nix";39 userHomePath = userDir + "/home.nix";
4040
41 pathOrNull = a:
42 if pathExists a
43 then a
44 else null;
45
41 # Arguments passed to all module files46 # Arguments passed to all module files
42 args = {47 args = {
43 inherit inputs;48 inherit inputs;
...@@ -94,15 +99,11 @@ in...@@ -94,15 +99,11 @@ in
94 )99 )
95100
96 # The user-wide configuration.nix101 # The user-wide configuration.nix
97 (102 (pathOrNull userConfigPath)
98 if pathExists userConfigPath
99 then userConfigPath
100 else null
101 )
102 # The host-wide configuration.nix103 # The host-wide configuration.nix
103 (104 (
104 if host != null && pathExists hostConfigPath105 if host != null
105 then hostConfigPath106 then pathOrNull hostConfigPath
106 else null107 else null
107 )108 )
108109
...@@ -127,15 +128,15 @@ in...@@ -127,15 +128,15 @@ in
127 // {128 // {
128 mainHomeImports = builtins.filter (f: f != null) [129 mainHomeImports = builtins.filter (f: f != null) [
129 (130 (
130 if pathExists userHomePath131 pathOrNull userHomePath
131 then userHomePath
132 else null
133 )132 )
134 (133 (
135 if host != null && pathExists hostHomePath134 if host != null
136 then hostHomePath135 then pathOrNull hostHomePath
137 else null136 else null
138 )137 )
138 #Can't have conditional import path
139 ../modules/macos/tiling/sketchybar-home.nix
139 ];140 ];
140 };141 };
141 # can't find how to make this an array without the param142 # can't find how to make this an array without the param
modules/macos/tiling/aerospace.nix+32-25
...@@ -1,4 +1,8 @@...@@ -1,4 +1,8 @@
1{config,pkgs, ...}: {1{
2 config,
3 pkgs,
4 ...
5}: {
2 services.aerospace = {6 services.aerospace = {
3 enable = config.shared.darwin.tiling.enable;7 enable = config.shared.darwin.tiling.enable;
4 settings = {8 settings = {
...@@ -60,34 +64,34 @@...@@ -60,34 +64,34 @@
60 alt-equal = "resize smart +50";64 alt-equal = "resize smart +50";
6165
62 # See: https://nikitabobko.github.io/AeroSpace/commands#workspace66 # See: https://nikitabobko.github.io/AeroSpace/commands#workspace
63 cmd-1 = "workspace 1";67 alt-1 = "workspace 1";
64 cmd-2 = "workspace 2";68 alt-2 = "workspace 2";
65 cmd-3 = "workspace 3";69 alt-3 = "workspace 3";
66 cmd-4 = "workspace 4";70 alt-4 = "workspace 4";
67 cmd-5 = "workspace 5";71 alt-5 = "workspace 5";
68 cmd-6 = "workspace 6";72 alt-6 = "workspace 6";
69 cmd-7 = "workspace 7";73 alt-7 = "workspace 7";
70 cmd-8 = "workspace 8";74 alt-8 = "workspace 8";
71 cmd-9 = "workspace 9";75 alt-9 = "workspace 9";
7276
73 # See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace77 # See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace
74 cmd-shift-1 = "move-node-to-workspace 1";78 alt-shift-1 = "move-node-to-workspace 1";
75 cmd-shift-2 = "move-node-to-workspace 2";79 alt-shift-2 = "move-node-to-workspace 2";
76 cmd-shift-3 = "move-node-to-workspace 3";80 alt-shift-3 = "move-node-to-workspace 3";
77 cmd-shift-4 = "move-node-to-workspace 4";81 alt-shift-4 = "move-node-to-workspace 4";
78 cmd-shift-5 = "move-node-to-workspace 5";82 alt-shift-5 = "move-node-to-workspace 5";
79 cmd-shift-6 = "move-node-to-workspace 6";83 alt-shift-6 = "move-node-to-workspace 6";
80 cmd-shift-7 = "move-node-to-workspace 7";84 alt-shift-7 = "move-node-to-workspace 7";
81 cmd-shift-8 = "move-node-to-workspace 8";85 alt-shift-8 = "move-node-to-workspace 8";
82 cmd-shift-9 = "move-node-to-workspace 9";86 alt-shift-9 = "move-node-to-workspace 9";
8387
84 cmd-h = []; # Disable "hide application"88 cmd-h = []; # Disable "hide application"
85 cmd-alt-h = []; # Disable "hide others"89 cmd-alt-h = []; # Disable "hide others"
8690
87 # See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth91 # # See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth
88 alt-tab = "workspace-back-and-forth";92 # alt-tab = "workspace-back-and-forth";
89 # See: https://nikitabobko.github.io/AeroSpace/commands#move-workspace-to-monitor93 # # See: https://nikitabobko.github.io/AeroSpace/commands#move-workspace-to-monitor
90 alt-shift-tab = "move-workspace-to-monitor --wrap-around next";94 # alt-shift-tab = "move-workspace-to-monitor --wrap-around next";
9195
92 # See: https://nikitabobko.github.io/AeroSpace/commands#mode96 # See: https://nikitabobko.github.io/AeroSpace/commands#mode
93 alt-shift-semicolon = "mode service";97 alt-shift-semicolon = "mode service";
...@@ -112,7 +116,7 @@...@@ -112,7 +116,7 @@
112 };116 };
113 after-startup-command = [117 after-startup-command = [
114 "exec-and-forget sketchybar"118 "exec-and-forget sketchybar"
115 "exec-and-forget open /Applications/SwipeAeroSpace.app"119 # "exec open /Applications/SwipeAeroSpace.app"
116 ];120 ];
117 exec-on-workspace-change = [121 exec-on-workspace-change = [
118 "/bin/bash"122 "/bin/bash"
...@@ -124,8 +128,11 @@...@@ -124,8 +128,11 @@
124 #Ghostty currently renders tabs as individual processes128 #Ghostty currently renders tabs as individual processes
125 #Fix comes from https://ghostty.org/docs/help/macos-tiling-wms129 #Fix comes from https://ghostty.org/docs/help/macos-tiling-wms
126 {130 {
127 "if".app-id = "com.mitchellh.ghostty";131 "if" = {
132 app-id = "com.mitchellh.ghostty";
133 };
128 run = ["layout tiling"];134 run = ["layout tiling"];
135 check-further-callbacks = true;
129 }136 }
130 ];137 ];
131 };138 };
modules/macos/tiling/default.nix+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1{ lib, ... }: let1{lib, ...}: let
2 inherit (lib) types;2 inherit (lib) types;
3in {3in {
4 imports = [4 imports = [
modules/macos/tiling/sketchybar-home.nix+368-364
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1{1{
2 pkgs,2 pkgs,
3 lib,
3 config,4 config,
4 ...5 ...
5}: let6}: let
...@@ -7,393 +8,396 @@...@@ -7,393 +8,396 @@
7 # folder = "~/.dotfiles/files/sketchybar";8 # folder = "~/.dotfiles/files/sketchybar";
8 folder = ../../../files/sketchybar;9 folder = ../../../files/sketchybar;
9in {10in {
10 home.file = {11 home.file =
11 sketchybarrc = {12 lib.attrsets.mapAttrs (file: value: (
12 executable = true;13 lib.attrsets.overrideExisting value {enable = config.shared.darwin.tiling.enable;}
13 target = ".config/sketchybar/sketchybarrc";14 )) {
14 text = ''15 sketchybarrc = {
15 #!/usr/bin/env sh16 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 colors21 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
18 source "$HOME/.config/sketchybar/icons.sh" # Loads all defined icons22 source "$HOME/.config/sketchybar/icons.sh" # Loads all defined icons
1923
20 ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured24 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 stored25 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 variants27 FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants
24 PADDINGS=3 # All paddings use this value (icon, label, background)28 PADDINGS=3 # All paddings use this value (icon, label, background)
2529
26 # Setting up and starting the helper process30 # Setting up and starting the helper process
27 HELPER=git.felix.helper31 HELPER=git.felix.helper
28 killall helper32 killall helper
29 cd $HOME/.config/sketchybar/helper && make33 cd $HOME/.config/sketchybar/helper && make
30 $HOME/.config/sketchybar/helper/helper $HELPER > /dev/null 2>&1 &34 $HOME/.config/sketchybar/helper/helper $HELPER > /dev/null 2>&1 &
3135
32 # Unload the macOS on screen indicator overlay for volume change36 # 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 &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 values39 # Setting up the general bar appearance and default values
36 ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \40 ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \
37 color=$BAR_COLOR \41 color=$BAR_COLOR \
38 shadow=off \42 shadow=off \
39 position=top \43 position=top \
40 sticky=on \44 sticky=on \
41 padding_right=0 \45 padding_right=0 \
42 padding_left=0 \46 padding_left=0 \
43 corner_radius=12 \47 corner_radius=12 \
44 y_offset=0 \48 y_offset=0 \
45 margin=2 \49 margin=2 \
46 blur_radius=0 \50 blur_radius=0 \
47 notch_width=0 \51 notch_width=0 \
48 --default updates=when_shown \52 --default updates=when_shown \
49 icon.font="$FONT:Bold:14.0" \53 icon.font="$FONT:Bold:14.0" \
50 icon.color=$ICON_COLOR \54 icon.color=$ICON_COLOR \
51 icon.padding_left=$PADDINGS \55 icon.padding_left=$PADDINGS \
52 icon.padding_right=$PADDINGS \56 icon.padding_right=$PADDINGS \
53 label.font="$FONT:Semibold:13.0" \57 label.font="$FONT:Semibold:13.0" \
54 label.color=$LABEL_COLOR \58 label.color=$LABEL_COLOR \
55 label.padding_left=$PADDINGS \59 label.padding_left=$PADDINGS \
56 label.padding_right=$PADDINGS \60 label.padding_right=$PADDINGS \
57 background.padding_right=$PADDINGS \61 background.padding_right=$PADDINGS \
58 background.padding_left=$PADDINGS \62 background.padding_left=$PADDINGS \
59 background.height=26 \63 background.height=26 \
60 background.corner_radius=9 \64 background.corner_radius=9 \
61 popup.background.border_width=2 \65 popup.background.border_width=2 \
62 popup.background.corner_radius=11 \66 popup.background.corner_radius=11 \
63 popup.background.border_color=$POPUP_BORDER_COLOR \67 popup.background.border_color=$POPUP_BORDER_COLOR \
64 popup.background.color=$POPUP_BACKGROUND_COLOR \68 popup.background.color=$POPUP_BACKGROUND_COLOR \
65 popup.background.shadow.drawing=on69 popup.background.shadow.drawing=on
6670
67 # Left71 # Left
68 source "$ITEM_DIR/apple.sh"72 source "$ITEM_DIR/apple.sh"
69 source "$ITEM_DIR/spaces.sh"73 source "$ITEM_DIR/spaces.sh"
70 source "$ITEM_DIR/front_app.sh"74 source "$ITEM_DIR/front_app.sh"
7175
72 # Center76 # Center
73 # source "$ITEM_DIR/spotify.sh"77 # source "$ITEM_DIR/spotify.sh"
74 source "$ITEM_DIR/calendar.sh"78 source "$ITEM_DIR/calendar.sh"
7579
76 # Right80 # Right
77 # source "$ITEM_DIR/brew.sh"81 # source "$ITEM_DIR/brew.sh"
78 # source "$ITEM_DIR/github.sh"82 # source "$ITEM_DIR/github.sh"
79 source "$ITEM_DIR/volume.sh"83 source "$ITEM_DIR/volume.sh"
80 # source "$ITEM_DIR/divider.sh"84 # source "$ITEM_DIR/divider.sh"
81 # source "$ITEM_DIR/cpu.sh"85 # source "$ITEM_DIR/cpu.sh"
8286
83 # Forcing all item scripts to run (never do this outside of sketchybarrc)87 # Forcing all item scripts to run (never do this outside of sketchybarrc)
84 ${pkgs.sketchybar}/bin/sketchybar --update88 ${pkgs.sketchybar}/bin/sketchybar --update
8589
86 echo "sketchybar configuation loaded.."90 echo "sketchybar configuation loaded.."
87 '';91 '';
88 };92 };
89 icons = {93 icons = {
90 executable = true;94 executable = true;
91 target = ".config/sketchybar/icons.sh";95 target = ".config/sketchybar/icons.sh";
92 source = folder + /icons.sh;96 source = folder + /icons.sh;
93 };97 };
94 colors = {98 colors = {
95 executable = true;99 executable = true;
96 target = ".config/sketchybar/colors.sh";100 target = ".config/sketchybar/colors.sh";
97 text = ''101 text = ''
98 #!/usr/bin/env sh102 #!/usr/bin/env sh
99 # Color Palette103 # Color Palette
100 export BLACK=0xff4c4f69104 export BLACK=0xff4c4f69
101 export WHITE=0xffeff1f5105 export WHITE=0xffeff1f5
102 export RED=0xffd20f39106 export RED=0xffd20f39
103 export GREEN=0xff40a02b107 export GREEN=0xff40a02b
104 export BLUE=0xff1e66f5108 export BLUE=0xff1e66f5
105 export YELLOW=0xffdf8e1d109 export YELLOW=0xffdf8e1d
106 export ORANGE=0xfffe640b110 export ORANGE=0xfffe640b
107 export MAGENTA=0xffea76cb111 export MAGENTA=0xffea76cb
108 export GREY=0xff9ca0b0112 export GREY=0xff9ca0b0
109 export TRANSPARENT=0xff000000113 export TRANSPARENT=0xff000000
110 export BLUE2=0xff7287fd114 export BLUE2=0xff7287fd
111 export FLAMINGO=0xffdd7878115 export FLAMINGO=0xffdd7878
112116
113 # General bar colors117 # General bar colors
114 export BAR_COLOR=0xeff1f5ff # Color of the bar118 export BAR_COLOR=0xeff1f5ff # Color of the bar
115 export ICON_COLOR=0xff4c4f69119 export ICON_COLOR=0xff4c4f69
116 export LABEL_COLOR=0xff4c4f69 # Color of all labels120 export LABEL_COLOR=0xff4c4f69 # Color of all labels
117 export BACKGROUND_1=0xffbcc0cc121 export BACKGROUND_1=0xffbcc0cc
118 export BACKGROUND_2=0xffbcc0cc122 export BACKGROUND_2=0xffbcc0cc
119123
120 export POPUP_BACKGROUND_COLOR=$BLACK124 export POPUP_BACKGROUND_COLOR=$BLACK
121 export POPUP_BORDER_COLOR=$WHITE125 export POPUP_BORDER_COLOR=$WHITE
122126
123 export SHADOW_COLOR=$BLACK127 export SHADOW_COLOR=$BLACK
124 '';128 '';
125 };129 };
126 items_apple = {130 items_apple = {
127 executable = true;131 executable = true;
128 target = ".config/sketchybar/items/apple.sh";132 target = ".config/sketchybar/items/apple.sh";
129 source = folder + /items/executable_apple.sh;133 source = folder + /items/executable_apple.sh;
130 };134 };
131 items_brew = {135 items_brew = {
132 executable = true;136 executable = true;
133 target = ".config/sketchybar/items/brew.sh";137 target = ".config/sketchybar/items/brew.sh";
134 source = folder + /items/executable_brew.sh;138 source = folder + /items/executable_brew.sh;
135 };139 };
136 items_calendar = {140 items_calendar = {
137 executable = true;141 executable = true;
138 target = ".config/sketchybar/items/calendar.sh";142 target = ".config/sketchybar/items/calendar.sh";
139 text = ''143 text = ''
140 #!/usr/bin/env sh144 #!/usr/bin/env sh
141145
142 sketchybar --add item calendar center \146 sketchybar --add item calendar center \
143 --set calendar icon=cal \147 --set calendar icon=cal \
144 display=1 \148 display=1 \
145 icon.font="$FONT:Black:12.0" \149 icon.font="$FONT:Black:12.0" \
146 icon.padding_right=0 \150 icon.padding_right=0 \
147 label.width=50 \151 label.width=50 \
148 label.align=right \152 label.align=right \
149 background.padding_left=15 \153 background.padding_left=15 \
150 update_freq=30 \154 update_freq=30 \
151 script="$PLUGIN_DIR/calendar.sh" \155 script="$PLUGIN_DIR/calendar.sh" \
152 click_script="$PLUGIN_DIR/zen.sh"156 click_script="$PLUGIN_DIR/zen.sh"
153 '';157 '';
154 };158 };
155 items_cpu = {159 items_cpu = {
156 executable = true;160 executable = true;
157 target = ".config/sketchybar/items/cpu.sh";161 target = ".config/sketchybar/items/cpu.sh";
158 source = folder + /items/executable_cpu.sh;162 source = folder + /items/executable_cpu.sh;
159 };163 };
160 items_divider = {164 items_divider = {
161 executable = true;165 executable = true;
162 target = ".config/sketchybar/items/divider.sh";166 target = ".config/sketchybar/items/divider.sh";
163 source = folder + /items/executable_divider.sh;167 source = folder + /items/executable_divider.sh;
164 };168 };
165 items_front_app = {169 items_front_app = {
166 executable = true;170 executable = true;
167 target = ".config/sketchybar/items/front_app.sh";171 target = ".config/sketchybar/items/front_app.sh";
168 text = ''172 text = ''
169 #!/usr/bin/env sh173 #!/usr/bin/env sh
170 FRONT_APP_SCRIPT='sketchybar --set $NAME label="$INFO"'174 FRONT_APP_SCRIPT='sketchybar --set $NAME label="$INFO"'
171 sketchybar --add event window_focus \175 sketchybar --add event window_focus \
172 --add event windows_on_spaces \176 --add event windows_on_spaces \
173 --add item system.aerospace left \177 --add item system.aerospace left \
174 --set system.aerospace script="$PLUGIN_DIR/aerospace.sh" \178 --set system.aerospace script="$PLUGIN_DIR/aerospace.sh" \
175 icon.font="$FONT:Bold:16.0" \179 icon.font="$FONT:Bold:16.0" \
176 label.drawing=off \180 label.drawing=off \
177 icon.width=30 \181 icon.width=30 \
178 icon=$YABAI_GRID \182 icon=$YABAI_GRID \
179 icon.color=$BLACK \183 icon.color=$BLACK \
180 updates=on \184 updates=on \
181 display=active \185 display=active \
182 --subscribe system.aerospace window_focus \186 --subscribe system.aerospace window_focus \
183 windows_on_spaces \187 windows_on_spaces \
184 mouse.clicked \188 mouse.clicked \
185 --add item front_app left \189 --add item front_app left \
186 --set front_app script="$FRONT_APP_SCRIPT" \190 --set front_app script="$FRONT_APP_SCRIPT" \
187 icon.drawing=off \191 icon.drawing=off \
188 background.padding_left=0 \192 background.padding_left=0 \
189 background.padding_right=10 \193 background.padding_right=10 \
190 label.color=$BLACK \194 label.color=$BLACK \
191 label.font="$FONT:Black:12.0" \195 label.font="$FONT:Black:12.0" \
192 display=active \196 display=active \
193 --subscribe front_app front_app_switched197 --subscribe front_app front_app_switched
194 '';198 '';
195 };199 };
196 items_github = {200 items_github = {
197 executable = true;201 executable = true;
198 target = ".config/sketchybar/items/github.sh";202 target = ".config/sketchybar/items/github.sh";
199 source = folder + /items/executable_github.sh;203 source = folder + /items/executable_github.sh;
200 };204 };
201 items_spaces = {205 items_spaces = {
202 executable = true;206 executable = true;
203 target = ".config/sketchybar/items/spaces.sh";207 target = ".config/sketchybar/items/spaces.sh";
204 # label.background.color=$BACKGROUND_2208 # label.background.color=$BACKGROUND_2
205 text = ''209 text = ''
206 ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_workspace_change210 ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_workspace_change
207 ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_mode_change211 ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_mode_change
208 for sid in $(${pkgs.aerospace}/bin/aerospace list-workspaces --all); do212 for sid in $(${pkgs.aerospace}/bin/aerospace list-workspaces --all); do
209 ${pkgs.sketchybar}/bin/sketchybar --add item space.$sid left \213 ${pkgs.sketchybar}/bin/sketchybar --add item space.$sid left \
210 --subscribe space.$sid aerospace_workspace_change \214 --subscribe space.$sid aerospace_workspace_change \
211 --subscribe space.$sid aerospace_mode_change \215 --subscribe space.$sid aerospace_mode_change \
212 --set space.$sid \216 --set space.$sid \
213 icon=$sid \217 icon=$sid \
214 icon.padding_left=22 \218 icon.padding_left=22 \
215 icon.padding_right=22 \219 icon.padding_right=22 \
216 icon.highlight_color=$WHITE \220 icon.highlight_color=$WHITE \
217 icon.highlight=off \221 icon.highlight=off \
218 icon.color=0xff4c566a \222 icon.color=0xff4c566a \
219 background.padding_left=-8 \223 background.padding_left=-8 \
220 background.padding_right=-8 \224 background.padding_right=-8 \
221 background.color=$BACKGROUND_1 \225 background.color=$BACKGROUND_1 \
222 background.drawing=on \226 background.drawing=on \
223 script="$PLUGIN_DIR/aerospace.sh $sid" \227 script="$PLUGIN_DIR/aerospace.sh $sid" \
224 click_script="aerospace workspace $sid" \228 click_script="aerospace workspace $sid" \
225 label.font="Iosevka Nerd Font:Regular:16.0" \229 label.font="Iosevka Nerd Font:Regular:16.0" \
226 label.padding_right=33 \230 label.padding_right=33 \
227 label.background.height=26 \231 label.background.height=26 \
228 label.background.drawing=on \232 label.background.drawing=on \
229 label.background.corner_radius=9 \233 label.background.corner_radius=9 \
230 label.drawing=off234 label.drawing=off
231 done235 done
232 ${pkgs.sketchybar}/bin/sketchybar --add item separator left \236 ${pkgs.sketchybar}/bin/sketchybar --add item separator left \
233 --set separator icon= \237 --set separator icon= \
234 icon.font="Iosevka Nerd Font:Regular:16.0" \238 icon.font="Iosevka Nerd Font:Regular:16.0" \
235 background.padding_left=26 \239 background.padding_left=26 \
236 background.padding_right=15 \240 background.padding_right=15 \
237 label.drawing=off \241 label.drawing=off \
238 display=active \242 display=active \
239 icon.color=$GREEN243 icon.color=$GREEN
240 '';244 '';
241 };245 };
242 items_spotify = {246 items_spotify = {
243 executable = true;247 executable = true;
244 target = ".config/sketchybar/items/spotify.sh";248 target = ".config/sketchybar/items/spotify.sh";
245 source = folder + /items/executable_spotify.sh;249 source = folder + /items/executable_spotify.sh;
246 };250 };
247 items_volume = {251 items_volume = {
248 executable = true;252 executable = true;
249 target = ".config/sketchybar/items/volume.sh";253 target = ".config/sketchybar/items/volume.sh";
250 text = ''254 text = ''
251 INITIAL_WIDTH=$(osascript -e 'set ovol to output volume of (get volume settings)')255 INITIAL_WIDTH=$(osascript -e 'set ovol to output volume of (get volume settings)')
252 ${pkgs.sketchybar}/bin/sketchybar --add item volume right \256 ${pkgs.sketchybar}/bin/sketchybar --add item volume right \
253 --subscribe volume volume_change \257 --subscribe volume volume_change \
254 --set volume script="$PLUGIN_DIR/volume.sh" \258 --set volume script="$PLUGIN_DIR/volume.sh" \
255 updates=on \259 updates=on \
256 icon.background.drawing=on \260 icon.background.drawing=on \
257 icon.background.color=$FLAMINGO \261 icon.background.color=$FLAMINGO \
258 icon.background.height=8 \262 icon.background.height=8 \
259 icon.background.corner_radius=3 \263 icon.background.corner_radius=3 \
260 icon.width=$INITIAL_WIDTH \264 icon.width=$INITIAL_WIDTH \
261 width=100 \265 width=100 \
262 icon.align=right \266 icon.align=right \
263 label.drawing=off \267 label.drawing=off \
264 background.drawing=on \268 background.drawing=on \
265 background.color=$BACKGROUND_2 \269 background.color=$BACKGROUND_2 \
266 background.height=8 \270 background.height=8 \
267 background.corner_radius=3 \271 background.corner_radius=3 \
268 align=left272 align=left
269273
270 ${pkgs.sketchybar}/bin/sketchybar --add alias "Control Center,Sound" right \274 ${pkgs.sketchybar}/bin/sketchybar --add alias "Control Center,Sound" right \
271 --rename "Control Center,Sound" volume_alias \275 --rename "Control Center,Sound" volume_alias \
272 --set volume_alias icon.drawing=off \276 --set volume_alias icon.drawing=off \
273 label.drawing=off \277 label.drawing=off \
274 alias.color=$BLUE2 \278 alias.color=$BLUE2 \
275 background.padding_right=0 \279 background.padding_right=0 \
276 background.padding_left=5 \280 background.padding_left=5 \
277 width=50 \281 width=50 \
278 align=right \282 align=right \
279 click_script="$PLUGIN_DIR/volume_click.sh"283 click_script="$PLUGIN_DIR/volume_click.sh"
280284
281 '';285 '';
282 };286 };
283 plugins_brew = {287 plugins_brew = {
284 executable = true;288 executable = true;
285 target = ".config/sketchybar/plugins/brew.sh";289 target = ".config/sketchybar/plugins/brew.sh";
286 source = folder + /plugins/executable_brew.sh;290 source = folder + /plugins/executable_brew.sh;
287 };291 };
288 plugins_calendar = {292 plugins_calendar = {
289 executable = true;293 executable = true;
290 target = ".config/sketchybar/plugins/calendar.sh";294 target = ".config/sketchybar/plugins/calendar.sh";
291 source = folder + /plugins/executable_calendar.sh;295 source = folder + /plugins/executable_calendar.sh;
292 };296 };
293 plugins_github = {297 plugins_github = {
294 executable = true;298 executable = true;
295 target = ".config/sketchybar/plugins/github.sh";299 target = ".config/sketchybar/plugins/github.sh";
296 source = folder + /plugins/executable_github.sh;300 source = folder + /plugins/executable_github.sh;
297 };301 };
298 plugins_icon_map = {302 plugins_icon_map = {
299 executable = true;303 executable = true;
300 target = ".config/sketchybar/plugins/icon_map.sh";304 target = ".config/sketchybar/plugins/icon_map.sh";
301 source = folder + /plugins/executable_icon_map.sh;305 source = folder + /plugins/executable_icon_map.sh;
302 };306 };
303 plugins_space = {307 plugins_space = {
304 executable = true;308 executable = true;
305 target = ".config/sketchybar/plugins/space.sh";309 target = ".config/sketchybar/plugins/space.sh";
306 source = folder + /plugins/executable_space.sh;310 source = folder + /plugins/executable_space.sh;
307 };311 };
308 plugins_spotify = {312 plugins_spotify = {
309 executable = true;313 executable = true;
310 target = ".config/sketchybar/plugins/spotify.sh";314 target = ".config/sketchybar/plugins/spotify.sh";
311 source = folder + /plugins/executable_spotify.sh;315 source = folder + /plugins/executable_spotify.sh;
312 };316 };
313 plugins_volume = {317 plugins_volume = {
314 executable = true;318 executable = true;
315 target = ".config/sketchybar/plugins/volume.sh";319 target = ".config/sketchybar/plugins/volume.sh";
316 text = ''320 text = ''
317 #!/usr/bin/env sh321 #!/usr/bin/env sh
318 WIDTH=100322 WIDTH=100
319323
320 volume_change() {324 volume_change() {
321 # INITIAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width")325 # INITIAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width")
322 # if [ "$INITIAL_WIDTH" -eq "0" ]; then326 # if [ "$INITIAL_WIDTH" -eq "0" ]; then
323 # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=$WIDTH icon.width=$INFO327 # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=$WIDTH icon.width=$INFO
324 # else328 # else
325 # ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO width=$WIDTH329 # ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO width=$WIDTH
326 # fi330 # fi
327 ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO331 ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO
328332
329333
330 # sleep 5334 # sleep 5
331 # FINAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width")335 # FINAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width")
332 # if [ "$FINAL_WIDTH" -eq "$INFO" ]; then336 # if [ "$FINAL_WIDTH" -eq "$INFO" ]; then
333 # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=0 icon.width=0337 # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=0 icon.width=0
334 # fi338 # fi
335 }339 }
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
367340
368 highlight_focused_workspace() {341 case "$SENDER" in
369 if [[ "$1" = "$FOCUSED_WORKSPACE" ]]342 "volume_change") volume_change
370 then343 ;;
371 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0344 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'
372 else355 else
373 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic356 osascript -e 'set volume output muted false'
374 fi357 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() {372 highlight_focused_workspace() {
378 if [[ "$mode" = "service" ]]373 if [[ "$1" = "$FOCUSED_WORKSPACE" ]]
379 then374 then
380 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE375 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0
381 elif [[ "$mode" = "resize" ]]376 else
382 then377 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic
383 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN378 fi
384 else379 }
385 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1380
386 fi381 illuminate_mode() {
387 }382 if [[ "$mode" = "service" ]]
388 case "$SENDER" in383 then
389 "aerospace_workspace_change")384 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE
390 highlight_focused_workspace $1385 elif [[ "$mode" = "resize" ]]
391 ;;386 then
392 "aerospace_mode_change")387 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN
393 illuminate_mode388 else
394 ;;389 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1
395 esac390 fi
396 '';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 };
397 };402 };
398 };
399}403}
modules/macos/tiling/sketchybar.nix+6-146
...@@ -1,150 +1,10 @@...@@ -1,150 +1,10 @@
1{config,pkgs, ...}: {1{
2 config,
3 pkgs,
4 ...
5}: {
2 services.sketchybar = {6 services.sketchybar = {
3 enable = config.shared.darwin.tiling.enable;7 enable = config.shared.darwin.tiling.enable;
4 config = ''8 package = pkgs.sketchybar;
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 '';
149 };9 };
150}10}
users/natalie/configuration.nix+8-2
...@@ -1,5 +1,10 @@...@@ -1,5 +1,10 @@
1# Applied to all systems1# Applied to all systems
2{pkgs, ...}: {2{
3 inputs,
4 pkgs,
5 host,
6 ...
7}: {
3 services.tailscale.enable = true;8 services.tailscale.enable = true;
4 fonts.packages = with pkgs; [9 fonts.packages = with pkgs; [
5 nerd-fonts.fira-code10 nerd-fonts.fira-code
...@@ -7,11 +12,12 @@...@@ -7,11 +12,12 @@
7 iosevka12 iosevka
8 nerd-fonts.symbols-only13 nerd-fonts.symbols-only
9 nerd-fonts.iosevka14 nerd-fonts.iosevka
15 inputs.apple-fonts.packages.${pkgs.system}.sf-pro
10 ];16 ];
1117
12 # configuration for shared modules.18 # configuration for shared modules.
13 # all custom options in 'shared' for clarity.19 # all custom options in 'shared' for clarity.
14 shared.darwin = {20 shared.darwin = {
15 tiling.enable = true; # use tiling window manager21 tiling.enable = host.darwin; # use tiling window manager
16 };22 };
17}23}
users/natalie/home.nix+1
...@@ -9,6 +9,7 @@...@@ -9,6 +9,7 @@
9 bat.enable = true;9 bat.enable = true;
10 hyfetch.enable = true;10 hyfetch.enable = true;
11 direnv.enable = true;11 direnv.enable = true;
12 fish.enable = true;
12 # sort-lines:end13 # sort-lines:end
13 };14 };
1415