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

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