users/ryan/modules/sketchybar/bar-config/sketchybarrc

6c2bdcffebb4a0851d0f0288aa8cbe9c443b6860 · 6.9 KB · 172 lines raw

1 #!/usr/bin/env bash
2 # ============================================================================
3 # sketchybarrc — translated from a Hyprland/Waybar config
4 # Layout, fonts and colours mirror the original Waybar config + style.css.
5 # ============================================================================
6 CONFIG_DIR="$HOME/.config/sketchybar"
7 PLUGIN_DIR="$CONFIG_DIR/plugins"
8 source "$CONFIG_DIR/colors.sh"
9 source "$CONFIG_DIR/icons.sh"
10
11 env
12
13 FONT="AnonymicePro Nerd Font"
14
15 # ---- bar --------------------------------------------------------------------
16 # From #waybar { background: rgba(0,0,0,0.25) } and Waybar height:30, position:top
17 sketchybar --bar \
18 height=32 \
19 position=top \
20 color=$BAR_COLOR \
21 padding_left=8 \
22 padding_right=8 \
23 corner_radius=0 \
24 border_width=0 \
25 shadow=off
26
27 # ---- defaults ---------------------------------------------------------------
28 # From * { color:white; font: AnonymicePro Nerd Font 15px; no radius/shadow }
29 sketchybar --default \
30 updates=when_shown \
31 icon.font="$FONT:Regular:15.0" \
32 icon.color=$TEXT \
33 icon.padding_left=4 \
34 icon.padding_right=4 \
35 label.font="$FONT:Regular:15.0" \
36 label.color=$TEXT \
37 label.padding_left=4 \
38 label.padding_right=4 \
39 background.corner_radius=0 \
40 background.height=32
41
42 # ---- popup helper -----------------------------------------------------------
43 # add_popup <item>: attaches a hover "tooltip" popup + a <item>.details child
44 # (styled with POPUP_BG from window#waybar.solo) and subscribes to hover events.
45 add_popup() {
46 sketchybar --set "$1" \
47 popup.background.color=$POPUP_BG \
48 popup.background.corner_radius=0 \
49 popup.background.border_width=0 \
50 popup.horizontal=off \
51 popup.y_offset=-1 \
52 --subscribe "$1" mouse.entered mouse.exited
53 sketchybar --add item "$1.details" "popup.$1" \
54 --set "$1.details" icon.drawing=off \
55 label.font="$FONT:Regular:13.0" \
56 label.padding_left=12 label.padding_right=12 \
57 background.height=24
58 }
59
60 # ============================================================================
61 # LEFT — hyprland/workspaces -> yabai spaces
62 # (hyprland/submap has no yabai/macOS analog -> omitted)
63 # ============================================================================
64 for sid in 1 2 3 4 5 6 7 8 9 10; do
65 sketchybar --add space space.$sid left \
66 --set space.$sid \
67 space=$sid \
68 icon=$sid \
69 icon.color=$TEXT_DIM \
70 icon.highlight_color=$TEXT \
71 label.drawing=off \
72 background.drawing=off \
73 padding_left=5 padding_right=5 \
74 script="$PLUGIN_DIR/space.sh" \
75 click_script="yabai -m space --focus $sid 2>/dev/null"
76 done
77
78 # ============================================================================
79 # CENTER — hyprland/window -> front_app
80 # ============================================================================
81 sketchybar --add item front_app center \
82 --set front_app \
83 icon.drawing=off \
84 label.max_chars=80 \
85 label.padding_left=10 label.padding_right=10 \
86 script="$PLUGIN_DIR/front_app.sh" \
87 --subscribe front_app front_app_switched
88
89 # ============================================================================
90 # RIGHT — added right-to-left so the visual order matches Waybar's list:
91 # spotify weather mail storage brightness bluetooth volume network
92 # caffeinate battery clock
93 # ============================================================================
94
95 # clock (rightmost) — Waybar {:%a %d %b %H:%M}
96 sketchybar --add item clock right \
97 --set clock update_freq=1 icon.drawing=off \
98 label.padding_left=10 label.padding_right=16 \
99 script="$PLUGIN_DIR/clock.sh"
100
101 # battery (BAT0). Waybar battery#num2 (BAT1) omitted — Macs have one battery.
102 sketchybar --add item battery right \
103 --set battery update_freq=60 icon.drawing=off \
104 script="$PLUGIN_DIR/battery.sh" \
105 --subscribe battery power_source_change system_woke
106 add_popup battery
107
108 # idle_inhibitor -> caffeinate
109 sketchybar --add item caffeinate right \
110 --set caffeinate update_freq=15 \
111 script="$PLUGIN_DIR/caffeinate.sh" \
112 click_script="$PLUGIN_DIR/caffeinate.sh toggle"
113
114 # network
115 sketchybar --add item network right \
116 --set network update_freq=5 icon.drawing=off \
117 click_script="open -a 'System Settings' 2>/dev/null" \
118 script="$PLUGIN_DIR/network.sh"
119 add_popup network
120
121 # pulseaudio -> volume (native volume_change event)
122 sketchybar --add item volume right \
123 --set volume icon.drawing=off script="$PLUGIN_DIR/volume.sh" \
124 --subscribe volume volume_change mouse.scrolled
125
126 # bluetooth (needs blueutil)
127 sketchybar --add item bluetooth right \
128 --set bluetooth update_freq=30 icon.drawing=off \
129 click_script="$PLUGIN_DIR/bluetooth.sh toggle" \
130 script="$PLUGIN_DIR/bluetooth.sh"
131 add_popup bluetooth
132
133 # backlight -> brightness (needs the `brightness` CLI; hides itself if absent)
134 sketchybar --add item brightness right \
135 --set brightness update_freq=10 icon.drawing=off \
136 script="$PLUGIN_DIR/brightness.sh" \
137 --subscribe brightness mouse.scrolled
138
139 # custom/storage
140 sketchybar --add item storage right \
141 --set storage update_freq=60 icon.drawing=off \
142 script="$PLUGIN_DIR/storage.sh"
143 add_popup storage
144
145 # custom/mail (Mail.app unread)
146 # sketchybar --add item mail right \
147 # --set mail update_freq=60 icon.drawing=off \
148 # click_script="open -a Mail" \
149 # script="$PLUGIN_DIR/mail.sh"
150
151 # custom/weather (wttr.in j2 -> condition icon + temp, hover popup as a "tooltip")
152 sketchybar --add item weather right \
153 --set weather update_freq=1800 icon.drawing=off \
154 click_script="open https://wttr.in" \
155 script="$PLUGIN_DIR/weather.sh"
156 add_popup weather
157
158 # custom/spotify (now playing via native media_change)
159 # sketchybar --add item spotify right \
160 # --set spotify icon=$SPOTIFY icon.color=$TEXT drawing=off \
161 # label.max_chars=30 scroll_texts=on \
162 # click_script="$PLUGIN_DIR/spotify.sh toggle" \
163 # script="$PLUGIN_DIR/spotify.sh" \
164 # --subscribe spotify media_change
165
166 # ----------------------------------------------------------------------------
167 # Omitted (no SketchyBar / macOS analog):
168 # tray -> the macOS menu bar already renders status/menu-extra items
169 # privacy -> macOS shows camera/mic indicators natively in the menu bar
170 # ----------------------------------------------------------------------------
171
172 sketchybar --update