authorgravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-05-19 17:17:16-07:00
committergravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-05-19 17:17:16-07:00
log1a6ac2017dfea76e017edf8e4a32bafc077eae6d
tree85570b9871f1eadd8df554227b00443e5fd9fb59
parent844318f221d3e818a24ce4607d660088ae3720d1
signature Commit is signed but in an unrecognized format.

update sketchybar


23 files changed, 484 insertions(+), 1576 deletions(-)

files/sketchybar/helper/cpu.h deleted-120
......@@ -1,120 +0,0 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <unistd.h>
4#include <mach/mach.h>
5#include <stdbool.h>
6#include <time.h>
7
8static const char TOPPROC[32] = { "/bin/ps -Aceo pid,pcpu,comm -r" };
9static const char FILTER_PATTERN[16] = { "com.apple." };
10
11struct cpu {
12 host_t host;
13 mach_msg_type_number_t count;
14 host_cpu_load_info_data_t load;
15 host_cpu_load_info_data_t prev_load;
16 bool has_prev_load;
17
18 char command[256];
19};
20
21static inline void cpu_init(struct cpu* cpu) {
22 cpu->host = mach_host_self();
23 cpu->count = HOST_CPU_LOAD_INFO_COUNT;
24 cpu->has_prev_load = false;
25 snprintf(cpu->command, 100, "");
26}
27
28static inline void cpu_update(struct cpu* cpu) {
29 kern_return_t error = host_statistics(cpu->host,
30 HOST_CPU_LOAD_INFO,
31 (host_info_t)&cpu->load,
32 &cpu->count );
33
34 if (error != KERN_SUCCESS) {
35 printf("Error: Could not read cpu host statistics.\n");
36 return;
37 }
38
39 if (cpu->has_prev_load) {
40 uint32_t delta_user = cpu->load.cpu_ticks[CPU_STATE_USER]
41 - cpu->prev_load.cpu_ticks[CPU_STATE_USER];
42
43 uint32_t delta_system = cpu->load.cpu_ticks[CPU_STATE_SYSTEM]
44 - cpu->prev_load.cpu_ticks[CPU_STATE_SYSTEM];
45
46 uint32_t delta_idle = cpu->load.cpu_ticks[CPU_STATE_IDLE]
47 - cpu->prev_load.cpu_ticks[CPU_STATE_IDLE];
48
49 double user_perc = (double)delta_user / (double)(delta_system
50 + delta_user
51 + delta_idle);
52
53 double sys_perc = (double)delta_system / (double)(delta_system
54 + delta_user
55 + delta_idle);
56
57 double total_perc = user_perc + sys_perc;
58
59 FILE* file;
60 char line[1024];
61
62 file = popen(TOPPROC, "r");
63 if (!file) {
64 printf("Error: TOPPROC command errored out...\n" );
65 return;
66 }
67
68 fgets(line, sizeof(line), file);
69 fgets(line, sizeof(line), file);
70
71 char* start = strstr(line, FILTER_PATTERN);
72 char topproc[32];
73 uint32_t caret = 0;
74 for (int i = 0; i < sizeof(line); i++) {
75 if (start && i == start - line) {
76 i+=9;
77 continue;
78 }
79
80 if (caret >= 28 && caret <= 30) {
81 topproc[caret++] = '.';
82 continue;
83 }
84 if (caret > 30) break;
85 topproc[caret++] = line[i];
86 if (line[i] == '\0') break;
87 }
88
89 topproc[31] = '\0';
90
91 pclose(file);
92
93 char color[16];
94 if (total_perc >= .7) {
95 snprintf(color, 16, "%s", getenv("RED"));
96 } else if (total_perc >= .3) {
97 snprintf(color, 16, "%s", getenv("ORANGE"));
98 } else if (total_perc >= .1) {
99 snprintf(color, 16, "%s", getenv("YELLOW"));
100 } else {
101 snprintf(color, 16, "%s", getenv("LABEL_COLOR"));
102 }
103
104 snprintf(cpu->command, 256, "--push cpu.sys %.2f "
105 "--push cpu.user %.2f "
106 "--set cpu.percent label=%.0f%% label.color=%s "
107 "--set cpu.top label=\"%s\"",
108 sys_perc,
109 user_perc,
110 total_perc*100.,
111 color,
112 topproc );
113 }
114 else {
115 snprintf(cpu->command, 256, "");
116 }
117
118 cpu->prev_load = cpu->load;
119 cpu->has_prev_load = true;
120}
files/sketchybar/helper/executable_helper deleted
Binary files a/files/sketchybar/helper/executable_helper and /dev/null differ
files/sketchybar/helper/helper.c deleted-32
......@@ -1,32 +0,0 @@
1#include "cpu.h"
2#include "sketchybar.h"
3
4struct cpu g_cpu;
5
6void handler(env env) {
7 // Environment variables passed from sketchybar can be accessed as seen below
8 char* name = env_get_value_for_key(env, "NAME");
9 char* sender = env_get_value_for_key(env, "SENDER");
10 char* info = env_get_value_for_key(env, "INFO");
11 char* selected = env_get_value_for_key(env, "SELECTED");
12
13 if ((strcmp(sender, "routine") == 0)
14 || (strcmp(sender, "forced") == 0)) {
15 // CPU graph updates
16 cpu_update(&g_cpu);
17
18 if (strlen(g_cpu.command) > 0) sketchybar(g_cpu.command);
19 }
20}
21
22int main (int argc, char** argv) {
23 cpu_init(&g_cpu);
24
25 if (argc < 2) {
26 printf("Usage: provider \"<bootstrap name>\"\n");
27 exit(1);
28 }
29
30 event_server_begin(handler, argv[1]);
31 return 0;
32}
files/sketchybar/helper/makefile deleted-3
......@@ -1,3 +0,0 @@
1
2helper: helper.c cpu.h sketchybar.h
3 clang -std=c99 -O3 helper.c -o helper
files/sketchybar/helper/sketchybar.h deleted-227
......@@ -1,227 +0,0 @@
1#pragma once
2
3#include <mach/mach.h>
4#include <mach/message.h>
5#include <bootstrap.h>
6#include <stdlib.h>
7#include <pthread.h>
8#include <stdio.h>
9
10typedef char* env;
11
12#define MACH_HANDLER(name) void name(env env)
13typedef MACH_HANDLER(mach_handler);
14
15struct mach_message {
16 mach_msg_header_t header;
17 mach_msg_size_t msgh_descriptor_count;
18 mach_msg_ool_descriptor_t descriptor;
19};
20
21struct mach_buffer {
22 struct mach_message message;
23 mach_msg_trailer_t trailer;
24};
25
26struct mach_server {
27 bool is_running;
28 mach_port_name_t task;
29 mach_port_t port;
30 mach_port_t bs_port;
31
32 pthread_t thread;
33 mach_handler* handler;
34};
35
36static struct mach_server g_mach_server;
37static mach_port_t g_mach_port = 0;
38
39static inline char* env_get_value_for_key(env env, char* key) {
40 uint32_t caret = 0;
41 for(;;) {
42 if (!env[caret]) break;
43 if (strcmp(&env[caret], key) == 0)
44 return &env[caret + strlen(&env[caret]) + 1];
45
46 caret += strlen(&env[caret])
47 + strlen(&env[caret + strlen(&env[caret]) + 1])
48 + 2;
49 }
50 return (char*)"";
51}
52
53static inline mach_port_t mach_get_bs_port() {
54 mach_port_name_t task = mach_task_self();
55
56 mach_port_t bs_port;
57 if (task_get_special_port(task,
58 TASK_BOOTSTRAP_PORT,
59 &bs_port ) != KERN_SUCCESS) {
60 return 0;
61 }
62
63 mach_port_t port;
64 if (bootstrap_look_up(bs_port,
65 "git.felix.sketchybar",
66 &port ) != KERN_SUCCESS) {
67 return 0;
68 }
69
70 return port;
71}
72
73static inline void mach_receive_message(mach_port_t port, struct mach_buffer* buffer, bool timeout) {
74 *buffer = (struct mach_buffer) { 0 };
75 mach_msg_return_t msg_return;
76 if (timeout)
77 msg_return = mach_msg(&buffer->message.header,
78 MACH_RCV_MSG | MACH_RCV_TIMEOUT,
79 0,
80 sizeof(struct mach_buffer),
81 port,
82 100,
83 MACH_PORT_NULL );
84 else
85 msg_return = mach_msg(&buffer->message.header,
86 MACH_RCV_MSG,
87 0,
88 sizeof(struct mach_buffer),
89 port,
90 MACH_MSG_TIMEOUT_NONE,
91 MACH_PORT_NULL );
92
93 if (msg_return != MACH_MSG_SUCCESS) {
94 buffer->message.descriptor.address = NULL;
95 }
96}
97
98static inline char* mach_send_message(mach_port_t port, char* message, uint32_t len) {
99 if (!message || !port) {
100 return NULL;
101 }
102
103 mach_port_t response_port;
104 mach_port_name_t task = mach_task_self();
105 if (mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE,
106 &response_port ) != KERN_SUCCESS) {
107 return NULL;
108 }
109
110 if (mach_port_insert_right(task, response_port,
111 response_port,
112 MACH_MSG_TYPE_MAKE_SEND)!= KERN_SUCCESS) {
113 return NULL;
114 }
115
116 struct mach_message msg = { 0 };
117 msg.header.msgh_remote_port = port;
118 msg.header.msgh_local_port = response_port;
119 msg.header.msgh_id = response_port;
120 msg.header.msgh_bits = MACH_MSGH_BITS_SET(MACH_MSG_TYPE_COPY_SEND,
121 MACH_MSG_TYPE_MAKE_SEND,
122 0,
123 MACH_MSGH_BITS_COMPLEX );
124
125 msg.header.msgh_size = sizeof(struct mach_message);
126 msg.msgh_descriptor_count = 1;
127 msg.descriptor.address = message;
128 msg.descriptor.size = len * sizeof(char);
129 msg.descriptor.copy = MACH_MSG_VIRTUAL_COPY;
130 msg.descriptor.deallocate = false;
131 msg.descriptor.type = MACH_MSG_OOL_DESCRIPTOR;
132
133 mach_msg(&msg.header,
134 MACH_SEND_MSG,
135 sizeof(struct mach_message),
136 0,
137 MACH_PORT_NULL,
138 MACH_MSG_TIMEOUT_NONE,
139 MACH_PORT_NULL );
140
141 struct mach_buffer buffer = { 0 };
142 mach_receive_message(response_port, &buffer, true);
143 if (buffer.message.descriptor.address)
144 return (char*)buffer.message.descriptor.address;
145 mach_msg_destroy(&buffer.message.header);
146
147 return NULL;
148}
149
150#pragma clang diagnostic push
151#pragma clang diagnostic ignored "-Wdeprecated-declarations"
152static inline bool mach_server_begin(struct mach_server* mach_server, mach_handler handler, char* bootstrap_name) {
153 mach_server->task = mach_task_self();
154
155 if (mach_port_allocate(mach_server->task,
156 MACH_PORT_RIGHT_RECEIVE,
157 &mach_server->port ) != KERN_SUCCESS) {
158 return false;
159 }
160
161 if (mach_port_insert_right(mach_server->task,
162 mach_server->port,
163 mach_server->port,
164 MACH_MSG_TYPE_MAKE_SEND) != KERN_SUCCESS) {
165 return false;
166 }
167
168 if (task_get_special_port(mach_server->task,
169 TASK_BOOTSTRAP_PORT,
170 &mach_server->bs_port) != KERN_SUCCESS) {
171 return false;
172 }
173
174 if (bootstrap_register(mach_server->bs_port,
175 bootstrap_name,
176 mach_server->port ) != KERN_SUCCESS) {
177 return false;
178 }
179
180 mach_server->handler = handler;
181 mach_server->is_running = true;
182 while (mach_server->is_running) {
183 struct mach_buffer* buffer = (struct mach_buffer*)malloc(sizeof(struct mach_buffer));
184 mach_receive_message(mach_server->port, buffer, false);
185 mach_server->handler((env)buffer->message.descriptor.address);
186 mach_msg_destroy(&buffer->message.header);
187 }
188
189 return true;
190}
191#pragma clang diagnostic pop
192
193static inline char* sketchybar(char* message) {
194 uint32_t message_length = strlen(message) + 1;
195 char formatted_message[message_length + 1];
196
197 char quote = '\0';
198 uint32_t caret = 0;
199 for (int i = 0; i < message_length; ++i) {
200 if (message[i] == '"' || message[i] == '\'') {
201 if (quote == message[i]) quote = '\0';
202 else quote = message[i];
203 continue;
204 }
205 formatted_message[caret] = message[i];
206 if (message[i] == ' ' && !quote) formatted_message[caret] = '\0';
207 caret++;
208 }
209
210 if (caret > 0 && formatted_message[caret] == '\0'
211 && formatted_message[caret - 1] == '\0') {
212 caret--;
213 }
214
215 formatted_message[caret] = '\0';
216 if (!g_mach_port) g_mach_port = mach_get_bs_port();
217 char* response = mach_send_message(g_mach_port,
218 formatted_message,
219 caret + 1 );
220
221 if (response) return response;
222 else return (char*)"";
223}
224
225static inline void event_server_begin(mach_handler event_handler, char* bootstrap_name) {
226 mach_server_begin(&g_mach_server, event_handler, bootstrap_name);
227}
files/sketchybar/icons.sh deleted-31
......@@ -1,31 +0,0 @@
1#!/usr/bin/env sh
2
3# General Icons
4LOADING=􀖇
5APPLE=􀣺
6PREFERENCES=􀺽
7ACTIVITY=􀒓
8LOCK=􀒳
9BELL=􀋚
10BELL_DOT=􀝗
11
12# Git Icons
13GIT_ISSUE=􀍷
14GIT_DISCUSSION=􀒤
15GIT_PULL_REQUEST=􀙡
16GIT_COMMIT=􀡚
17GIT_INDICATOR=􀂓
18
19# Spotify Icons
20SPOTIFY_BACK=􀊎
21SPOTIFY_PLAY_PAUSE=􀊈
22SPOTIFY_NEXT=􀊐
23SPOTIFY_SHUFFLE=􀊝
24SPOTIFY_REPEAT=􀊞
25
26# Yabai Icons
27YABAI_STACK=􀏭
28YABAI_FULLSCREEN_ZOOM=􀏜
29YABAI_PARENT_ZOOM=􀥃
30YABAI_FLOAT=􀢌
31YABAI_GRID=􀧍
files/sketchybar/items/executable_apple.sh deleted-31
......@@ -1,31 +0,0 @@
1#!/usr/bin/env sh
2
3POPUP_OFF="sketchybar --set apple.logo popup.drawing=off"
4POPUP_CLICK_SCRIPT="sketchybar --set \$NAME popup.drawing=toggle"
5
6sketchybar --add item apple.logo left \
7 \
8 --set apple.logo icon=$APPLE \
9 icon.font="$FONT:Black:16.0" \
10 icon.color=$BLUE2 \
11 background.padding_right=25 \
12 label.drawing=off \
13 click_script="$POPUP_CLICK_SCRIPT" \
14 \
15 --add item apple.prefs popup.apple.logo \
16 --set apple.prefs icon=$PREFERENCES \
17 label="Preferences" \
18 click_script="open -a 'System Preferences';
19 $POPUP_OFF" \
20 \
21 --add item apple.activity popup.apple.logo \
22 --set apple.activity icon=$ACTIVITY \
23 label="Activity" \
24 click_script="open -a 'Activity Monitor';
25 $POPUP_OFF"\
26 \
27 --add item apple.lock popup.apple.logo \
28 --set apple.lock icon=$LOCK \
29 label="Lock Screen" \
30 click_script="pmset displaysleepnow;
31 $POPUP_OFF"
files/sketchybar/items/executable_brew.sh deleted-14
......@@ -1,14 +0,0 @@
1#!/usr/bin/env sh
2
3# Trigger the brew_udpate event when brew update or upgrade is run from cmdline
4# e.g. via function in .zshrc
5
6sketchybar --add event brew_update \
7 --add item brew right \
8 --set brew script="$PLUGIN_DIR/brew.sh" \
9 icon=󰏗 \
10 label=? \
11 label.color=$BLACK \
12 background.padding_right=15 \
13 --subscribe brew brew_update
14
files/sketchybar/items/executable_cpu.sh deleted-37
......@@ -1,37 +0,0 @@
1#!/usr/bin/env sh
2
3sketchybar --add item cpu.top right \
4 --set cpu.top label.font="$FONT:Semibold:7" \
5 label=CPU \
6 icon.drawing=off \
7 width=0 \
8 y_offset=6 \
9 \
10 --add item cpu.percent right \
11 --set cpu.percent label.font="$FONT:Heavy:12" \
12 label=CPU \
13 y_offset=-4 \
14 width=40 \
15 icon.drawing=off \
16 update_freq=2 \
17 mach_helper="$HELPER" \
18 \
19 --add graph cpu.sys right 100 \
20 --set cpu.sys width=0 \
21 graph.color=$RED \
22 graph.fill_color=$RED \
23 label.drawing=off \
24 icon.drawing=off \
25 background.padding_left=10 \
26 background.height=30 \
27 background.drawing=on \
28 background.color=$TRANSPARENT \
29 \
30 --add graph cpu.user right 100 \
31 --set cpu.user graph.color=$BLUE \
32 label.drawing=off \
33 icon.drawing=off \
34 background.padding_left=10 \
35 background.height=30 \
36 background.drawing=on \
37 background.color=$TRANSPARENT
files/sketchybar/items/executable_divider.sh deleted-9
......@@ -1,9 +0,0 @@
1sketchybar --add bracket status brew volume volume_alias \
2 --set status background.color=$WHITE
3
4# sketchybar --add item divider right \
5# --set divider label.drawing=off \
6# icon=􀫰 \
7# icon.font="$FONT:Black:22.0" \
8# background.padding_left=15 \
9# background.padding_right=20
files/sketchybar/items/executable_github.sh deleted-27
......@@ -1,27 +0,0 @@
1#!/usr/bin/env sh
2
3POPUP_CLICK_SCRIPT="sketchybar --set \$NAME popup.drawing=toggle"
4
5sketchybar --add item github.bell right \
6 --set github.bell update_freq=180 \
7 icon.font="$FONT:Bold:15.0" \
8 icon=$BELL \
9 icon.color=$BLUE \
10 label=$LOADING \
11 label.highlight_color=$BLUE \
12 popup.align=right \
13 script="$PLUGIN_DIR/github.sh" \
14 click_script="$POPUP_CLICK_SCRIPT" \
15 --subscribe github.bell mouse.entered \
16 mouse.exited \
17 mouse.exited.global \
18 \
19 --add item github.template popup.github.bell \
20 --set github.template drawing=off \
21 background.corner_radius=12 \
22 background.padding_left=7 \
23 background.padding_right=7 \
24 background.color=$BLACK \
25 background.drawing=off \
26 icon.background.height=2 \
27 icon.background.y_offset=-12
files/sketchybar/items/executable_spotify.sh deleted-125
......@@ -1,125 +0,0 @@
1SPOTIFY_EVENT="com.spotify.client.PlaybackStateChanged"
2POPUP_SCRIPT="sketchybar -m --set spotify.anchor popup.drawing=toggle"
3
4sketchybar --add event spotify_change $SPOTIFY_EVENT \
5 --add item spotify.anchor center \
6 --set spotify.anchor script="$PLUGIN_DIR/spotify.sh" \
7 click_script="$POPUP_SCRIPT" \
8 background.padding_left=22 \
9 popup.horizontal=on \
10 popup.align=center \
11 popup.height=120 \
12 icon=􁁒 \
13 icon.font="$FONT:Regular:25.0" \
14 icon.drawing=off \
15 label.drawing=off \
16 drawing=off \
17 --subscribe spotify.anchor mouse.entered mouse.exited \
18 mouse.exited.global \
19 \
20 --add item spotify.cover popup.spotify.anchor \
21 --set spotify.cover script="$PLUGIN_DIR/spotify.sh" \
22 label.drawing=off \
23 icon.drawing=off \
24 background.padding_left=12 \
25 background.padding_right=10 \
26 background.image.scale=0.15 \
27 background.image.drawing=on \
28 background.drawing=on \
29 \
30 --add item spotify.title popup.spotify.anchor \
31 --set spotify.title icon.drawing=off \
32 background.padding_left=0 \
33 background.padding_right=0 \
34 width=0 \
35 label.font="$FONT:Heavy:14.0" \
36 y_offset=40 \
37 \
38 --add item spotify.artist popup.spotify.anchor \
39 --set spotify.artist icon.drawing=off \
40 y_offset=20 \
41 background.padding_left=0 \
42 background.padding_right=0 \
43 width=0 \
44 \
45 --add item spotify.album popup.spotify.anchor \
46 --set spotify.album icon.drawing=off \
47 background.padding_left=0 \
48 background.padding_right=0 \
49 y_offset=3 \
50 width=0 \
51 \
52 --add item spotify.shuffle popup.spotify.anchor \
53 --set spotify.shuffle icon=􀊝 \
54 icon.padding_left=5 \
55 icon.padding_right=5 \
56 icon.color=$BLACK \
57 icon.highlight_color=$MAGENTA \
58 label.drawing=off \
59 script="$PLUGIN_DIR/spotify.sh" \
60 y_offset=-30 \
61 --subscribe spotify.shuffle mouse.clicked \
62 \
63 --add item spotify.back popup.spotify.anchor \
64 --set spotify.back icon=􀊎 \
65 icon.padding_left=5 \
66 icon.padding_right=5 \
67 icon.color=$BLACK \
68 script="$PLUGIN_DIR/spotify.sh" \
69 label.drawing=off \
70 y_offset=-30 \
71 --subscribe spotify.back mouse.clicked \
72 \
73 --add item spotify.play popup.spotify.anchor \
74 --set spotify.play icon=􀊔 \
75 background.height=40 \
76 background.corner_radius=20 \
77 width=40 \
78 align=center \
79 background.color=$BLACK \
80 background.border_color=$WHITE \
81 background.border_width=0 \
82 background.drawing=on \
83 icon.padding_left=4 \
84 icon.padding_right=5 \
85 icon.color=$WHITE \
86 updates=on \
87 label.drawing=off \
88 script="$PLUGIN_DIR/spotify.sh" \
89 y_offset=-30 \
90 --subscribe spotify.play mouse.clicked spotify_change \
91 \
92 --add item spotify.next popup.spotify.anchor \
93 --set spotify.next icon=􀊐 \
94 icon.padding_left=5 \
95 icon.padding_right=10 \
96 icon.color=$BLACK \
97 label.drawing=off \
98 script="$PLUGIN_DIR/spotify.sh" \
99 y_offset=-30 \
100 --subscribe spotify.next mouse.clicked \
101 \
102 --add item spotify.repeat popup.spotify.anchor \
103 --set spotify.repeat icon=􀊞 \
104 icon.highlight_color=$MAGENTA \
105 icon.padding_left=5 \
106 icon.padding_right=10 \
107 icon.color=$BLACK \
108 label.drawing=off \
109 script="$PLUGIN_DIR/spotify.sh" \
110 y_offset=-30 \
111 --subscribe spotify.repeat mouse.clicked \
112 \
113 --add item spotify.spacer popup.spotify.anchor \
114 --set spotify.spacer width=5 \
115 \
116 --add bracket spotify spotify.shuffle \
117 spotify.back \
118 spotify.play \
119 spotify.next \
120 spotify.repeat \
121 --set spotify background.color=$GREEN \
122 background.corner_radius=11 \
123 background.drawing=on \
124 y_offset=-30 \
125 drawing=off
files/sketchybar/plugins/executable_brew.sh deleted-21
......@@ -1,21 +0,0 @@
1#!/usr/bin/env sh
2
3source "$HOME/.config/sketchybar/colors.sh"
4
5COUNT=$(brew outdated | wc -l | tr -d ' ')
6
7COLOR=$RED
8
9case "$COUNT" in
10 [3-5][0-9]) COLOR=$ORANGE
11 ;;
12 [1-2][0-9]) COLOR=$YELLOW
13 ;;
14 [1-9]) COLOR=$BLACK
15 ;;
16 0) COLOR=$GREEN
17 COUNT=􀆅
18 ;;
19esac
20
21sketchybar --set $NAME label=$COUNT icon.color=$COLOR
files/sketchybar/plugins/executable_calendar.sh deleted-3
......@@ -1,3 +0,0 @@
1#!/usr/bin/env sh
2
3sketchybar --set $NAME icon="$(date '+%a %d. %b')" label="$(date '+%H:%M')"
files/sketchybar/plugins/executable_github.sh deleted-87
......@@ -1,87 +0,0 @@
1#!/bin/sh
2
3update() {
4 source "$HOME/.config/sketchybar/colors.sh"
5 source "$HOME/.config/sketchybar/icons.sh"
6
7 NOTIFICATIONS="$(gh api notifications)"
8 COUNT="$(echo "$NOTIFICATIONS" | jq 'length')"
9 args=()
10 if [ "$NOTIFICATIONS" = "[]" ]; then
11 args+=(--set $NAME icon=$BELL label="0")
12 else
13 args+=(--set $NAME icon=$BELL_DOT label="$COUNT")
14 fi
15
16 PREV_COUNT=$(sketchybar --query github.bell | jq -r .label.value)
17 # For sound to play around with:
18 # afplay /System/Library/Sounds/Morse.aiff
19
20 args+=(--remove '/github.notification\.*/')
21
22 COUNTER=0
23 COLOR=$BLUE
24 args+=(--set github.bell icon.color=$COLOR)
25
26 while read -r repo url type title
27 do
28 COUNTER=$((COUNTER + 1))
29 IMPORTANT="$(echo "$title" | egrep -i "(deprecat|break|broke)")"
30 COLOR=$BLUE
31 PADDING=0
32
33 if [ "${repo}" = "" ] && [ "${title}" = "" ]; then
34 repo="Note"
35 title="No new notifications"
36 fi
37 case "${type}" in
38 "'Issue'") COLOR=$GREEN; ICON=$GIT_ISSUE; URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)"
39 ;;
40 "'Discussion'") COLOR=$WHITE; ICON=$GIT_DISCUSSION; URL="https://www.github.com/notifications"
41 ;;
42 "'PullRequest'") COLOR=$MAGENTA; ICON=$GIT_PULL_REQUEST; URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)"
43 ;;
44 "'Commit'") COLOR=$WHITE; ICON=$GIT_COMMIT; URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)"
45 ;;
46 esac
47
48 if [ "$IMPORTANT" != "" ]; then
49 COLOR=$RED
50 ICON=􀁞
51 args+=(--set github.bell icon.color=$COLOR)
52 fi
53
54 args+=(--clone github.notification.$COUNTER github.template \
55 --set github.notification.$COUNTER label="$(echo "$title" | sed -e "s/^'//" -e "s/'$//")" \
56 icon="$ICON $(echo "$repo" | sed -e "s/^'//" -e "s/'$//"):" \
57 icon.padding_left="$PADDING" \
58 label.padding_right="$PADDING" \
59 icon.color=$COLOR \
60 position=popup.github.bell \
61 icon.background.color=$COLOR \
62 drawing=on \
63 click_script="open $URL;
64 sketchybar --set github.bell popup.drawing=off")
65 done <<< "$(echo "$NOTIFICATIONS" | jq -r '.[] | [.repository.name, .subject.latest_comment_url, .subject.type, .subject.title] | @sh')"
66
67 sketchybar -m "${args[@]}"
68
69 if [ $COUNT -gt $PREV_COUNT ] 2>/dev/null || [ "$SENDER" = "forced" ]; then
70 sketchybar --animate tanh 15 --set github.bell label.y_offset=5 label.y_offset=0
71 fi
72}
73
74popup() {
75 sketchybar --set $NAME popup.drawing=$1
76}
77
78case "$SENDER" in
79 "routine"|"forced") update
80 ;;
81 "mouse.entered") popup on
82 ;;
83 "mouse.exited"|"mouse.exited.global") popup off
84 ;;
85 "mouse.clicked") popup toggle
86 ;;
87esac
files/sketchybar/plugins/executable_icon_map.sh deleted-381
......@@ -1,381 +0,0 @@
1case "$1" in
2"Brave Browser")
3 icon_result=":brave_browser:"
4 ;;
5"Keyboard Maestro")
6 icon_result=":keyboard_maestro:"
7 ;;
8"Min")
9 icon_result=":min_browser:"
10 ;;
11"Final Cut Pro")
12 icon_result=":final_cut_pro:"
13 ;;
14"FaceTime")
15 icon_result=":face_time:"
16 ;;
17"Affinity Publisher")
18 icon_result=":affinity_publisher:"
19 ;;
20"Messages" | "Nachrichten")
21 icon_result=":messages:"
22 ;;
23"Tweetbot" | "Twitter")
24 icon_result=":twitter:"
25 ;;
26"ClickUp")
27 icon_result=":click_up:"
28 ;;
29"KeePassXC")
30 icon_result=":kee_pass_x_c:"
31 ;;
32"Microsoft Edge")
33 icon_result=":microsoft_edge:"
34 ;;
35"VLC")
36 icon_result=":vlc:"
37 ;;
38"Emacs")
39 icon_result=":emacs:"
40 ;;
41"Thunderbird")
42 icon_result=":thunderbird:"
43 ;;
44"Notes")
45 icon_result=":notes:"
46 ;;
47"Caprine")
48 icon_result=":caprine:"
49 ;;
50"Zulip")
51 icon_result=":zulip:"
52 ;;
53"Spark")
54 icon_result=":spark:"
55 ;;
56"Microsoft To Do" | "Things")
57 icon_result=":things:"
58 ;;
59"DEVONthink 3")
60 icon_result=":devonthink3:"
61 ;;
62"GitHub Desktop")
63 icon_result=":git_hub:"
64 ;;
65"App Store")
66 icon_result=":app_store:"
67 ;;
68"Chromium" | "Google Chrome" | "Google Chrome Canary")
69 icon_result=":google_chrome:"
70 ;;
71"zoom.us")
72 icon_result=":zoom:"
73 ;;
74"MoneyMoney")
75 icon_result=":bank:"
76 ;;
77"Color Picker")
78 icon_result=":color_picker:"
79 ;;
80"Microsoft Word")
81 icon_result=":microsoft_word:"
82 ;;
83"Iris")
84 icon_result=":iris:"
85 ;;
86"WebStorm")
87 icon_result=":web_storm:"
88 ;;
89"Neovide" | "MacVim" | "Vim" | "VimR")
90 icon_result=":vim:"
91 ;;
92"Sublime Text")
93 icon_result=":sublime_text:"
94 ;;
95"PomoDone App")
96 icon_result=":pomodone:"
97 ;;
98"Setapp")
99 icon_result=":setapp:"
100 ;;
101"qutebrowser")
102 icon_result=":qute_browser:"
103 ;;
104"Mattermost")
105 icon_result=":mattermost:"
106 ;;
107"Notability")
108 icon_result=":notability:"
109 ;;
110"WhatsApp")
111 icon_result=":whats_app:"
112 ;;
113"OBS")
114 icon_result=":obsstudio:"
115 ;;
116"Parallels Desktop")
117 icon_result=":parallels:"
118 ;;
119"VMware Fusion")
120 icon_result=":vmware_fusion:"
121 ;;
122"Pine")
123 icon_result=":pine:"
124 ;;
125"Microsoft Excel")
126 icon_result=":microsoft_excel:"
127 ;;
128"Microsoft PowerPoint")
129 icon_result=":microsoft_power_point:"
130 ;;
131"Matlab")
132 icon_result=":matlab:"
133 ;;
134"Numbers")
135 icon_result=":numbers:"
136 ;;
137"Default")
138 icon_result=":default:"
139 ;;
140"Element")
141 icon_result=":element:"
142 ;;
143"Bear")
144 icon_result=":bear:"
145 ;;
146"TeamSpeak 3")
147 icon_result=":team_speak:"
148 ;;
149"Airmail")
150 icon_result=":airmail:"
151 ;;
152"Firefox Developer Edition" | "Firefox Nightly")
153 icon_result=":firefox_developer_edition:"
154 ;;
155"Trello")
156 icon_result=":trello:"
157 ;;
158"TickTick")
159 icon_result=":tick_tick:"
160 ;;
161"Notion")
162 icon_result=":notion:"
163 ;;
164"Live")
165 icon_result=":ableton:"
166 ;;
167"Evernote Legacy")
168 icon_result=":evernote_legacy:"
169 ;;
170"Calendar" | "Fantastical")
171 icon_result=":calendar:"
172 ;;
173"Android Studio")
174 icon_result=":android_studio:"
175 ;;
176"Xcode")
177 icon_result=":xcode:"
178 ;;
179"Slack")
180 icon_result=":slack:"
181 ;;
182"Sequel Pro")
183 icon_result=":sequel_pro:"
184 ;;
185"Bitwarden")
186 icon_result=":bit_warden:"
187 ;;
188"System Preferences")
189 icon_result=":gear:"
190 ;;
191"Discord" | "Discord Canary" | "Discord PTB")
192 icon_result=":discord:"
193 ;;
194"Vivaldi")
195 icon_result=":vivaldi:"
196 ;;
197"Firefox")
198 icon_result=":firefox:"
199 ;;
200"Skype")
201 icon_result=":skype:"
202 ;;
203"Dropbox")
204 icon_result=":dropbox:"
205 ;;
206"微信")
207 icon_result=":wechat:"
208 ;;
209"Typora")
210 icon_result=":text:"
211 ;;
212"Blender")
213 icon_result=":blender:"
214 ;;
215"Canary Mail" | "HEY" | "Mail" | "Mailspring" | "MailMate" | "邮件")
216 icon_result=":mail:"
217 ;;
218"Safari" | "Safari Technology Preview")
219 icon_result=":safari:"
220 ;;
221"Telegram")
222 icon_result=":telegram:"
223 ;;
224"Keynote")
225 icon_result=":keynote:"
226 ;;
227"Reeder")
228 icon_result=":reeder5:"
229 ;;
230"Spotify")
231 icon_result=":spotify:"
232 ;;
233"MAMP" | "MAMP PRO")
234 icon_result=":mamp:"
235 ;;
236"Figma")
237 icon_result=":figma:"
238 ;;
239"Joplin")
240 icon_result=":joplin:"
241 ;;
242"Spotlight")
243 icon_result=":spotlight:"
244 ;;
245"Music")
246 icon_result=":music:"
247 ;;
248"Insomnia")
249 icon_result=":insomnia:"
250 ;;
251"TIDAL")
252 icon_result=":tidal:"
253 ;;
254"Alfred")
255 icon_result=":alfred:"
256 ;;
257"Pages")
258 icon_result=":pages:"
259 ;;
260"Folx")
261 icon_result=":folx:"
262 ;;
263"Android Messages")
264 icon_result=":android_messages:"
265 ;;
266"mpv")
267 icon_result=":mpv:"
268 ;;
269"网易云音乐")
270 icon_result=":netease_music:"
271 ;;
272"Transmit")
273 icon_result=":transmit:"
274 ;;
275"Pi-hole Remote")
276 icon_result=":pihole:"
277 ;;
278"Nova")
279 icon_result=":nova:"
280 ;;
281"Affinity Designer")
282 icon_result=":affinity_designer:"
283 ;;
284"IntelliJ IDEA")
285 icon_result=":idea:"
286 ;;
287"Drafts")
288 icon_result=":drafts:"
289 ;;
290"Audacity")
291 icon_result=":audacity:"
292 ;;
293"Affinity Photo")
294 icon_result=":affinity_photo:"
295 ;;
296"Atom")
297 icon_result=":atom:"
298 ;;
299"Obsidian")
300 icon_result=":obsidian:"
301 ;;
302"CleanMyMac X")
303 icon_result=":desktop:"
304 ;;
305"Zotero")
306 icon_result=":zotero:"
307 ;;
308"Todoist")
309 icon_result=":todoist:"
310 ;;
311"LibreWolf")
312 icon_result=":libre_wolf:"
313 ;;
314"Grammarly Editor")
315 icon_result=":grammarly:"
316 ;;
317"OmniFocus")
318 icon_result=":omni_focus:"
319 ;;
320"Reminders")
321 icon_result=":reminders:"
322 ;;
323"Preview" | "Skim" | "zathura")
324 icon_result=":pdf:"
325 ;;
326"1Password 7")
327 icon_result=":one_password:"
328 ;;
329"Code" | "Code - Insiders")
330 icon_result=":code:"
331 ;;
332"VSCodium")
333 icon_result=":vscodium:"
334 ;;
335"Tower")
336 icon_result=":tower:"
337 ;;
338"Calibre")
339 icon_result=":book:"
340 ;;
341"Finder" | "访达")
342 icon_result=":finder:"
343 ;;
344"Linear")
345 icon_result=":linear:"
346 ;;
347"League of Legends")
348 icon_result=":league_of_legends:"
349 ;;
350"Zeplin")
351 icon_result=":zeplin:"
352 ;;
353"Signal")
354 icon_result=":signal:"
355 ;;
356"Podcasts")
357 icon_result=":podcasts:"
358 ;;
359"Alacritty" | "Hyper" | "iTerm2" | "kitty" | "Terminal" | "WezTerm")
360 icon_result=":terminal:"
361 ;;
362"Tor Browser")
363 icon_result=":tor_browser:"
364 ;;
365"Kakoune")
366 icon_result=":kakoune:"
367 ;;
368"GrandTotal" | "Receipts")
369 icon_result=":dollar:"
370 ;;
371"Sketch")
372 icon_result=":sketch:"
373 ;;
374"Sequel Ace")
375 icon_result=":sequel_ace:"
376 ;;
377*)
378 icon_result=":default:"
379 ;;
380esac
381echo $icon_result
files/sketchybar/plugins/executable_space.sh deleted-8
......@@ -1,8 +0,0 @@
1#!/usr/bin/env sh
2
3WIDTH="dynamic"
4if [ "$SELECTED" = "true" ]; then
5 WIDTH="0"
6fi
7
8sketchybar --animate tanh 20 --set $NAME icon.highlight=$SELECTED label.width=$WIDTH
files/sketchybar/plugins/executable_spotify.sh deleted-114
......@@ -1,114 +0,0 @@
1#!/bin/sh
2
3next ()
4{
5 osascript -e 'tell application "Spotify" to play next track'
6}
7
8back ()
9{
10 osascript -e 'tell application "Spotify" to play previous track'
11}
12
13play ()
14{
15 osascript -e 'tell application "Spotify" to playpause'
16}
17
18repeat ()
19{
20 REPEAT=$(osascript -e 'tell application "Spotify" to get repeating')
21 if [ "$REPEAT" = "false" ]; then
22 sketchybar -m --set spotify.repeat icon.highlight=on
23 osascript -e 'tell application "Spotify" to set repeating to true'
24 else
25 sketchybar -m --set spotify.repeat icon.highlight=off
26 osascript -e 'tell application "Spotify" to set repeating to false'
27 fi
28}
29
30shuffle ()
31{
32 SHUFFLE=$(osascript -e 'tell application "Spotify" to get shuffling')
33 if [ "$SHUFFLE" = "false" ]; then
34 sketchybar -m --set spotify.shuffle icon.highlight=on
35 osascript -e 'tell application "Spotify" to set shuffling to true'
36 else
37 sketchybar -m --set spotify.shuffle icon.highlight=off
38 osascript -e 'tell application "Spotify" to set shuffling to false'
39 fi
40}
41
42update ()
43{
44 PLAYING=1
45 if [ "$(echo "$INFO" | jq -r '.["Player State"]')" = "Playing" ]; then
46 PLAYING=0
47 TRACK="$(echo "$INFO" | jq -r .Name | sed 's/\(.\{20\}\).*/\1.../')"
48 ARTIST="$(echo "$INFO" | jq -r .Artist | sed 's/\(.\{20\}\).*/\1.../')"
49 ALBUM="$(echo "$INFO" | jq -r .Album | sed 's/\(.\{25\}\).*/\1.../')"
50 SHUFFLE=$(osascript -e 'tell application "Spotify" to get shuffling')
51 REPEAT=$(osascript -e 'tell application "Spotify" to get repeating')
52 COVER=$(osascript -e 'tell application "Spotify" to get artwork url of current track')
53 fi
54
55 args=()
56 if [ $PLAYING -eq 0 ]; then
57 curl -s --max-time 20 "$COVER" -o /tmp/cover.jpg
58 if [ "$ARTIST" == "" ]; then
59 args+=(--set spotify.title label="$TRACK" drawing=on \
60 --set spotify.album label="Podcast" drawing=on \
61 --set spotify.artist label="$ALBUM" drawing=on )
62 else
63 args+=(--set spotify.title label="$TRACK" drawing=on \
64 --set spotify.album label="$ALBUM" drawing=on \
65 --set spotify.artist label="$ARTIST" drawing=on)
66 fi
67 args+=(--set spotify.play icon=􀊆 \
68 --set spotify.shuffle icon.highlight=$SHUFFLE \
69 --set spotify.repeat icon.highlight=$REPEAT \
70 --set spotify.cover background.image="/tmp/cover.jpg" \
71 background.color=0x00000000 \
72 --set spotify.anchor icon.drawing=on \
73 drawing=on \
74 --set spotify drawing=on )
75 else
76 args+=(--set spotify.title drawing=off \
77 --set spotify.artist drawing=off \
78 --set spotify.anchor drawing=off popup.drawing=off \
79 --set spotify.play icon=􀊄 )
80 fi
81 sketchybar -m "${args[@]}"
82}
83
84mouse_clicked () {
85 case "$NAME" in
86 "spotify.next") next
87 ;;
88 "spotify.back") back
89 ;;
90 "spotify.play") play
91 ;;
92 "spotify.shuffle") shuffle
93 ;;
94 "spotify.repeat") repeat
95 ;;
96 *) exit
97 ;;
98 esac
99}
100
101popup () {
102 sketchybar --set spotify.anchor popup.drawing=$1
103}
104
105case "$SENDER" in
106 "mouse.clicked") mouse_clicked
107 ;;
108 "mouse.entered") popup on
109 ;;
110 "mouse.exited"|"mouse.exited.global") popup off
111 ;;
112 *) update
113 ;;
114esac
files/sketchybar/plugins/executable_volume_click.sh deleted-9
......@@ -1,9 +0,0 @@
1#!/usr/bin/env sh
2
3MUTED=$(osascript -e 'output muted of (get volume settings)')
4
5if [ "$MUTED" = "false" ]; then
6 osascript -e 'set volume output muted true'
7else
8 osascript -e 'set volume output muted false'
9fi
files/sketchybar/plugins/executable_zen.sh deleted-45
......@@ -1,45 +0,0 @@
1#!/bin/sh
2
3zen_on() {
4 sketchybar --set github.bell drawing=off \
5 --set apple.logo drawing=off \
6 --set '/cpu.*/' drawing=off \
7 --set calendar icon.drawing=off \
8 --set system.yabai drawing=off \
9 --set separator drawing=off \
10 --set front_app drawing=off \
11 --set volume_alias drawing=off \
12 --set spotify.anchor drawing=off \
13 --set spotify.play updates=off \
14 --set brew drawing=off \
15 --set divider drawing=off \
16 --bar padding_left=18
17}
18
19zen_off() {
20 sketchybar --set github.bell drawing=on \
21 --set apple.logo drawing=on \
22 --set '/cpu.*/' drawing=on \
23 --set calendar icon.drawing=on \
24 --set separator drawing=on \
25 --set front_app drawing=on \
26 --set system.yabai drawing=on \
27 --set volume_alias drawing=on \
28 --set spotify.play updates=on \
29 --set brew drawing=on \
30 --set divider drawing=on \
31 --bar padding_left=7
32}
33
34if [ "$1" = "on" ]; then
35 zen_on
36elif [ "$1" = "off" ]; then
37 zen_off
38else
39 if [ "$(sketchybar --query apple.logo | jq -r ".geometry.drawing")" = "on" ]; then
40 zen_on
41 else
42 zen_off
43 fi
44fi
45
modules/macos/services/sketchybar/default.nix created+95
......@@ -0,0 +1,95 @@
1{
2 config,
3 pkgs,
4 colors,
5}: let
6 template = pkgs.substituteAllFiles {
7 src = ./config;
8 files = [
9 "colors.lua"
10 "settings.lua"
11 "items/cpu.lua"
12 "items/spaces.lua"
13 ];
14 timeout = "${pkgs.coreutils}/bin/timeout";
15 ping = "${pkgs.inetutils}/bin/ping";
16 sketchybar_cpu = "${pkgs.sketchybar-helpers}/bin/sketchybar-cpu";
17 colors_blue = colors.nominal.blue;
18 colors_red = colors.nominal.red;
19 colors_unifying = colors.semantic.unifying;
20 colors_good = colors.semantic.good;
21 colors_info = colors.semantic.info;
22 colors_warning = colors.semantic.warning;
23 colors_urgent = colors.semantic.urgent;
24 colors_primary_bg = colors.semantic.background;
25 colors_primary_fg = colors.semantic.foreground;
26 colors_secondary_bg = colors.semantic.background_highlighted;
27 colors_secondary_fg = colors.semantic.foreground;
28 colors_unselected_bg = colors.window.unselected.background;
29 colors_unselected_fg = colors.window.unselected.text;
30 colors_selected_focused_bg = colors.window.selected.focused.background;
31 colors_selected_focused_fg = colors.window.selected.focused.text;
32 colors_selected_unfocused_bg = colors.window.selected.unfocused.background;
33 colors_selected_unfocused_fg = colors.window.selected.unfocused.text;
34 font_family = config.theme.fonts.proportional.name;
35 };
36
37 appIconNames = pkgs.runCommand "sketchybar-app-icon-names" {} ''
38 mkdir -p "$out"
39 {
40 echo "return {"
41 "${pkgs.findutils}/bin/find" \
42 "${pkgs.sources.sketchybar-font-src}/mappings" \
43 -type f \
44 -mindepth 1 \
45 -maxdepth 1 | while read -r f
46 do cat $f | sed 's/ *| */\n/g;s/[*]//g' | while read -r s
47 do echo " [$s]" = \"''${f##*/}\",
48 done
49 done
50 echo ' [".kitty-wrapped"] = ":kitty:",'
51 echo ' ["iTerm2"] = ":iterm:",'
52 echo ' ["Google Chrome Beta"] = ":google_chrome:",'
53 echo ' ["Microsoft Edge Beta"] = ":microsoft_edge:",'
54 echo "}"
55 } > "$out/app_icon_names.lua"
56 '';
57
58 combined = pkgs.symlinkJoin {
59 name = "sketchybar-config";
60 paths = [template appIconNames ./config];
61 };
62
63 luaposix = pkgs.lua5_4.pkgs.buildLuarocksPackage {
64 pname = "luaposix";
65 version = "36.3-1";
66 src = pkgs.sources.luaposix;
67 };
68
69 lua = pkgs.lua5_4.withPackages (ps: [
70 ps.lua-cjson
71 luaposix
72 ]);
73in {
74 enable = true;
75 package = pkgs.sketchybar;
76 config = ''
77 #!${lua}/bin/lua
78
79 package.cpath = package.cpath .. ";${pkgs.sketchybar-lua}/?.so"
80 package.path = package.path .. ";${combined}/?.lua;${combined}/?/init.lua"
81
82 local Aerospace = require("aerospace")
83 local aerospace = Aerospace.new()
84 while not aerospace:is_initialized() do
85 os.execute("sleep 0.1")
86 end
87 sbar = require("sketchybar")
88 sbar.aerospace = aerospace
89 sbar.begin_config()
90 require("init")
91 sbar.hotload(false)
92 sbar.end_config()
93 sbar.event_loop()
94 '';
95}
modules/macos/tiling/sketchybar-home.nix+388-252
......@@ -19,7 +19,6 @@ in {
1919 #!/usr/bin/env sh
2020
2121 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
22 source "$HOME/.config/sketchybar/icons.sh" # Loads all defined icons
2322
2423 ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured
2524 PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored
......@@ -27,49 +26,33 @@ in {
2726 FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants
2827 PADDINGS=3 # All paddings use this value (icon, label, background)
2928
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 &
35
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 &
3829
3930 # Setting up the general bar appearance and default values
4031 ${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
32 blur_radius=30 \
33 position=top \
34 sticky=on \
35 padding_left=10 \
36 padding_right=10
37
38
39 ${pkgs.sketchybar}/bin/sketchybar --default icon.font="SF Pro:Semibold:12.0" \
40 icon.color=$ITEM_COLOR \
41 label.font="SF Pro:Semibold:12.0" \
42 label.color=$ITEM_COLOR \
43 background.color=$ACCENT_COLOR \
44 background.corner_radius=10 \
45 background.height=20 \
46 padding_left=4 \
47 padding_right=4 \
48 icon.padding_left=6 \
49 icon.padding_right=3 \
50 label.padding_left=3 \
51 label.padding_right=6
52
7053
7154 # Left
72 source "$ITEM_DIR/apple.sh"
55 # source "$ITEM_DIR/apple.sh"
7356 source "$ITEM_DIR/spaces.sh"
7457 source "$ITEM_DIR/front_app.sh"
7558
......@@ -78,11 +61,10 @@ in {
7861 source "$ITEM_DIR/calendar.sh"
7962
8063 # 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"
64 source $ITEM_DIR/calendar.sh
65 source $ITEM_DIR/wifi.sh
66 source $ITEM_DIR/battery.sh
67 source $ITEM_DIR/volume.sh
8668
8769 # Forcing all item scripts to run (never do this outside of sketchybarrc)
8870 ${pkgs.sketchybar}/bin/sketchybar --update
......@@ -92,275 +74,429 @@ in {
9274 };
9375 icons = {
9476 executable = true;
95 target = ".config/sketchybar/icons.sh";
96 source = folder + /icons.sh;
77 target = ".config/sketchybar/plugins/icons.sh";
78 text = ''
79 #!/usr/bin/env sh
80
81 # Source the icon map with all the application icons
82 source ${pkgs.sketchybar-app-font}/bin/icon_map.sh
83
84 # Create a cache directory if it doesn't exist
85 CACHE_DIR="$HOME/.cache/sketchybar"
86 mkdir -p "$CACHE_DIR"
87
88 # Cache file for icon mappings
89 ICON_CACHE="$CACHE_DIR/icon_cache.txt"
90
91 # Create the cache file if it doesn't exist
92 if [ ! -f "$ICON_CACHE" ]; then
93 touch "$ICON_CACHE"
94 fi
95
96 # Check if the app is already in cache
97 APP_NAME=$(if [ "$1" = "Zen" ]; then echo "Zen Browser"; else echo "$1"; fi)
98
99 CACHED_ICON=$(grep "^$APP_NAME|" "$ICON_CACHE" | cut -d '|' -f2)
100
101 if [ -n "$CACHED_ICON" ]; then
102 # Cache hit, return the icon
103 echo "$CACHED_ICON"
104 exit 0
105 fi
106
107 # Get icon from the mapping function
108 __icon_map "$APP_NAME"
109
110 if [ -n "$icon_result" ]; then
111 echo "$APP_NAME|$icon_result" >>"$ICON_CACHE"
112 fi
113
114 echo "$icon_result"
115 '';
97116 };
98117 colors = {
99118 executable = true;
100119 target = ".config/sketchybar/colors.sh";
101120 text = ''
102 #!/usr/bin/env sh
103 # Color Palette
104 export BLACK=0xff11111b
105 export WHITE=0x66cdd6f4
106 export RED=0xffa6e3a1
107 export GREEN=0xff40a02b
108 export BLUE=0xff89b4fa
109 export YELLOW=0xfff9e2af
110 export ORANGE=0xfffab387
111 export MAGENTA=0xffeba0ac
112 export GREY=0xff585b70
113 export TRANSPARENT=0xff000000
114 export BLUE2=0xff7287fd
115 export FLAMINGO=0xfff2cdcd
116
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
123
124 export POPUP_BACKGROUND_COLOR=$BLACK
125 export POPUP_BORDER_COLOR=$WHITE
126
127 export SHADOW_COLOR=$BLACK
121
122 export TRANSPARENT=0x00ffffff
123
124 # -- Gray Scheme --
125 export ITEM_COLOR=0xff000000
126 export ACCENT_COLOR=0xffc3c6cb
127
128 # -- White Scheme --
129 # export ITEM_COLOR=0xff000000
130 # export ACCENT_COLOR=0xffffffff
131
132 # -- Teal Scheme --
133 # export ITEM_COLOR=0xff000000
134 # export ACCENT_COLOR=0xff2cf9ed
135
136 # -- Purple Scheme --
137 # export ITEM_COLOR=0xff000000
138 # export ACCENT_COLOR=0xffeb46f9
139
140 # -- Red Scheme ---
141 # export ITEM_COLOR=0xff000000
142 # export ACCENT_COLOR=0xffff2453
143
144 # -- Blue Scheme ---
145 # export ITEM_COLOR=0xff000000
146 # export ACCENT_COLOR=0xff15bdf9
147
148 # -- Green Scheme --
149 # export ITEM_COLOR=0xff000000
150 # export ACCENT_COLOR=0xff1dfca1
151
152 # -- Orange Scheme --
153 # export ITEM_COLOR=0xffffffff
154 # export ACCENT_COLOR=0xfff97716
155
156 # -- Yellow Scheme --
157 # export ITEM_COLOR=0xff000000
158 # export ACCENT_COLOR=0xfff7fc17
128159 '';
129160 };
130 items_apple = {
161 items_wifi = {
131162 executable = true;
132 target = ".config/sketchybar/items/apple.sh";
133 source = folder + /items/executable_apple.sh;
163 target = ".config/sketchybar/items/wifi.sh";
164 text = ''
165 #!/usr/bin/env/ sh
166
167 sketchybar --add item wifi right \
168 --set wifi \
169 icon="􀙥" \
170 label="Updating..." \
171 script="$PLUGIN_DIR/wifi.sh" \
172 --subscribe wifi wifi_change
173 '';
134174 };
135 items_brew = {
175 items_battery = {
136176 executable = true;
137 target = ".config/sketchybar/items/brew.sh";
138 source = folder + /items/executable_brew.sh;
177 target = ".config/sketchybar/items/battery.sh";
178 text = ''
179 #!/usr/bin/env/ sh
180 sketchybar --add item battery right \
181 --set battery update_freq=180 \
182 script="$PLUGIN_DIR/battery.sh" \
183 --subscribe battery system_woke power_source_change
184 '';
139185 };
140186 items_calendar = {
141187 executable = true;
142188 target = ".config/sketchybar/items/calendar.sh";
143189 text = ''
144190 #!/usr/bin/env sh
145
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"
191 sketchybar --add item calendar right \
192 --set calendar icon=􀧞 \
193 update_freq=15 \
194 script="$PLUGIN_DIR/calendar.sh"
157195 '';
158196 };
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 };
169197 items_front_app = {
170198 executable = true;
171199 target = ".config/sketchybar/items/front_app.sh";
172200 text = ''
173201 #!/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
202
203 sketchybar --add item front_app left \
204 --set front_app background.color=$ACCENT_COLOR \
205 icon.color=$ITEM_COLOR \
206 label.color=$ITEM_COLOR \
207 icon.font="sketchybar-app-font:Regular:12.0" \
208 label.font="SF Pro:Semibold:12.0" \
209 script="$PLUGIN_DIR/front_app.sh" \
210 --subscribe front_app front_app_switched
198211 '';
199212 };
200 items_github = {
201 executable = true;
202 target = ".config/sketchybar/items/github.sh";
203 source = folder + /items/executable_github.sh;
204 };
205213 items_spaces = {
206214 executable = true;
207215 target = ".config/sketchybar/items/spaces.sh";
208 # label.background.color=$BACKGROUND_2
209216 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
217 sketchybar --add event aerospace_workspace_change
218
219 sketchybar --add item aerospace_dummy left \
220 --set aerospace_dummy display=0 \
221 script="$PLUGIN_DIR/spaces.sh" \
222 --subscribe aerospace_dummy aerospace_workspace_change
223
224 for m in $(aerospace list-monitors | awk '{print $1}'); do
225 for sid in $(aerospace list-workspaces --monitor $m); do
226 sketchybar --add space space.$sid left \
227 --set space.$sid space=$sid \
228 icon=$sid \
229 background.color=$TRANSPARENT \
230 label.color=$ACCENT_COLOR \
231 icon.color=$ACCENT_COLOR \
232 display=$m \
233 label.font="sketchybar-app-font:Regular:12.0" \
234 icon.font="SF Pro:Semibold:12.0" \
235 label.padding_right=10 \
236 label.y_offset=-1 \
237 click_script="$PLUGIN_DIR/space_click.sh $sid"
238
239 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" |
240 awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}')
241
242 icon_strip=""
243 if [ "''${apps}" != "" ]; then
244 while read -r app; do
245 icon_strip+=" $($PLUGIN_DIR/icons.sh "$app")"
246 done <<<"''${apps}"
247 else
248 icon_strip=" —"
249 fi
250
251 sketchybar --set space.$sid label="$icon_strip"
252
253 done
254
255 for empty_space in $(aerospace list-workspaces --monitor $m --empty); do
256 sketchybar --set space.$empty_space display=0
257 done
258 for focus in $(aerospace list-workspaces --focused); do
259 sketchybar --set space.$focus background.drawing=on \
260 background.color=$ACCENT_COLOR \
261 label.color=$ITEM_COLOR \
262 icon.color=$ITEM_COLOR
263 done
235264 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
244265 '';
245266 };
246 items_spotify = {
247 executable = true;
248 target = ".config/sketchybar/items/spotify.sh";
249 source = folder + /items/executable_spotify.sh;
250 };
267
251268 items_volume = {
252269 executable = true;
253270 target = ".config/sketchybar/items/volume.sh";
254271 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
273
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"
272 #/usr/bin/env sh
284273
274 sketchybar --add item volume right \
275 --set volume script="$PLUGIN_DIR/volume.sh" \
276 --subscribe volume volume_change
285277 '';
286278 };
287 plugins_brew = {
279 plugins_wifi = {
288280 executable = true;
289 target = ".config/sketchybar/plugins/brew.sh";
290 source = folder + /plugins/executable_brew.sh;
281 target = ".config/sketchybar/plugins/wifi.sh";
282 text = ''
283 #/usr/bin/env sh
284
285 SSID=$(system_profiler SPAirPortDataType | awk '/Current Network Information:/ { getline; print substr($0, 13, (length($0) - 13)); exit }')
286
287 if [ "$SSID" = "" ]; then
288 sketchybar --set $NAME icon="􀙈" label="Disconnected"
289 else
290 sketchybar --set $NAME icon="􀙇" label="$SSID"
291 fi
292
293 '';
291294 };
292295 plugins_calendar = {
293296 executable = true;
294297 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;
298
299 text = ''
300 #/usr/bin/env sh
301
302 sketchybar --set $NAME label="$(date +'%a %d %b %I:%M %p')"
303 '';
306304 };
307 plugins_space = {
305 plugins_spaces = {
308306 executable = true;
309 target = ".config/sketchybar/plugins/space.sh";
310 source = folder + /plugins/executable_space.sh;
307 target = ".config/sketchybar/plugins/spaces.sh";
308 text = ''
309 #!/usr/bin/env sh
310
311 source "$CONFIG_DIR/colors.sh"
312
313 update_workspace_appearance() {
314 local sid=$1
315 local is_focused=$2
316
317 if [ "$is_focused" = "true" ]; then
318 sketchybar --set space.$sid background.drawing=on \
319 background.color=$ACCENT_COLOR \
320 label.color=$ITEM_COLOR \
321 icon.color=$ITEM_COLOR
322 else
323 sketchybar --set space.$sid background.drawing=off \
324 label.color=$ACCENT_COLOR \
325 icon.color=$ACCENT_COLOR
326 fi
327 }
328
329 update_icons() {
330 m=$1
331 sid=$2
332
333 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" \
334 | awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}' \
335 | sort)
336
337 icon_strip=""
338 if [ "''${apps}" != "" ]; then
339 while read -r app; do
340 icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")"
341 done <<<"''${apps}"
342 else
343 icon_strip=" —"
344 fi
345
346 sketchybar --animate sin 10 --set space.$sid label="$icon_strip"
347 }
348
349 update_workspace_appearance "$PREV_WORKSPACE" "false"
350 update_workspace_appearance "$FOCUSED_WORKSPACE" "true"
351
352 for m in $(aerospace list-monitors | awk '{print $1}'); do
353 for sid in $(aerospace list-workspaces --monitor $m --visible); do
354 sketchybar --set space.$sid display=$m
355
356 update_icons "$m" "$sid"
357
358 update_icons "$m" "$PREV_WORKSPACE"
359
360 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" | wc -l)
361 if [ "''${apps}" -eq 0 ]; then
362 sketchybar --set space.$sid display=0
363 fi
364 done
365 done
366 '';
311367 };
312 plugins_spotify = {
368
369 plugins_space_click = {
313370 executable = true;
314 target = ".config/sketchybar/plugins/spotify.sh";
315 source = folder + /plugins/executable_spotify.sh;
316 };
371 target = ".config/sketchybar/plugins/space_click.sh";
372 text = ''
373 #/usr/bin/env/ sh
374
375 apps=$(aerospace list-windows --workspace $1 | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}')
376 focused=$(aerospace list-workspaces --focused)
377
378 if [ "''${apps}" = "" ] && [ "''${focused}" != "$1" ]; then
379 sketchybar --set space.$1 display=0
380 else
381 aerospace workspace $1
382 fi
383 '';
384 ;
317385 plugins_volume = {
318386 executable = true;
319387 target = ".config/sketchybar/plugins/volume.sh";
320388 text = ''
321 #!/usr/bin/env sh
322 WIDTH=100
323
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
332
333
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 }
389 #!/usr/bin/env sh
340390
341 case "$SENDER" in
342 "volume_change") volume_change
343 ;;
344 esac
391 # The volume_change event supplies a $INFO variable in which the current volume
392 # percentage is passed to the script.
393
394 if [ "$SENDER" = "volume_change" ]; then
395
396 VOLUME=$INFO
397
398 case $VOLUME in
399 [6-9][0-9] | 100)
400 ICON="􀊩"
401 ;;
402 [3-5][0-9])
403 ICON="􀊥"
404 ;;
405 [1-9] | [1-2][0-9])
406 ICON="􀊡"
407 ;;
408 *) ICON="􀊣" ;;
409 esac
410
411 sketchybar --set $NAME icon="$ICON" label="$VOLUME%"
412 fi
345413 '';
346414 };
347 plugins_volume_click = {
415 plugins_front_app = {
348416 executable = true;
349 target = ".config/sketchybar/plugins/volume_click.sh";
417 target = ".config/sketchybar/plugins/front_app.sh";
350418 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'
355 else
356 osascript -e 'set volume output muted false'
419 # Some events send additional information specific to the event in the $INFO
420 # variable. E.g. the front_app_switched event sends the name of the newly
421 # focused application in the $INFO variable:
422 # https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
423
424 app_switched() {
425 for m in $(aerospace list-monitors | awk '{print $1}'); do
426 for sid in $(aerospace list-workspaces --monitor $m --visible); do
427
428 apps=$( (echo "$INFO"; aerospace list-windows --monitor "$m" --workspace "$sid" \
429 | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}') \
430 | awk '!seen[$0]++' | sort)
431
432 icon_strip=""
433 if [ "''${apps}" != "" ]; then
434 while read -r app; do
435 icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")"
436 done <<<"''${apps}"
437 else
438 icon_strip=" —"
439 fi
440
441 sketchybar --animate sin 10 --set space.$sid label="$icon_strip"
442 done
443 done
444 }
445
446 if [ "$SENDER" = "front_app_switched" ]; then
447
448 sketchybar --set $NAME label="$INFO" icon="$($CONFIG_DIR/plugins/icons.sh "$INFO")"
449
450 app_switched
357451 fi
358452 '';
359453 };
360 plugins_zen = {
454 plugins_battery = {
361455 executable = true;
362 target = ".config/sketchybar/plugins/zen.sh";
363 source = folder + /plugins/executable_zen.sh;
456 target = ".config/sketchybar/plugins/battery.sh";
457 text = ''
458 #!/usr/bin/env sh
459 source "$CONFIG_DIR/colors.sh"
460
461 PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
462 CHARGING=$(pmset -g batt | grep 'AC Power')
463
464 if [ $PERCENTAGE = "" ]; then
465 exit 0
466 fi
467
468 case ''${PERCENTAGE} in
469 9[0-9] | 100)
470 ICON="􀛨"
471 COLOR=$ITEM_COLOR
472 ;;
473 [6-8][0-9])
474 ICON="􀺸"
475 COLOR=$ITEM_COLOR
476 ;;
477 [3-5][0-9])
478 ICON="􀺶"
479 COLOR="0xFFd97706"
480 ;;
481 [1-2][0-9])
482 ICON="􀛩"
483 COLOR="0xFFf97316"
484 ;;
485 *)
486 ICON="􀛪"
487 COLOR="0xFFef4444"
488 ;;
489 esac
490
491 if [[ $CHARGING != "" ]]; then
492 ICON="􀢋"
493 COLOR=$ITEM_COLOR
494 fi
495
496 # The item invoking this script (name $NAME) will get its icon and label
497 # updated with the current battery status
498 sketchybar --set $NAME icon="$ICON" label="''${PERCENTAGE}%" icon.color="$COLOR"
499 '';
364500 };
365501 plugins_aerospace = {
366502 executable = true;
users/natalie/configuration.nix+1
......@@ -13,6 +13,7 @@
1313 nerd-fonts.symbols-only
1414 nerd-fonts.iosevka
1515 inputs.apple-fonts.packages.${pkgs.system}.sf-pro
16 sketchybar-app-font
1617 ];
1718
1819 # configuration for shared modules.