authorgravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-05-01 23:42:32-07:00
committergravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-05-01 23:42:32-07:00
log403c03dfb16a01ad835edd8135afc7918d263dd2
tree2cda395c7a87336524f83950ed20c60adfc88a07
parent0959c9c2c3ad26a9819c10f888bc48f9039060a3
signature Commit is signed but in an unrecognized format.

add sketchybar file and do more modularity stuff


6 files changed, 176 insertions(+), 7 deletions(-)

flake.nix+3
...@@ -79,6 +79,9 @@...@@ -79,6 +79,9 @@
7979
80 # ----- USER SETTINGS ----- #80 # ----- USER SETTINGS ----- #
81 userSettings = rec {81 userSettings = rec {
82 #enable if you want to use a tiling wm on macos
83 darwinTiling = true;
84
82 username = "nmarks"; # username85 username = "nmarks"; # username
83 name = "Natalie"; # name/identifier86 name = "Natalie"; # name/identifier
84 email = "nmarks413@gmail.com"; # email (used for certain configurations)87 email = "nmarks413@gmail.com"; # email (used for certain configurations)
hosts/laptop/configuration.nix+5-1
...@@ -1,4 +1,8 @@...@@ -1,4 +1,8 @@
1{pkgs, ...}: {1{
2 pkgs,
3 userSettings,
4 ...
5}: {
2 imports = [6 imports = [
3 ../../modules/macos7 ../../modules/macos
4 ];8 ];
lib/mkSystem.nix+5
...@@ -53,6 +53,11 @@ in...@@ -53,6 +53,11 @@ in
53 systemFunc rec {53 systemFunc rec {
54 inherit system;54 inherit system;
5555
56 #gross and ugly hack do NOT like
57 specialArgs = {
58 inherit (userSettings) darwinTiling;
59 };
60
56 modules =61 modules =
57 [62 [
58 # Apply our overlays. Overlays are keyed by system type so we have63 # Apply our overlays. Overlays are keyed by system type so we have
modules/macos/default.nix+12-6
...@@ -1,7 +1,13 @@...@@ -1,7 +1,13 @@
1{pkgs, ...}: {1{
2 imports = [2 pkgs,
3 ./homebrew.nix3 lib,
4 ./system.nix4 darwinTiling,
5 # ./tiling5 ...
6 ];6}: {
7 imports =
8 [
9 ./homebrew.nix
10 ./system.nix
11 ]
12 ++ lib.optionals darwinTiling [./tiling];
7}13}
modules/macos/tiling/default.nix+1
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1{pkgs, ...}: {1{pkgs, ...}: {
2 imports = [2 imports = [
3 ./aerospace.nix3 ./aerospace.nix
4 ./sketchybar.nix
4 ];5 ];
5}6}
modules/macos/tiling/sketchybar.nix created+150
...@@ -0,0 +1,150 @@
1{pkgs, ...}: {
2 services.sketchybar = {
3 enable = true;
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 '';
149 };
150}