mirror of
https://gitlab.com/thebiblelover7/dotfiles.git
synced 2025-09-13 15:13:49 +00:00
Clean up, update configs to be actually useful now...
This commit is contained in:
26
.config/sketchybar/colors.sh
Executable file
26
.config/sketchybar/colors.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Color Palette
|
||||
export BLACK=0xff181926
|
||||
export WHITE=0xffcad3f5
|
||||
export RED=0xffed8796
|
||||
export GREEN=0xffa6da95
|
||||
export BLUE=0xff8aadf4
|
||||
export YELLOW=0xffeed49f
|
||||
export ORANGE=0xfff5a97f
|
||||
export MAGENTA=0xffc6a0f6
|
||||
export GREY=0xff939ab7
|
||||
export TRANSPARENT=0x00000000
|
||||
|
||||
# General bar colors
|
||||
export BAR_COLOR=0xff1e1e2e
|
||||
export BAR_BORDER_COLOR=0xff494d64 #0xa024273a
|
||||
export ICON_COLOR=$WHITE # Color of all icons
|
||||
export LABEL_COLOR=$WHITE # Color of all labels
|
||||
export BACKGROUND_1=0x603c3e4f
|
||||
export BACKGROUND_2=0x60494d64
|
||||
|
||||
export POPUP_BACKGROUND_COLOR=0xff1e1e2e
|
||||
export POPUP_BORDER_COLOR=$WHITE
|
||||
|
||||
export SHADOW_COLOR=$BLACK
|
122
.config/sketchybar/helper/cpu.h
Normal file
122
.config/sketchybar/helper/cpu.h
Normal file
@@ -0,0 +1,122 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <mach/mach.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
|
||||
#define MAX_TOPPROC_LEN 28
|
||||
|
||||
static const char TOPPROC[] = { "/bin/ps -Aceo pid,pcpu,comm -r" };
|
||||
static const char FILTER_PATTERN[] = { "com.apple." };
|
||||
|
||||
struct cpu {
|
||||
host_t host;
|
||||
mach_msg_type_number_t count;
|
||||
host_cpu_load_info_data_t load;
|
||||
host_cpu_load_info_data_t prev_load;
|
||||
bool has_prev_load;
|
||||
|
||||
char command[256];
|
||||
};
|
||||
|
||||
static inline void cpu_init(struct cpu* cpu) {
|
||||
cpu->host = mach_host_self();
|
||||
cpu->count = HOST_CPU_LOAD_INFO_COUNT;
|
||||
cpu->has_prev_load = false;
|
||||
snprintf(cpu->command, 100, "");
|
||||
}
|
||||
|
||||
static inline void cpu_update(struct cpu* cpu) {
|
||||
kern_return_t error = host_statistics(cpu->host,
|
||||
HOST_CPU_LOAD_INFO,
|
||||
(host_info_t)&cpu->load,
|
||||
&cpu->count );
|
||||
|
||||
if (error != KERN_SUCCESS) {
|
||||
printf("Error: Could not read cpu host statistics.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cpu->has_prev_load) {
|
||||
uint32_t delta_user = cpu->load.cpu_ticks[CPU_STATE_USER]
|
||||
- cpu->prev_load.cpu_ticks[CPU_STATE_USER];
|
||||
|
||||
uint32_t delta_system = cpu->load.cpu_ticks[CPU_STATE_SYSTEM]
|
||||
- cpu->prev_load.cpu_ticks[CPU_STATE_SYSTEM];
|
||||
|
||||
uint32_t delta_idle = cpu->load.cpu_ticks[CPU_STATE_IDLE]
|
||||
- cpu->prev_load.cpu_ticks[CPU_STATE_IDLE];
|
||||
|
||||
double user_perc = (double)delta_user / (double)(delta_system
|
||||
+ delta_user
|
||||
+ delta_idle);
|
||||
|
||||
double sys_perc = (double)delta_system / (double)(delta_system
|
||||
+ delta_user
|
||||
+ delta_idle);
|
||||
|
||||
double total_perc = user_perc + sys_perc;
|
||||
|
||||
FILE* file;
|
||||
char line[1024];
|
||||
|
||||
file = popen(TOPPROC, "r");
|
||||
if (!file) {
|
||||
printf("Error: TOPPROC command errored out...\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
fgets(line, sizeof(line), file);
|
||||
fgets(line, sizeof(line), file);
|
||||
|
||||
char* start = strstr(line, FILTER_PATTERN);
|
||||
char topproc[MAX_TOPPROC_LEN + 4];
|
||||
uint32_t caret = 0;
|
||||
for (int i = 0; i < sizeof(line); i++) {
|
||||
if (start && i == start - line) {
|
||||
i+=9;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (caret >= MAX_TOPPROC_LEN && caret <= MAX_TOPPROC_LEN + 2) {
|
||||
topproc[caret++] = '.';
|
||||
continue;
|
||||
}
|
||||
if (caret > MAX_TOPPROC_LEN + 2) break;
|
||||
topproc[caret++] = line[i];
|
||||
if (line[i] == '\0') break;
|
||||
}
|
||||
|
||||
topproc[MAX_TOPPROC_LEN + 3] = '\0';
|
||||
|
||||
pclose(file);
|
||||
|
||||
char color[16];
|
||||
if (total_perc >= .7) {
|
||||
snprintf(color, 16, "%s", getenv("RED"));
|
||||
} else if (total_perc >= .3) {
|
||||
snprintf(color, 16, "%s", getenv("ORANGE"));
|
||||
} else if (total_perc >= .1) {
|
||||
snprintf(color, 16, "%s", getenv("YELLOW"));
|
||||
} else {
|
||||
snprintf(color, 16, "%s", getenv("LABEL_COLOR"));
|
||||
}
|
||||
|
||||
snprintf(cpu->command, 256, "--push cpu.sys %.2f "
|
||||
"--push cpu.user %.2f "
|
||||
"--set cpu.top label='%s' "
|
||||
"--set cpu.percent label=%.0f%% label.color=%s ",
|
||||
sys_perc,
|
||||
user_perc,
|
||||
topproc,
|
||||
total_perc*100.,
|
||||
color );
|
||||
}
|
||||
else {
|
||||
snprintf(cpu->command, 256, "");
|
||||
}
|
||||
|
||||
cpu->prev_load = cpu->load;
|
||||
cpu->has_prev_load = true;
|
||||
}
|
BIN
.config/sketchybar/helper/helper
Executable file
BIN
.config/sketchybar/helper/helper
Executable file
Binary file not shown.
31
.config/sketchybar/helper/helper.c
Normal file
31
.config/sketchybar/helper/helper.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "cpu.h"
|
||||
#include "sketchybar.h"
|
||||
|
||||
struct cpu g_cpu;
|
||||
|
||||
void handler(env env) {
|
||||
// Environment variables passed from sketchybar can be accessed as seen below
|
||||
char* name = env_get_value_for_key(env, "NAME");
|
||||
char* sender = env_get_value_for_key(env, "SENDER");
|
||||
char* info = env_get_value_for_key(env, "INFO");
|
||||
char* selected = env_get_value_for_key(env, "SELECTED");
|
||||
|
||||
if ((strcmp(name, "cpu.percent") == 0)) {
|
||||
// CPU graph updates
|
||||
cpu_update(&g_cpu);
|
||||
|
||||
if (strlen(g_cpu.command) > 0) sketchybar(g_cpu.command);
|
||||
}
|
||||
}
|
||||
|
||||
int main (int argc, char** argv) {
|
||||
cpu_init(&g_cpu);
|
||||
|
||||
if (argc < 2) {
|
||||
printf("Usage: helper \"<bootstrap name>\"\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
event_server_begin(handler, argv[1]);
|
||||
return 0;
|
||||
}
|
3
.config/sketchybar/helper/makefile
Normal file
3
.config/sketchybar/helper/makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
helper: helper.c cpu.h sketchybar.h
|
||||
clang -std=c99 -O3 helper.c -o helper
|
227
.config/sketchybar/helper/sketchybar.h
Normal file
227
.config/sketchybar/helper/sketchybar.h
Normal file
@@ -0,0 +1,227 @@
|
||||
#pragma once
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <mach/message.h>
|
||||
#include <bootstrap.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
typedef char* env;
|
||||
|
||||
#define MACH_HANDLER(name) void name(env env)
|
||||
typedef MACH_HANDLER(mach_handler);
|
||||
|
||||
struct mach_message {
|
||||
mach_msg_header_t header;
|
||||
mach_msg_size_t msgh_descriptor_count;
|
||||
mach_msg_ool_descriptor_t descriptor;
|
||||
};
|
||||
|
||||
struct mach_buffer {
|
||||
struct mach_message message;
|
||||
mach_msg_trailer_t trailer;
|
||||
};
|
||||
|
||||
struct mach_server {
|
||||
bool is_running;
|
||||
mach_port_name_t task;
|
||||
mach_port_t port;
|
||||
mach_port_t bs_port;
|
||||
|
||||
pthread_t thread;
|
||||
mach_handler* handler;
|
||||
};
|
||||
|
||||
static struct mach_server g_mach_server;
|
||||
static mach_port_t g_mach_port = 0;
|
||||
|
||||
static inline char* env_get_value_for_key(env env, char* key) {
|
||||
uint32_t caret = 0;
|
||||
for(;;) {
|
||||
if (!env[caret]) break;
|
||||
if (strcmp(&env[caret], key) == 0)
|
||||
return &env[caret + strlen(&env[caret]) + 1];
|
||||
|
||||
caret += strlen(&env[caret])
|
||||
+ strlen(&env[caret + strlen(&env[caret]) + 1])
|
||||
+ 2;
|
||||
}
|
||||
return (char*)"";
|
||||
}
|
||||
|
||||
static inline mach_port_t mach_get_bs_port() {
|
||||
mach_port_name_t task = mach_task_self();
|
||||
|
||||
mach_port_t bs_port;
|
||||
if (task_get_special_port(task,
|
||||
TASK_BOOTSTRAP_PORT,
|
||||
&bs_port ) != KERN_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
mach_port_t port;
|
||||
if (bootstrap_look_up(bs_port,
|
||||
"git.felix.sketchybar",
|
||||
&port ) != KERN_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
static inline void mach_receive_message(mach_port_t port, struct mach_buffer* buffer, bool timeout) {
|
||||
*buffer = (struct mach_buffer) { 0 };
|
||||
mach_msg_return_t msg_return;
|
||||
if (timeout)
|
||||
msg_return = mach_msg(&buffer->message.header,
|
||||
MACH_RCV_MSG | MACH_RCV_TIMEOUT,
|
||||
0,
|
||||
sizeof(struct mach_buffer),
|
||||
port,
|
||||
100,
|
||||
MACH_PORT_NULL );
|
||||
else
|
||||
msg_return = mach_msg(&buffer->message.header,
|
||||
MACH_RCV_MSG,
|
||||
0,
|
||||
sizeof(struct mach_buffer),
|
||||
port,
|
||||
MACH_MSG_TIMEOUT_NONE,
|
||||
MACH_PORT_NULL );
|
||||
|
||||
if (msg_return != MACH_MSG_SUCCESS) {
|
||||
buffer->message.descriptor.address = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline char* mach_send_message(mach_port_t port, char* message, uint32_t len) {
|
||||
if (!message || !port) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mach_port_t response_port;
|
||||
mach_port_name_t task = mach_task_self();
|
||||
if (mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE,
|
||||
&response_port ) != KERN_SUCCESS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mach_port_insert_right(task, response_port,
|
||||
response_port,
|
||||
MACH_MSG_TYPE_MAKE_SEND)!= KERN_SUCCESS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct mach_message msg = { 0 };
|
||||
msg.header.msgh_remote_port = port;
|
||||
msg.header.msgh_local_port = response_port;
|
||||
msg.header.msgh_id = response_port;
|
||||
msg.header.msgh_bits = MACH_MSGH_BITS_SET(MACH_MSG_TYPE_COPY_SEND,
|
||||
MACH_MSG_TYPE_MAKE_SEND,
|
||||
0,
|
||||
MACH_MSGH_BITS_COMPLEX );
|
||||
|
||||
msg.header.msgh_size = sizeof(struct mach_message);
|
||||
msg.msgh_descriptor_count = 1;
|
||||
msg.descriptor.address = message;
|
||||
msg.descriptor.size = len * sizeof(char);
|
||||
msg.descriptor.copy = MACH_MSG_VIRTUAL_COPY;
|
||||
msg.descriptor.deallocate = false;
|
||||
msg.descriptor.type = MACH_MSG_OOL_DESCRIPTOR;
|
||||
|
||||
mach_msg(&msg.header,
|
||||
MACH_SEND_MSG,
|
||||
sizeof(struct mach_message),
|
||||
0,
|
||||
MACH_PORT_NULL,
|
||||
MACH_MSG_TIMEOUT_NONE,
|
||||
MACH_PORT_NULL );
|
||||
|
||||
struct mach_buffer buffer = { 0 };
|
||||
mach_receive_message(response_port, &buffer, true);
|
||||
if (buffer.message.descriptor.address)
|
||||
return (char*)buffer.message.descriptor.address;
|
||||
mach_msg_destroy(&buffer.message.header);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
static inline bool mach_server_begin(struct mach_server* mach_server, mach_handler handler, char* bootstrap_name) {
|
||||
mach_server->task = mach_task_self();
|
||||
|
||||
if (mach_port_allocate(mach_server->task,
|
||||
MACH_PORT_RIGHT_RECEIVE,
|
||||
&mach_server->port ) != KERN_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mach_port_insert_right(mach_server->task,
|
||||
mach_server->port,
|
||||
mach_server->port,
|
||||
MACH_MSG_TYPE_MAKE_SEND) != KERN_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (task_get_special_port(mach_server->task,
|
||||
TASK_BOOTSTRAP_PORT,
|
||||
&mach_server->bs_port) != KERN_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bootstrap_register(mach_server->bs_port,
|
||||
bootstrap_name,
|
||||
mach_server->port ) != KERN_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mach_server->handler = handler;
|
||||
mach_server->is_running = true;
|
||||
struct mach_buffer buffer;
|
||||
while (mach_server->is_running) {
|
||||
mach_receive_message(mach_server->port, &buffer, false);
|
||||
mach_server->handler((env)buffer.message.descriptor.address);
|
||||
mach_msg_destroy(&buffer.message.header);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
static inline char* sketchybar(char* message) {
|
||||
uint32_t message_length = strlen(message) + 1;
|
||||
char formatted_message[message_length + 1];
|
||||
|
||||
char quote = '\0';
|
||||
uint32_t caret = 0;
|
||||
for (int i = 0; i < message_length; ++i) {
|
||||
if (message[i] == '"' || message[i] == '\'') {
|
||||
if (quote == message[i]) quote = '\0';
|
||||
else quote = message[i];
|
||||
continue;
|
||||
}
|
||||
formatted_message[caret] = message[i];
|
||||
if (message[i] == ' ' && !quote) formatted_message[caret] = '\0';
|
||||
caret++;
|
||||
}
|
||||
|
||||
if (caret > 0 && formatted_message[caret] == '\0'
|
||||
&& formatted_message[caret - 1] == '\0') {
|
||||
caret--;
|
||||
}
|
||||
|
||||
formatted_message[caret] = '\0';
|
||||
if (!g_mach_port) g_mach_port = mach_get_bs_port();
|
||||
char* response = mach_send_message(g_mach_port,
|
||||
formatted_message,
|
||||
caret + 1 );
|
||||
|
||||
if (response) return response;
|
||||
else return (char*)"";
|
||||
}
|
||||
|
||||
static inline void event_server_begin(mach_handler event_handler, char* bootstrap_name) {
|
||||
mach_server_begin(&g_mach_server, event_handler, bootstrap_name);
|
||||
}
|
46
.config/sketchybar/icons.sh
Executable file
46
.config/sketchybar/icons.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# General Icons
|
||||
LOADING=
|
||||
APPLE=
|
||||
PREFERENCES=
|
||||
ACTIVITY=
|
||||
LOCK=
|
||||
BELL=
|
||||
BELL_DOT=
|
||||
|
||||
# Git Icons
|
||||
GIT_ISSUE=
|
||||
GIT_DISCUSSION=
|
||||
GIT_PULL_REQUEST=
|
||||
GIT_COMMIT=
|
||||
GIT_INDICATOR=
|
||||
|
||||
# Spotify Icons
|
||||
SPOTIFY_BACK=
|
||||
SPOTIFY_PLAY_PAUSE=
|
||||
SPOTIFY_NEXT=
|
||||
SPOTIFY_SHUFFLE=
|
||||
SPOTIFY_REPEAT=
|
||||
|
||||
# Yabai Icons
|
||||
YABAI_STACK=
|
||||
YABAI_FULLSCREEN_ZOOM=
|
||||
YABAI_PARENT_ZOOM=
|
||||
YABAI_FLOAT=
|
||||
YABAI_GRID=
|
||||
|
||||
# Battery Icons
|
||||
BATTERY_100=
|
||||
BATTERY_75=
|
||||
BATTERY_50=
|
||||
BATTERY_25=
|
||||
BATTERY_0=
|
||||
BATTERY_CHARGING=
|
||||
|
||||
# Volume Icons
|
||||
VOLUME_100=
|
||||
VOLUME_66=
|
||||
VOLUME_33=
|
||||
VOLUME_10=
|
||||
VOLUME_0=
|
44
.config/sketchybar/items/apple.sh
Executable file
44
.config/sketchybar/items/apple.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
POPUP_OFF='sketchybar --set apple.logo popup.drawing=off'
|
||||
POPUP_CLICK_SCRIPT='sketchybar --set $NAME popup.drawing=toggle'
|
||||
|
||||
apple_logo=(
|
||||
icon=$APPLE
|
||||
icon.font="$FONT:Black:16.0"
|
||||
icon.color=$GREEN
|
||||
padding_right=15
|
||||
label.drawing=off
|
||||
click_script="$POPUP_CLICK_SCRIPT"
|
||||
popup.height=35
|
||||
)
|
||||
|
||||
apple_prefs=(
|
||||
icon=$PREFERENCES
|
||||
label="Preferences"
|
||||
click_script="open -a 'System Preferences'; $POPUP_OFF"
|
||||
)
|
||||
|
||||
apple_activity=(
|
||||
icon=$ACTIVITY
|
||||
label="Activity"
|
||||
click_script="open -a 'Activity Monitor'; $POPUP_OFF"
|
||||
)
|
||||
|
||||
apple_lock=(
|
||||
icon=$LOCK
|
||||
label="Lock Screen"
|
||||
click_script="pmset displaysleepnow; $POPUP_OFF"
|
||||
)
|
||||
|
||||
sketchybar --add item apple.logo left \
|
||||
--set apple.logo "${apple_logo[@]}" \
|
||||
\
|
||||
--add item apple.prefs popup.apple.logo \
|
||||
--set apple.prefs "${apple_prefs[@]}" \
|
||||
\
|
||||
--add item apple.activity popup.apple.logo \
|
||||
--set apple.activity "${apple_activity[@]}" \
|
||||
\
|
||||
--add item apple.lock popup.apple.logo \
|
||||
--set apple.lock "${apple_lock[@]}"
|
15
.config/sketchybar/items/battery.sh
Executable file
15
.config/sketchybar/items/battery.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
battery=(
|
||||
script="$PLUGIN_DIR/battery.sh"
|
||||
icon.font="$FONT:Regular:19.0"
|
||||
padding_right=5
|
||||
padding_left=0
|
||||
label.drawing=off
|
||||
update_freq=120
|
||||
updates=on
|
||||
)
|
||||
|
||||
sketchybar --add item battery right \
|
||||
--set battery "${battery[@]}" \
|
||||
--subscribe battery power_source_change system_woke
|
17
.config/sketchybar/items/brew.sh
Executable file
17
.config/sketchybar/items/brew.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Trigger the brew_udpate event when brew update or upgrade is run from cmdline
|
||||
# e.g. via function in .zshrc
|
||||
|
||||
brew=(
|
||||
icon=
|
||||
label=?
|
||||
padding_right=10
|
||||
script="$PLUGIN_DIR/brew.sh"
|
||||
)
|
||||
|
||||
sketchybar --add event brew_update \
|
||||
--add item brew right \
|
||||
--set brew "${brew[@]}" \
|
||||
--subscribe brew brew_update
|
||||
|
17
.config/sketchybar/items/calendar.sh
Executable file
17
.config/sketchybar/items/calendar.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
calendar=(
|
||||
icon=cal
|
||||
icon.font="$FONT:Black:12.0"
|
||||
icon.padding_right=0
|
||||
label.width=45
|
||||
label.align=right
|
||||
padding_left=15
|
||||
update_freq=30
|
||||
script="$PLUGIN_DIR/calendar.sh"
|
||||
click_script="$PLUGIN_DIR/zen.sh"
|
||||
)
|
||||
|
||||
sketchybar --add item calendar right \
|
||||
--set calendar "${calendar[@]}" \
|
||||
--subscribe calendar system_woke
|
53
.config/sketchybar/items/cpu.sh
Executable file
53
.config/sketchybar/items/cpu.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
cpu_top=(
|
||||
label.font="$FONT:Semibold:7"
|
||||
label=CPU
|
||||
icon.drawing=off
|
||||
width=0
|
||||
padding_right=15
|
||||
y_offset=6
|
||||
)
|
||||
|
||||
cpu_percent=(
|
||||
label.font="$FONT:Heavy:12"
|
||||
label=CPU
|
||||
y_offset=-4
|
||||
padding_right=15
|
||||
width=55
|
||||
icon.drawing=off
|
||||
update_freq=4
|
||||
mach_helper="$HELPER"
|
||||
)
|
||||
|
||||
cpu_sys=(
|
||||
width=0
|
||||
graph.color=$RED
|
||||
graph.fill_color=$RED
|
||||
label.drawing=off
|
||||
icon.drawing=off
|
||||
background.height=30
|
||||
background.drawing=on
|
||||
background.color=$TRANSPARENT
|
||||
)
|
||||
|
||||
cpu_user=(
|
||||
graph.color=$BLUE
|
||||
label.drawing=off
|
||||
icon.drawing=off
|
||||
background.height=30
|
||||
background.drawing=on
|
||||
background.color=$TRANSPARENT
|
||||
)
|
||||
|
||||
sketchybar --add item cpu.top right \
|
||||
--set cpu.top "${cpu_top[@]}" \
|
||||
\
|
||||
--add item cpu.percent right \
|
||||
--set cpu.percent "${cpu_percent[@]}" \
|
||||
\
|
||||
--add graph cpu.sys right 75 \
|
||||
--set cpu.sys "${cpu_sys[@]}" \
|
||||
\
|
||||
--add graph cpu.user right 75 \
|
||||
--set cpu.user "${cpu_user[@]}"
|
30
.config/sketchybar/items/front_app.sh
Executable file
30
.config/sketchybar/items/front_app.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
FRONT_APP_SCRIPT='sketchybar --set $NAME label="$INFO"'
|
||||
|
||||
yabai=(
|
||||
icon.width=0
|
||||
label.width=0
|
||||
script="$PLUGIN_DIR/yabai.sh"
|
||||
icon.font="$FONT:Bold:16.0"
|
||||
associated_display=active
|
||||
)
|
||||
|
||||
front_app=(
|
||||
icon.drawing=off
|
||||
label.font="$FONT:Black:12.0"
|
||||
associated_display=active
|
||||
script="$FRONT_APP_SCRIPT"
|
||||
)
|
||||
|
||||
sketchybar --add event window_focus \
|
||||
--add event windows_on_spaces \
|
||||
--add item yabai left \
|
||||
--set yabai "${yabai[@]}" \
|
||||
--subscribe yabai window_focus \
|
||||
windows_on_spaces \
|
||||
mouse.clicked \
|
||||
\
|
||||
--add item front_app left \
|
||||
--set front_app "${front_app[@]}" \
|
||||
--subscribe front_app front_app_switched
|
33
.config/sketchybar/items/github.sh
Executable file
33
.config/sketchybar/items/github.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
POPUP_CLICK_SCRIPT="sketchybar --set \$NAME popup.drawing=toggle"
|
||||
|
||||
github_bell=(
|
||||
update_freq=180
|
||||
icon=$BELL
|
||||
icon.font="$FONT:Bold:15.0"
|
||||
icon.color=$BLUE
|
||||
label=$LOADING
|
||||
label.highlight_color=$BLUE
|
||||
popup.align=right
|
||||
script="$PLUGIN_DIR/github.sh"
|
||||
click_script="$POPUP_CLICK_SCRIPT"
|
||||
)
|
||||
|
||||
github_template=(
|
||||
drawing=off
|
||||
background.corner_radius=12
|
||||
padding_left=7
|
||||
padding_right=7
|
||||
icon.background.height=2
|
||||
icon.background.y_offset=-12
|
||||
)
|
||||
|
||||
sketchybar --add item github.bell right \
|
||||
--set github.bell "${github_bell[@]}" \
|
||||
--subscribe github.bell mouse.entered \
|
||||
mouse.exited \
|
||||
mouse.exited.global \
|
||||
\
|
||||
--add item github.template popup.github.bell \
|
||||
--set github.template "${github_template[@]}"
|
59
.config/sketchybar/items/spaces.sh
Executable file
59
.config/sketchybar/items/spaces.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15")
|
||||
|
||||
# Destroy space on right click, focus space on left click.
|
||||
# New space by left clicking separator (>)
|
||||
|
||||
sid=0
|
||||
spaces=()
|
||||
for i in "${!SPACE_ICONS[@]}"
|
||||
do
|
||||
sid=$(($i+1))
|
||||
|
||||
space=(
|
||||
associated_space=$sid
|
||||
icon="${SPACE_ICONS[i]}"
|
||||
icon.padding_left=10
|
||||
icon.padding_right=10
|
||||
padding_left=2
|
||||
padding_right=2
|
||||
label.padding_right=20
|
||||
icon.highlight_color=$RED
|
||||
label.color=$GREY
|
||||
label.highlight_color=$WHITE
|
||||
label.font="sketchybar-app-font:Regular:16.0"
|
||||
label.y_offset=-1
|
||||
background.color=$BACKGROUND_1
|
||||
background.border_color=$BACKGROUND_2
|
||||
background.drawing=off
|
||||
label.drawing=off
|
||||
script="$PLUGIN_DIR/space.sh"
|
||||
)
|
||||
|
||||
sketchybar --add space space.$sid left \
|
||||
--set space.$sid "${space[@]}" \
|
||||
--subscribe space.$sid mouse.clicked
|
||||
done
|
||||
|
||||
spaces_bracket=(
|
||||
background.color=$BACKGROUND_1
|
||||
background.border_color=$BACKGROUND_2
|
||||
)
|
||||
|
||||
separator=(
|
||||
icon=
|
||||
icon.font="$FONT:Heavy:16.0"
|
||||
padding_left=10
|
||||
padding_right=8
|
||||
label.drawing=off
|
||||
associated_display=active
|
||||
click_script='yabai -m space --create && sketchybar --trigger space_change'
|
||||
icon.color=$WHITE
|
||||
)
|
||||
|
||||
sketchybar --add bracket spaces_bracket '/space\..*/' \
|
||||
--set spaces_bracket "${spaces_bracket[@]}" \
|
||||
\
|
||||
--add item separator left \
|
||||
--set separator "${separator[@]}"
|
197
.config/sketchybar/items/spotify.sh
Executable file
197
.config/sketchybar/items/spotify.sh
Executable file
@@ -0,0 +1,197 @@
|
||||
#!/bin/bash
|
||||
|
||||
SPOTIFY_EVENT="com.spotify.client.PlaybackStateChanged"
|
||||
POPUP_SCRIPT="sketchybar -m --set spotify.anchor popup.drawing=toggle"
|
||||
|
||||
spotify_anchor=(
|
||||
script="$PLUGIN_DIR/spotify.sh"
|
||||
click_script="$POPUP_SCRIPT"
|
||||
popup.horizontal=on
|
||||
popup.align=center
|
||||
popup.height=150
|
||||
icon=
|
||||
icon.font="$FONT:Regular:25.0"
|
||||
label.drawing=off
|
||||
drawing=off
|
||||
y_offset=2
|
||||
)
|
||||
|
||||
spotify_cover=(
|
||||
script="$PLUGIN_DIR/spotify.sh"
|
||||
click_script="open -a 'Spotify'; $POPUP_SCRIPT"
|
||||
label.drawing=off
|
||||
icon.drawing=off
|
||||
padding_left=12
|
||||
padding_right=10
|
||||
background.image.scale=0.2
|
||||
background.image.drawing=on
|
||||
background.drawing=on
|
||||
)
|
||||
|
||||
spotify_title=(
|
||||
icon.drawing=off
|
||||
padding_left=0
|
||||
padding_right=0
|
||||
width=0
|
||||
label.font="$FONT:Heavy:15.0"
|
||||
y_offset=55
|
||||
)
|
||||
|
||||
spotify_artist=(
|
||||
icon.drawing=off
|
||||
y_offset=30
|
||||
padding_left=0
|
||||
padding_right=0
|
||||
width=0
|
||||
)
|
||||
|
||||
spotify_album=(
|
||||
icon.drawing=off
|
||||
padding_left=0
|
||||
padding_right=0
|
||||
y_offset=15
|
||||
width=0
|
||||
)
|
||||
|
||||
spotify_state=(
|
||||
icon.drawing=on
|
||||
icon.font="$FONT:Light Italic:10.0"
|
||||
icon.width=35
|
||||
icon="00:00"
|
||||
label.drawing=on
|
||||
label.font="$FONT:Light Italic:10.0"
|
||||
label.width=35
|
||||
label="00:00"
|
||||
padding_left=0
|
||||
padding_right=0
|
||||
y_offset=-15
|
||||
width=0
|
||||
slider.background.height=6
|
||||
slider.background.corner_radius=1
|
||||
slider.background.color=$GREY
|
||||
slider.highlight_color=$GREEN
|
||||
slider.percentage=40
|
||||
slider.width=115
|
||||
script="$PLUGIN_DIR/spotify.sh"
|
||||
update_freq=1
|
||||
updates=when_shown
|
||||
)
|
||||
|
||||
spotify_shuffle=(
|
||||
icon=
|
||||
icon.padding_left=5
|
||||
icon.padding_right=5
|
||||
icon.color=$BLACK
|
||||
icon.highlight_color=$GREY
|
||||
label.drawing=off
|
||||
script="$PLUGIN_DIR/spotify.sh"
|
||||
y_offset=-45
|
||||
)
|
||||
|
||||
spotify_back=(
|
||||
icon=
|
||||
icon.padding_left=5
|
||||
icon.padding_right=5
|
||||
icon.color=$BLACK
|
||||
script="$PLUGIN_DIR/spotify.sh"
|
||||
label.drawing=off
|
||||
y_offset=-45
|
||||
)
|
||||
|
||||
spotify_play=(
|
||||
icon=
|
||||
background.height=40
|
||||
background.corner_radius=20
|
||||
width=40
|
||||
align=center
|
||||
background.color=$POPUP_BACKGROUND_COLOR
|
||||
background.border_color=$WHITE
|
||||
background.border_width=0
|
||||
background.drawing=on
|
||||
icon.padding_left=4
|
||||
icon.padding_right=5
|
||||
updates=on
|
||||
label.drawing=off
|
||||
script="$PLUGIN_DIR/spotify.sh"
|
||||
y_offset=-45
|
||||
)
|
||||
|
||||
spotify_next=(
|
||||
icon=
|
||||
icon.padding_left=5
|
||||
icon.padding_right=5
|
||||
icon.color=$BLACK
|
||||
label.drawing=off
|
||||
script="$PLUGIN_DIR/spotify.sh"
|
||||
y_offset=-45
|
||||
)
|
||||
|
||||
spotify_repeat=(
|
||||
icon=
|
||||
icon.highlight_color=$GREY
|
||||
icon.padding_left=5
|
||||
icon.padding_right=10
|
||||
icon.color=$BLACK
|
||||
label.drawing=off
|
||||
script="$PLUGIN_DIR/spotify.sh"
|
||||
y_offset=-45
|
||||
)
|
||||
|
||||
spotify_controls=(
|
||||
background.color=$GREEN
|
||||
background.corner_radius=11
|
||||
background.drawing=on
|
||||
y_offset=-45
|
||||
)
|
||||
|
||||
sketchybar --add event spotify_change $SPOTIFY_EVENT \
|
||||
--add item spotify.anchor center \
|
||||
--set spotify.anchor "${spotify_anchor[@]}" \
|
||||
--subscribe spotify.anchor mouse.entered mouse.exited \
|
||||
mouse.exited.global \
|
||||
\
|
||||
--add item spotify.cover popup.spotify.anchor \
|
||||
--set spotify.cover "${spotify_cover[@]}" \
|
||||
\
|
||||
--add item spotify.title popup.spotify.anchor \
|
||||
--set spotify.title "${spotify_title[@]}" \
|
||||
\
|
||||
--add item spotify.artist popup.spotify.anchor \
|
||||
--set spotify.artist "${spotify_artist[@]}" \
|
||||
\
|
||||
--add item spotify.album popup.spotify.anchor \
|
||||
--set spotify.album "${spotify_album[@]}" \
|
||||
\
|
||||
--add slider spotify.state popup.spotify.anchor \
|
||||
--set spotify.state "${spotify_state[@]}" \
|
||||
--subscribe spotify.state mouse.clicked \
|
||||
\
|
||||
--add item spotify.shuffle popup.spotify.anchor \
|
||||
--set spotify.shuffle "${spotify_shuffle[@]}" \
|
||||
--subscribe spotify.shuffle mouse.clicked \
|
||||
\
|
||||
--add item spotify.back popup.spotify.anchor \
|
||||
--set spotify.back "${spotify_back[@]}" \
|
||||
--subscribe spotify.back mouse.clicked \
|
||||
\
|
||||
--add item spotify.play popup.spotify.anchor \
|
||||
--set spotify.play "${spotify_play[@]}" \
|
||||
--subscribe spotify.play mouse.clicked spotify_change \
|
||||
\
|
||||
--add item spotify.next popup.spotify.anchor \
|
||||
--set spotify.next "${spotify_next[@]}" \
|
||||
--subscribe spotify.next mouse.clicked \
|
||||
\
|
||||
--add item spotify.repeat popup.spotify.anchor \
|
||||
--set spotify.repeat "${spotify_repeat[@]}" \
|
||||
--subscribe spotify.repeat mouse.clicked \
|
||||
\
|
||||
--add item spotify.spacer popup.spotify.anchor \
|
||||
--set spotify.spacer width=5 \
|
||||
\
|
||||
--add bracket spotify.controls spotify.shuffle \
|
||||
spotify.back \
|
||||
spotify.play \
|
||||
spotify.next \
|
||||
spotify.repeat \
|
||||
--set spotify.controls "${spotify_controls[@]}" \
|
45
.config/sketchybar/items/volume.sh
Executable file
45
.config/sketchybar/items/volume.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
volume_slider=(
|
||||
script="$PLUGIN_DIR/volume.sh"
|
||||
updates=on
|
||||
label.drawing=off
|
||||
icon.drawing=off
|
||||
slider.highlight_color=$BLUE
|
||||
slider.background.height=5
|
||||
slider.background.corner_radius=3
|
||||
slider.background.color=$BACKGROUND_2
|
||||
slider.knob=
|
||||
slider.knob.drawing=off
|
||||
)
|
||||
|
||||
volume_icon=(
|
||||
click_script="$PLUGIN_DIR/volume_click.sh"
|
||||
padding_left=10
|
||||
icon=$VOLUME_100
|
||||
icon.width=0
|
||||
icon.align=left
|
||||
icon.color=$GREY
|
||||
icon.font="$FONT:Regular:14.0"
|
||||
label.width=25
|
||||
label.align=left
|
||||
label.font="$FONT:Regular:14.0"
|
||||
)
|
||||
|
||||
status_bracket=(
|
||||
background.color=$BACKGROUND_1
|
||||
background.border_color=$BACKGROUND_2
|
||||
)
|
||||
|
||||
sketchybar --add slider volume right \
|
||||
--set volume "${volume_slider[@]}" \
|
||||
--subscribe volume volume_change \
|
||||
mouse.clicked \
|
||||
mouse.entered \
|
||||
mouse.exited \
|
||||
\
|
||||
--add item volume_icon right \
|
||||
--set volume_icon "${volume_icon[@]}"
|
||||
|
||||
sketchybar --add bracket status brew github.bell volume_icon \
|
||||
--set status "${status_bracket[@]}"
|
33
.config/sketchybar/plugins/battery.sh
Executable file
33
.config/sketchybar/plugins/battery.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "$CONFIG_DIR/icons.sh"
|
||||
source "$CONFIG_DIR/colors.sh"
|
||||
|
||||
BATTERY_INFO="$(pmset -g batt)"
|
||||
PERCENTAGE=$(echo "$BATTERY_INFO" | grep -Eo "\d+%" | cut -d% -f1)
|
||||
CHARGING=$(echo "$BATTERY_INFO" | grep 'AC Power')
|
||||
|
||||
if [ $PERCENTAGE = "" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
DRAWING=on
|
||||
COLOR=$WHITE
|
||||
case ${PERCENTAGE} in
|
||||
9[0-9]|100) ICON=$BATTERY_100; DRAWING=off
|
||||
;;
|
||||
[6-8][0-9]) ICON=$BATTERY_75; DRAWING=off
|
||||
;;
|
||||
[3-5][0-9]) ICON=$BATTERY_50
|
||||
;;
|
||||
[1-2][0-9]) ICON=$BATTERY_25; COLOR=$ORANGE
|
||||
;;
|
||||
*) ICON=$BATTERY_0; COLOR=$RED
|
||||
esac
|
||||
|
||||
if [[ $CHARGING != "" ]]; then
|
||||
ICON=$BATTERY_CHARGING
|
||||
DRAWING=off
|
||||
fi
|
||||
|
||||
sketchybar --set $NAME drawing=$DRAWING icon="$ICON" icon.color=$COLOR
|
21
.config/sketchybar/plugins/brew.sh
Executable file
21
.config/sketchybar/plugins/brew.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "$CONFIG_DIR/colors.sh"
|
||||
|
||||
COUNT=$(brew outdated | wc -l | tr -d ' ')
|
||||
|
||||
COLOR=$RED
|
||||
|
||||
case "$COUNT" in
|
||||
[3-5][0-9]) COLOR=$ORANGE
|
||||
;;
|
||||
[1-2][0-9]) COLOR=$YELLOW
|
||||
;;
|
||||
[1-9]) COLOR=$WHITE
|
||||
;;
|
||||
0) COLOR=$GREEN
|
||||
COUNT=
|
||||
;;
|
||||
esac
|
||||
|
||||
sketchybar --set $NAME label=$COUNT icon.color=$COLOR
|
3
.config/sketchybar/plugins/calendar.sh
Executable file
3
.config/sketchybar/plugins/calendar.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
sketchybar --set $NAME icon="$(date '+%a, %d %b')" label="$(date '+%H:%M')"
|
90
.config/sketchybar/plugins/github.sh
Executable file
90
.config/sketchybar/plugins/github.sh
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
|
||||
update() {
|
||||
source "$CONFIG_DIR/colors.sh"
|
||||
source "$CONFIG_DIR/icons.sh"
|
||||
|
||||
NOTIFICATIONS="$(gh api notifications)"
|
||||
COUNT="$(echo "$NOTIFICATIONS" | jq 'length')"
|
||||
args=()
|
||||
if [ "$NOTIFICATIONS" = "[]" ]; then
|
||||
args+=(--set $NAME icon=$BELL label="0")
|
||||
else
|
||||
args+=(--set $NAME icon=$BELL_DOT label="$COUNT")
|
||||
fi
|
||||
|
||||
PREV_COUNT=$(sketchybar --query github.bell | jq -r .label.value)
|
||||
# For sound to play around with:
|
||||
# afplay /System/Library/Sounds/Morse.aiff
|
||||
|
||||
args+=(--remove '/github.notification\.*/')
|
||||
|
||||
COUNTER=0
|
||||
COLOR=$BLUE
|
||||
args+=(--set github.bell icon.color=$COLOR)
|
||||
|
||||
while read -r repo url type title
|
||||
do
|
||||
COUNTER=$((COUNTER + 1))
|
||||
IMPORTANT="$(echo "$title" | egrep -i "(deprecat|break|broke)")"
|
||||
COLOR=$BLUE
|
||||
PADDING=0
|
||||
|
||||
if [ "${repo}" = "" ] && [ "${title}" = "" ]; then
|
||||
repo="Note"
|
||||
title="No new notifications"
|
||||
fi
|
||||
case "${type}" in
|
||||
"'Issue'") COLOR=$GREEN; ICON=$GIT_ISSUE; URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)"
|
||||
;;
|
||||
"'Discussion'") COLOR=$WHITE; ICON=$GIT_DISCUSSION; URL="https://www.github.com/notifications"
|
||||
;;
|
||||
"'PullRequest'") COLOR=$MAGENTA; ICON=$GIT_PULL_REQUEST; URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)"
|
||||
;;
|
||||
"'Commit'") COLOR=$WHITE; ICON=$GIT_COMMIT; URL="$(gh api "$(echo "${url}" | sed -e "s/^'//" -e "s/'$//")" | jq .html_url)"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$IMPORTANT" != "" ]; then
|
||||
COLOR=$RED
|
||||
ICON=
|
||||
args+=(--set github.bell icon.color=$COLOR)
|
||||
fi
|
||||
|
||||
notification=(
|
||||
label="$(echo "$title" | sed -e "s/^'//" -e "s/'$//")"
|
||||
icon="$ICON $(echo "$repo" | sed -e "s/^'//" -e "s/'$//"):"
|
||||
icon.padding_left="$PADDING"
|
||||
label.padding_right="$PADDING"
|
||||
icon.color=$COLOR
|
||||
position=popup.github.bell
|
||||
icon.background.color=$COLOR
|
||||
drawing=on
|
||||
click_script="open $URL; sketchybar --set github.bell popup.drawing=off"
|
||||
)
|
||||
|
||||
args+=(--clone github.notification.$COUNTER github.template \
|
||||
--set github.notification.$COUNTER "${notification[@]}")
|
||||
done <<< "$(echo "$NOTIFICATIONS" | jq -r '.[] | [.repository.name, .subject.latest_comment_url, .subject.type, .subject.title] | @sh')"
|
||||
|
||||
sketchybar -m "${args[@]}" > /dev/null
|
||||
|
||||
if [ $COUNT -gt $PREV_COUNT ] 2>/dev/null || [ "$SENDER" = "forced" ]; then
|
||||
sketchybar --animate tanh 15 --set github.bell label.y_offset=5 label.y_offset=0
|
||||
fi
|
||||
}
|
||||
|
||||
popup() {
|
||||
sketchybar --set $NAME popup.drawing=$1
|
||||
}
|
||||
|
||||
case "$SENDER" in
|
||||
"routine"|"forced") update
|
||||
;;
|
||||
"mouse.entered") popup on
|
||||
;;
|
||||
"mouse.exited"|"mouse.exited.global") popup off
|
||||
;;
|
||||
"mouse.clicked") popup toggle
|
||||
;;
|
||||
esac
|
384
.config/sketchybar/plugins/icon_map.sh
Executable file
384
.config/sketchybar/plugins/icon_map.sh
Executable file
@@ -0,0 +1,384 @@
|
||||
case $@ in
|
||||
"Brave Browser")
|
||||
icon_result=":brave_browser:"
|
||||
;;
|
||||
"Keyboard Maestro")
|
||||
icon_result=":keyboard_maestro:"
|
||||
;;
|
||||
"Min")
|
||||
icon_result=":min_browser:"
|
||||
;;
|
||||
"Final Cut Pro")
|
||||
icon_result=":final_cut_pro:"
|
||||
;;
|
||||
"FaceTime")
|
||||
icon_result=":face_time:"
|
||||
;;
|
||||
"Affinity Publisher")
|
||||
icon_result=":affinity_publisher:"
|
||||
;;
|
||||
"Messages" | "Nachrichten")
|
||||
icon_result=":messages:"
|
||||
;;
|
||||
"Tweetbot" | "Twitter")
|
||||
icon_result=":twitter:"
|
||||
;;
|
||||
"ClickUp")
|
||||
icon_result=":click_up:"
|
||||
;;
|
||||
"KeePassXC")
|
||||
icon_result=":kee_pass_x_c:"
|
||||
;;
|
||||
"Microsoft Edge")
|
||||
icon_result=":microsoft_edge:"
|
||||
;;
|
||||
"VLC")
|
||||
icon_result=":vlc:"
|
||||
;;
|
||||
"Emacs")
|
||||
icon_result=":emacs:"
|
||||
;;
|
||||
"Thunderbird")
|
||||
icon_result=":thunderbird:"
|
||||
;;
|
||||
"Notes")
|
||||
icon_result=":notes:"
|
||||
;;
|
||||
"Caprine")
|
||||
icon_result=":caprine:"
|
||||
;;
|
||||
"Zulip")
|
||||
icon_result=":zulip:"
|
||||
;;
|
||||
"Spark")
|
||||
icon_result=":spark:"
|
||||
;;
|
||||
"Microsoft To Do" | "Things")
|
||||
icon_result=":things:"
|
||||
;;
|
||||
"DEVONthink 3")
|
||||
icon_result=":devonthink3:"
|
||||
;;
|
||||
"GitHub Desktop")
|
||||
icon_result=":git_hub:"
|
||||
;;
|
||||
"App Store")
|
||||
icon_result=":app_store:"
|
||||
;;
|
||||
"Chromium" | "Google Chrome" | "Google Chrome Canary")
|
||||
icon_result=":google_chrome:"
|
||||
;;
|
||||
"zoom.us")
|
||||
icon_result=":zoom:"
|
||||
;;
|
||||
"MoneyMoney")
|
||||
icon_result=":bank:"
|
||||
;;
|
||||
"Color Picker")
|
||||
icon_result=":color_picker:"
|
||||
;;
|
||||
"Microsoft Word")
|
||||
icon_result=":microsoft_word:"
|
||||
;;
|
||||
"Microsoft Teams")
|
||||
icon_result=":microsoft_teams:"
|
||||
;;
|
||||
"Iris")
|
||||
icon_result=":iris:"
|
||||
;;
|
||||
"WebStorm")
|
||||
icon_result=":web_storm:"
|
||||
;;
|
||||
"Neovide" | "MacVim" | "Vim" | "VimR")
|
||||
icon_result=":vim:"
|
||||
;;
|
||||
"Sublime Text")
|
||||
icon_result=":sublime_text:"
|
||||
;;
|
||||
"PomoDone App")
|
||||
icon_result=":pomodone:"
|
||||
;;
|
||||
"Setapp")
|
||||
icon_result=":setapp:"
|
||||
;;
|
||||
"qutebrowser")
|
||||
icon_result=":qute_browser:"
|
||||
;;
|
||||
"Mattermost")
|
||||
icon_result=":mattermost:"
|
||||
;;
|
||||
"Notability")
|
||||
icon_result=":notability:"
|
||||
;;
|
||||
"WhatsApp")
|
||||
icon_result=":whats_app:"
|
||||
;;
|
||||
"OBS")
|
||||
icon_result=":obsstudio:"
|
||||
;;
|
||||
"Parallels Desktop")
|
||||
icon_result=":parallels:"
|
||||
;;
|
||||
"VMware Fusion")
|
||||
icon_result=":vmware_fusion:"
|
||||
;;
|
||||
"Pine")
|
||||
icon_result=":pine:"
|
||||
;;
|
||||
"Microsoft Excel")
|
||||
icon_result=":microsoft_excel:"
|
||||
;;
|
||||
"Microsoft PowerPoint")
|
||||
icon_result=":microsoft_power_point:"
|
||||
;;
|
||||
"Matlab")
|
||||
icon_result=":matlab:"
|
||||
;;
|
||||
"Numbers")
|
||||
icon_result=":numbers:"
|
||||
;;
|
||||
"Default")
|
||||
icon_result=":default:"
|
||||
;;
|
||||
"Element")
|
||||
icon_result=":element:"
|
||||
;;
|
||||
"Bear")
|
||||
icon_result=":bear:"
|
||||
;;
|
||||
"TeamSpeak 3")
|
||||
icon_result=":team_speak:"
|
||||
;;
|
||||
"Airmail")
|
||||
icon_result=":airmail:"
|
||||
;;
|
||||
"Firefox Developer Edition" | "Firefox Nightly")
|
||||
icon_result=":firefox_developer_edition:"
|
||||
;;
|
||||
"Trello")
|
||||
icon_result=":trello:"
|
||||
;;
|
||||
"TickTick")
|
||||
icon_result=":tick_tick:"
|
||||
;;
|
||||
"Notion")
|
||||
icon_result=":notion:"
|
||||
;;
|
||||
"Live")
|
||||
icon_result=":ableton:"
|
||||
;;
|
||||
"Evernote Legacy")
|
||||
icon_result=":evernote_legacy:"
|
||||
;;
|
||||
"Calendar" | "Fantastical")
|
||||
icon_result=":calendar:"
|
||||
;;
|
||||
"Android Studio")
|
||||
icon_result=":android_studio:"
|
||||
;;
|
||||
"Xcode")
|
||||
icon_result=":xcode:"
|
||||
;;
|
||||
"Slack")
|
||||
icon_result=":slack:"
|
||||
;;
|
||||
"Sequel Pro")
|
||||
icon_result=":sequel_pro:"
|
||||
;;
|
||||
"Bitwarden")
|
||||
icon_result=":bit_warden:"
|
||||
;;
|
||||
"System Preferences" | "System Settings")
|
||||
icon_result=":gear:"
|
||||
;;
|
||||
"Discord" | "Discord Canary" | "Discord PTB")
|
||||
icon_result=":discord:"
|
||||
;;
|
||||
"Vivaldi")
|
||||
icon_result=":vivaldi:"
|
||||
;;
|
||||
"Firefox")
|
||||
icon_result=":firefox:"
|
||||
;;
|
||||
"Skype")
|
||||
icon_result=":skype:"
|
||||
;;
|
||||
"Dropbox")
|
||||
icon_result=":dropbox:"
|
||||
;;
|
||||
"微信")
|
||||
icon_result=":wechat:"
|
||||
;;
|
||||
"Typora")
|
||||
icon_result=":text:"
|
||||
;;
|
||||
"Blender")
|
||||
icon_result=":blender:"
|
||||
;;
|
||||
"Canary Mail" | "HEY" | "Mail" | "Mailspring" | "MailMate" | "邮件" | "Outlook")
|
||||
icon_result=":mail:"
|
||||
;;
|
||||
"Safari" | "Safari Technology Preview")
|
||||
icon_result=":safari:"
|
||||
;;
|
||||
"Telegram")
|
||||
icon_result=":telegram:"
|
||||
;;
|
||||
"Keynote")
|
||||
icon_result=":keynote:"
|
||||
;;
|
||||
"Reeder")
|
||||
icon_result=":reeder5:"
|
||||
;;
|
||||
"Spotify")
|
||||
icon_result=":spotify:"
|
||||
;;
|
||||
"MAMP" | "MAMP PRO")
|
||||
icon_result=":mamp:"
|
||||
;;
|
||||
"Figma")
|
||||
icon_result=":figma:"
|
||||
;;
|
||||
"Joplin")
|
||||
icon_result=":joplin:"
|
||||
;;
|
||||
"Spotlight")
|
||||
icon_result=":spotlight:"
|
||||
;;
|
||||
"Music")
|
||||
icon_result=":music:"
|
||||
;;
|
||||
"Insomnia")
|
||||
icon_result=":insomnia:"
|
||||
;;
|
||||
"TIDAL")
|
||||
icon_result=":tidal:"
|
||||
;;
|
||||
"Alfred")
|
||||
icon_result=":alfred:"
|
||||
;;
|
||||
"Pages")
|
||||
icon_result=":pages:"
|
||||
;;
|
||||
"Folx")
|
||||
icon_result=":folx:"
|
||||
;;
|
||||
"Android Messages")
|
||||
icon_result=":android_messages:"
|
||||
;;
|
||||
"mpv")
|
||||
icon_result=":mpv:"
|
||||
;;
|
||||
"网易云音乐")
|
||||
icon_result=":netease_music:"
|
||||
;;
|
||||
"Transmit")
|
||||
icon_result=":transmit:"
|
||||
;;
|
||||
"Pi-hole Remote")
|
||||
icon_result=":pihole:"
|
||||
;;
|
||||
"Nova")
|
||||
icon_result=":nova:"
|
||||
;;
|
||||
"Affinity Designer")
|
||||
icon_result=":affinity_designer:"
|
||||
;;
|
||||
"IntelliJ IDEA")
|
||||
icon_result=":idea:"
|
||||
;;
|
||||
"Drafts")
|
||||
icon_result=":drafts:"
|
||||
;;
|
||||
"Audacity")
|
||||
icon_result=":audacity:"
|
||||
;;
|
||||
"Affinity Photo")
|
||||
icon_result=":affinity_photo:"
|
||||
;;
|
||||
"Atom")
|
||||
icon_result=":atom:"
|
||||
;;
|
||||
"Obsidian")
|
||||
icon_result=":obsidian:"
|
||||
;;
|
||||
"CleanMyMac X")
|
||||
icon_result=":desktop:"
|
||||
;;
|
||||
"Zotero")
|
||||
icon_result=":zotero:"
|
||||
;;
|
||||
"Todoist")
|
||||
icon_result=":todoist:"
|
||||
;;
|
||||
"LibreWolf")
|
||||
icon_result=":libre_wolf:"
|
||||
;;
|
||||
"Grammarly Editor")
|
||||
icon_result=":grammarly:"
|
||||
;;
|
||||
"OmniFocus")
|
||||
icon_result=":omni_focus:"
|
||||
;;
|
||||
"Reminders")
|
||||
icon_result=":reminders:"
|
||||
;;
|
||||
"Preview" | "Skim" | "zathura")
|
||||
icon_result=":pdf:"
|
||||
;;
|
||||
"1Password 7")
|
||||
icon_result=":one_password:"
|
||||
;;
|
||||
"Code" | "Code - Insiders")
|
||||
icon_result=":code:"
|
||||
;;
|
||||
"VSCodium")
|
||||
icon_result=":vscodium:"
|
||||
;;
|
||||
"Tower")
|
||||
icon_result=":tower:"
|
||||
;;
|
||||
"Calibre")
|
||||
icon_result=":book:"
|
||||
;;
|
||||
"Finder" | "访达")
|
||||
icon_result=":finder:"
|
||||
;;
|
||||
"Linear")
|
||||
icon_result=":linear:"
|
||||
;;
|
||||
"League of Legends")
|
||||
icon_result=":league_of_legends:"
|
||||
;;
|
||||
"Zeplin")
|
||||
icon_result=":zeplin:"
|
||||
;;
|
||||
"Signal")
|
||||
icon_result=":signal:"
|
||||
;;
|
||||
"Podcasts")
|
||||
icon_result=":podcasts:"
|
||||
;;
|
||||
"Alacritty" | "Hyper" | "iTerm2" | "kitty" | "Terminal" | "WezTerm")
|
||||
icon_result=":terminal:"
|
||||
;;
|
||||
"Tor Browser")
|
||||
icon_result=":tor_browser:"
|
||||
;;
|
||||
"Kakoune")
|
||||
icon_result=":kakoune:"
|
||||
;;
|
||||
"GrandTotal" | "Receipts")
|
||||
icon_result=":dollar:"
|
||||
;;
|
||||
"Sketch")
|
||||
icon_result=":sketch:"
|
||||
;;
|
||||
"Sequel Ace")
|
||||
icon_result=":sequel_ace:"
|
||||
;;
|
||||
*)
|
||||
icon_result=":default:"
|
||||
;;
|
||||
esac
|
||||
echo $icon_result
|
28
.config/sketchybar/plugins/space.sh
Executable file
28
.config/sketchybar/plugins/space.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
update() {
|
||||
source "$CONFIG_DIR/colors.sh"
|
||||
COLOR=$BACKGROUND_2
|
||||
if [ "$SELECTED" = "true" ]; then
|
||||
COLOR=$GREY
|
||||
fi
|
||||
sketchybar --set $NAME icon.highlight=$SELECTED \
|
||||
label.highlight=$SELECTED \
|
||||
background.border_color=$COLOR
|
||||
}
|
||||
|
||||
mouse_clicked() {
|
||||
if [ "$BUTTON" = "right" ]; then
|
||||
yabai -m space --destroy $SID
|
||||
sketchybar --trigger windows_on_spaces --trigger space_change
|
||||
else
|
||||
yabai -m space --focus $SID 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
case "$SENDER" in
|
||||
"mouse.clicked") mouse_clicked
|
||||
;;
|
||||
*) update
|
||||
;;
|
||||
esac
|
147
.config/sketchybar/plugins/spotify.sh
Executable file
147
.config/sketchybar/plugins/spotify.sh
Executable file
@@ -0,0 +1,147 @@
|
||||
#!/bin/bash
|
||||
|
||||
next ()
|
||||
{
|
||||
osascript -e 'tell application "Spotify" to play next track'
|
||||
}
|
||||
|
||||
back ()
|
||||
{
|
||||
osascript -e 'tell application "Spotify" to play previous track'
|
||||
}
|
||||
|
||||
play ()
|
||||
{
|
||||
osascript -e 'tell application "Spotify" to playpause'
|
||||
}
|
||||
|
||||
repeat ()
|
||||
{
|
||||
REPEAT=$(osascript -e 'tell application "Spotify" to get repeating')
|
||||
if [ "$REPEAT" = "false" ]; then
|
||||
sketchybar -m --set spotify.repeat icon.highlight=on
|
||||
osascript -e 'tell application "Spotify" to set repeating to true'
|
||||
else
|
||||
sketchybar -m --set spotify.repeat icon.highlight=off
|
||||
osascript -e 'tell application "Spotify" to set repeating to false'
|
||||
fi
|
||||
}
|
||||
|
||||
shuffle ()
|
||||
{
|
||||
SHUFFLE=$(osascript -e 'tell application "Spotify" to get shuffling')
|
||||
if [ "$SHUFFLE" = "false" ]; then
|
||||
sketchybar -m --set spotify.shuffle icon.highlight=on
|
||||
osascript -e 'tell application "Spotify" to set shuffling to true'
|
||||
else
|
||||
sketchybar -m --set spotify.shuffle icon.highlight=off
|
||||
osascript -e 'tell application "Spotify" to set shuffling to false'
|
||||
fi
|
||||
}
|
||||
|
||||
update ()
|
||||
{
|
||||
PLAYING=1
|
||||
if [ "$(echo "$INFO" | jq -r '.["Player State"]')" = "Playing" ]; then
|
||||
PLAYING=0
|
||||
TRACK="$(echo "$INFO" | jq -r .Name | sed 's/\(.\{20\}\).*/\1.../')"
|
||||
ARTIST="$(echo "$INFO" | jq -r .Artist | sed 's/\(.\{20\}\).*/\1.../')"
|
||||
ALBUM="$(echo "$INFO" | jq -r .Album | sed 's/\(.\{25\}\).*/\1.../')"
|
||||
SHUFFLE=$(osascript -e 'tell application "Spotify" to get shuffling')
|
||||
REPEAT=$(osascript -e 'tell application "Spotify" to get repeating')
|
||||
COVER=$(osascript -e 'tell application "Spotify" to get artwork url of current track')
|
||||
fi
|
||||
|
||||
args=()
|
||||
if [ $PLAYING -eq 0 ]; then
|
||||
curl -s --max-time 20 "$COVER" -o /tmp/cover.jpg
|
||||
if [ "$ARTIST" == "" ]; then
|
||||
args+=(--set spotify.title label="$TRACK"
|
||||
--set spotify.album label="Podcast"
|
||||
--set spotify.artist label="$ALBUM" )
|
||||
else
|
||||
args+=(--set spotify.title label="$TRACK"
|
||||
--set spotify.album label="$ALBUM"
|
||||
--set spotify.artist label="$ARTIST")
|
||||
fi
|
||||
args+=(--set spotify.play icon=
|
||||
--set spotify.shuffle icon.highlight=$SHUFFLE
|
||||
--set spotify.repeat icon.highlight=$REPEAT
|
||||
--set spotify.cover background.image="/tmp/cover.jpg"
|
||||
background.color=0x00000000
|
||||
--set spotify.anchor drawing=on )
|
||||
else
|
||||
args+=(--set spotify.anchor drawing=off popup.drawing=off
|
||||
--set spotify.play icon= )
|
||||
fi
|
||||
sketchybar -m "${args[@]}"
|
||||
}
|
||||
|
||||
scrubbing() {
|
||||
DURATION_MS=$(osascript -e 'tell application "Spotify" to get duration of current track')
|
||||
DURATION=$((DURATION_MS/1000))
|
||||
|
||||
TARGET=$((DURATION*PERCENTAGE/100))
|
||||
osascript -e "tell application \"Spotify\" to set player position to $TARGET"
|
||||
sketchybar --set spotify.state slider.percentage=$PERCENTAGE
|
||||
}
|
||||
|
||||
scroll() {
|
||||
DURATION_MS=$(osascript -e 'tell application "Spotify" to get duration of current track')
|
||||
DURATION=$((DURATION_MS/1000))
|
||||
|
||||
FLOAT="$(osascript -e 'tell application "Spotify" to get player position')"
|
||||
TIME=${FLOAT%.*}
|
||||
|
||||
sketchybar --animate linear 10 \
|
||||
--set spotify.state slider.percentage="$((TIME*100/DURATION))" \
|
||||
icon="$(date -r $TIME +'%M:%S')" \
|
||||
label="$(date -r $DURATION +'%M:%S')"
|
||||
}
|
||||
|
||||
mouse_clicked () {
|
||||
case "$NAME" in
|
||||
"spotify.next") next
|
||||
;;
|
||||
"spotify.back") back
|
||||
;;
|
||||
"spotify.play") play
|
||||
;;
|
||||
"spotify.shuffle") shuffle
|
||||
;;
|
||||
"spotify.repeat") repeat
|
||||
;;
|
||||
"spotify.state") scrubbing
|
||||
;;
|
||||
*) exit
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
popup () {
|
||||
sketchybar --set spotify.anchor popup.drawing=$1
|
||||
}
|
||||
|
||||
routine() {
|
||||
case "$NAME" in
|
||||
"spotify.state") scroll
|
||||
;;
|
||||
*) update
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "$SENDER" in
|
||||
"mouse.clicked") mouse_clicked
|
||||
;;
|
||||
"mouse.entered") popup on
|
||||
;;
|
||||
"mouse.exited"|"mouse.exited.global") popup off
|
||||
;;
|
||||
"routine") routine
|
||||
;;
|
||||
"forced") exit 0
|
||||
;;
|
||||
*) update
|
||||
;;
|
||||
esac
|
56
.config/sketchybar/plugins/volume.sh
Executable file
56
.config/sketchybar/plugins/volume.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
WIDTH=100
|
||||
|
||||
volume_change() {
|
||||
source "$CONFIG_DIR/icons.sh"
|
||||
case $INFO in
|
||||
[6-9][0-9]|100) ICON=$VOLUME_100
|
||||
;;
|
||||
[3-5][0-9]) ICON=$VOLUME_66
|
||||
;;
|
||||
[1-2][0-9]) ICON=$VOLUME_33
|
||||
;;
|
||||
[1-9]) ICON=$VOLUME_10
|
||||
;;
|
||||
0) ICON=$VOLUME_0
|
||||
;;
|
||||
*) ICON=$VOLUME_100
|
||||
esac
|
||||
|
||||
sketchybar --set volume_icon label=$ICON
|
||||
|
||||
sketchybar --set $NAME slider.percentage=$INFO \
|
||||
--animate tanh 30 --set $NAME slider.width=$WIDTH
|
||||
|
||||
sleep 2
|
||||
|
||||
# Check wether the volume was changed another time while sleeping
|
||||
FINAL_PERCENTAGE=$(sketchybar --query $NAME | jq -r ".slider.percentage")
|
||||
if [ "$FINAL_PERCENTAGE" -eq "$INFO" ]; then
|
||||
sketchybar --animate tanh 30 --set $NAME slider.width=0
|
||||
fi
|
||||
}
|
||||
|
||||
mouse_clicked() {
|
||||
osascript -e "set volume output volume $PERCENTAGE"
|
||||
}
|
||||
|
||||
mouse_entered() {
|
||||
sketchybar --set $NAME slider.knob.drawing=on
|
||||
}
|
||||
|
||||
mouse_exited() {
|
||||
sketchybar --set $NAME slider.knob.drawing=off
|
||||
}
|
||||
|
||||
case "$SENDER" in
|
||||
"volume_change") volume_change
|
||||
;;
|
||||
"mouse.clicked") mouse_clicked
|
||||
;;
|
||||
"mouse.entered") mouse_entered
|
||||
;;
|
||||
"mouse.exited") mouse_exited
|
||||
;;
|
||||
esac
|
48
.config/sketchybar/plugins/volume_click.sh
Executable file
48
.config/sketchybar/plugins/volume_click.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
WIDTH=100
|
||||
|
||||
detail_on() {
|
||||
sketchybar --animate tanh 30 --set volume slider.width=$WIDTH
|
||||
}
|
||||
|
||||
detail_off() {
|
||||
sketchybar --animate tanh 30 --set volume slider.width=0
|
||||
}
|
||||
|
||||
toggle_detail() {
|
||||
INITIAL_WIDTH=$(sketchybar --query volume | jq -r ".slider.width")
|
||||
if [ "$INITIAL_WIDTH" -eq "0" ]; then
|
||||
detail_on
|
||||
else
|
||||
detail_off
|
||||
fi
|
||||
}
|
||||
|
||||
toggle_devices() {
|
||||
which SwitchAudioSource >/dev/null || exit 0
|
||||
source "$CONFIG_DIR/colors.sh"
|
||||
|
||||
args=(--remove '/volume.device\.*/' --set "$NAME" popup.drawing=toggle)
|
||||
COUNTER=0
|
||||
CURRENT="$(SwitchAudioSource -t output -c)"
|
||||
while IFS= read -r device; do
|
||||
COLOR=$GREY
|
||||
if [ "${device}" = "$CURRENT" ]; then
|
||||
COLOR=$WHITE
|
||||
fi
|
||||
args+=(--add item volume.device.$COUNTER popup."$NAME" \
|
||||
--set volume.device.$COUNTER label="${device}" \
|
||||
label.color="$COLOR" \
|
||||
click_script="SwitchAudioSource -s \"${device}\" && sketchybar --set /volume.device\.*/ label.color=$GREY --set \$NAME label.color=$WHITE --set $NAME popup.drawing=off")
|
||||
COUNTER=$((COUNTER+1))
|
||||
done <<< "$(SwitchAudioSource -a -t output)"
|
||||
|
||||
sketchybar -m "${args[@]}" > /dev/null
|
||||
}
|
||||
|
||||
if [ "$BUTTON" = "right" ] || [ "$MODIFIER" = "shift" ]; then
|
||||
toggle_devices
|
||||
else
|
||||
toggle_detail
|
||||
fi
|
80
.config/sketchybar/plugins/yabai.sh
Executable file
80
.config/sketchybar/plugins/yabai.sh
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
|
||||
window_state() {
|
||||
source "$CONFIG_DIR/colors.sh"
|
||||
source "$CONFIG_DIR/icons.sh"
|
||||
|
||||
WINDOW=$(yabai -m query --windows --window)
|
||||
STACK_INDEX=$(echo "$WINDOW" | jq '.["stack-index"]')
|
||||
|
||||
COLOR=$BAR_BORDER_COLOR
|
||||
ICON=""
|
||||
|
||||
if [ "$(echo "$WINDOW" | jq '.["is-floating"]')" = "true" ]; then
|
||||
ICON+=$YABAI_FLOAT
|
||||
COLOR=$MAGENTA
|
||||
elif [ "$(echo "$WINDOW" | jq '.["has-fullscreen-zoom"]')" = "true" ]; then
|
||||
ICON+=$YABAI_FULLSCREEN_ZOOM
|
||||
COLOR=$GREEN
|
||||
elif [ "$(echo "$WINDOW" | jq '.["has-parent-zoom"]')" = "true" ]; then
|
||||
ICON+=$YABAI_PARENT_ZOOM
|
||||
COLOR=$BLUE
|
||||
elif [[ $STACK_INDEX -gt 0 ]]; then
|
||||
LAST_STACK_INDEX=$(yabai -m query --windows --window stack.last | jq '.["stack-index"]')
|
||||
ICON+=$YABAI_STACK
|
||||
LABEL="$(printf "[%s/%s]" "$STACK_INDEX" "$LAST_STACK_INDEX")"
|
||||
COLOR=$RED
|
||||
fi
|
||||
|
||||
args=(--animate sin 10 --bar border_color=$COLOR
|
||||
--set $NAME icon.color=$COLOR)
|
||||
|
||||
[ -z "$LABEL" ] && args+=(label.width=0) \
|
||||
|| args+=(label="$LABEL" label.width=40)
|
||||
|
||||
[ -z "$ICON" ] && args+=(icon.width=0) \
|
||||
|| args+=(icon="$ICON" icon.width=30)
|
||||
|
||||
sketchybar -m "${args[@]}"
|
||||
}
|
||||
|
||||
windows_on_spaces () {
|
||||
CURRENT_SPACES="$(yabai -m query --displays | jq -r '.[].spaces | @sh')"
|
||||
|
||||
args=(--set spaces_bracket drawing=off
|
||||
--set '/space\..*/' background.drawing=on
|
||||
--animate sin 10)
|
||||
|
||||
while read -r line
|
||||
do
|
||||
for space in $line
|
||||
do
|
||||
icon_strip=" "
|
||||
apps=$(yabai -m query --windows --space $space | jq -r ".[].app")
|
||||
if [ "$apps" != "" ]; then
|
||||
while IFS= read -r app; do
|
||||
icon_strip+=" $($CONFIG_DIR/plugins/icon_map.sh "$app")"
|
||||
done <<< "$apps"
|
||||
fi
|
||||
args+=(--set space.$space label="$icon_strip" label.drawing=on)
|
||||
done
|
||||
done <<< "$CURRENT_SPACES"
|
||||
|
||||
sketchybar -m "${args[@]}"
|
||||
}
|
||||
|
||||
mouse_clicked() {
|
||||
yabai -m window --toggle float
|
||||
window_state
|
||||
}
|
||||
|
||||
case "$SENDER" in
|
||||
"mouse.clicked") mouse_clicked
|
||||
;;
|
||||
"forced") exit 0
|
||||
;;
|
||||
"window_focus") window_state
|
||||
;;
|
||||
"windows_on_spaces") windows_on_spaces
|
||||
;;
|
||||
esac
|
39
.config/sketchybar/plugins/zen.sh
Executable file
39
.config/sketchybar/plugins/zen.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
zen_on() {
|
||||
sketchybar --set github.bell drawing=off \
|
||||
--set apple.logo drawing=off \
|
||||
--set '/cpu.*/' drawing=off \
|
||||
--set calendar icon.drawing=off \
|
||||
--set separator drawing=off \
|
||||
--set front_app drawing=off \
|
||||
--set volume_icon drawing=off \
|
||||
--set spotify.anchor drawing=off \
|
||||
--set spotify.play updates=off \
|
||||
--set brew drawing=off
|
||||
}
|
||||
|
||||
zen_off() {
|
||||
sketchybar --set github.bell drawing=on \
|
||||
--set apple.logo drawing=on \
|
||||
--set '/cpu.*/' drawing=on \
|
||||
--set calendar icon.drawing=on \
|
||||
--set separator drawing=on \
|
||||
--set front_app drawing=on \
|
||||
--set volume_icon drawing=on \
|
||||
--set spotify.play updates=on \
|
||||
--set brew drawing=on
|
||||
}
|
||||
|
||||
if [ "$1" = "on" ]; then
|
||||
zen_on
|
||||
elif [ "$1" = "off" ]; then
|
||||
zen_off
|
||||
else
|
||||
if [ "$(sketchybar --query apple.logo | jq -r ".geometry.drawing")" = "on" ]; then
|
||||
zen_on
|
||||
else
|
||||
zen_off
|
||||
fi
|
||||
fi
|
||||
|
83
.config/sketchybar/sketchybarrc
Executable file
83
.config/sketchybar/sketchybarrc
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "$CONFIG_DIR/colors.sh" # Loads all defined colors
|
||||
source "$CONFIG_DIR/icons.sh" # Loads all defined icons
|
||||
|
||||
ITEM_DIR="$CONFIG_DIR/items" # Directory where the items are configured
|
||||
PLUGIN_DIR="$CONFIG_DIR/plugins" # Directory where all the plugin scripts are stored
|
||||
|
||||
FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants
|
||||
PADDINGS=3 # All paddings use this value (icon, label, background)
|
||||
|
||||
# Setting up and starting the helper process
|
||||
HELPER=git.felix.helper
|
||||
killall helper
|
||||
(cd $CONFIG_DIR/helper && make)
|
||||
$CONFIG_DIR/helper/helper $HELPER > /dev/null 2>&1 &
|
||||
|
||||
# Unload the macOS on screen indicator overlay for volume change
|
||||
launchctl unload -F /System/Library/LaunchAgents/com.apple.OSDUIHelper.plist > /dev/null 2>&1 &
|
||||
|
||||
# Setting up the general bar appearance of the bar
|
||||
bar=(
|
||||
height=45
|
||||
color=$BAR_COLOR
|
||||
border_width=2
|
||||
border_color=$BAR_BORDER_COLOR
|
||||
shadow=off
|
||||
position=top
|
||||
sticky=on
|
||||
padding_right=10
|
||||
padding_left=10
|
||||
y_offset=-5
|
||||
margin=-2
|
||||
)
|
||||
|
||||
sketchybar --bar "${bar[@]}"
|
||||
|
||||
# Setting up default values
|
||||
defaults=(
|
||||
updates=when_shown
|
||||
icon.font="$FONT:Bold:14.0"
|
||||
icon.color=$ICON_COLOR
|
||||
icon.padding_left=$PADDINGS
|
||||
icon.padding_right=$PADDINGS
|
||||
label.font="$FONT:Semibold:13.0"
|
||||
label.color=$LABEL_COLOR
|
||||
label.padding_left=$PADDINGS
|
||||
label.padding_right=$PADDINGS
|
||||
padding_right=$PADDINGS
|
||||
padding_left=$PADDINGS
|
||||
background.height=26
|
||||
background.corner_radius=9
|
||||
background.border_width=2
|
||||
popup.background.border_width=2
|
||||
popup.background.corner_radius=9
|
||||
popup.background.border_color=$POPUP_BORDER_COLOR
|
||||
popup.background.color=$POPUP_BACKGROUND_COLOR
|
||||
popup.blur_radius=20
|
||||
popup.background.shadow.drawing=on
|
||||
)
|
||||
|
||||
sketchybar --default "${defaults[@]}"
|
||||
|
||||
# Left
|
||||
source $ITEM_DIR/apple.sh
|
||||
source $ITEM_DIR/spaces.sh
|
||||
source $ITEM_DIR/front_app.sh
|
||||
|
||||
# Center
|
||||
source "$ITEM_DIR/spotify.sh"
|
||||
|
||||
# Right
|
||||
source "$ITEM_DIR/calendar.sh"
|
||||
source "$ITEM_DIR/brew.sh"
|
||||
source "$ITEM_DIR/github.sh"
|
||||
source "$ITEM_DIR/battery.sh"
|
||||
source "$ITEM_DIR/volume.sh"
|
||||
source "$ITEM_DIR/cpu.sh"
|
||||
|
||||
# Forcing all item scripts to run (never do this outside of sketchybarrc)
|
||||
sketchybar --update
|
||||
|
||||
echo "sketchybar configuation loaded.."
|
Reference in New Issue
Block a user