feat: add sketchybar
This commit is contained in:
parent
8eb9060941
commit
af1e65700a
@ -1,5 +1,6 @@
|
||||
{{ if ne .chezmoi.os "darwin" }}
|
||||
Library/
|
||||
.config/sketchybar
|
||||
{{ end }}
|
||||
{{ if ne .chezmoi.os "linux" }}
|
||||
.config/hyfetch.json
|
||||
|
||||
57
private_dot_config/sketchybar/executable_sketchybarrc
Normal file
57
private_dot_config/sketchybar/executable_sketchybarrc
Normal file
@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source "$HOME/.config/sketchybar/variables.sh" # Loads all defined colors
|
||||
|
||||
# General bar and defaults
|
||||
|
||||
sketchybar --bar height=30 \
|
||||
color="$BAR_COLOR" \
|
||||
shadow="$SHADOW" \
|
||||
position=top \
|
||||
sticky=on \
|
||||
padding_right=0 \
|
||||
padding_left=3 \
|
||||
corner_radius="$CORNER_RADIUS" \
|
||||
y_offset=1 \
|
||||
margin=5 \
|
||||
blur_radius=20 \
|
||||
notch_width=200 \
|
||||
--default updates=when_shown \
|
||||
icon.font="$FONT:Bold:13.5" \
|
||||
icon.color="$ICON_COLOR" \
|
||||
icon.padding_left="$PADDINGS" \
|
||||
icon.padding_right="$PADDINGS" \
|
||||
label.font="$FONT:Bold:13.0" \
|
||||
label.color="$LABEL_COLOR" \
|
||||
label.padding_left="$PADDINGS" \
|
||||
label.padding_right="$PADDINGS" \
|
||||
background.padding_right="$PADDINGS" \
|
||||
background.padding_left="$PADDINGS" \
|
||||
popup.background.border_width=1 \
|
||||
popup.background.corner_radius=11 \
|
||||
popup.background.border_color="$POPUP_BORDER_COLOR" \
|
||||
popup.background.color="$POPUP_BACKGROUND_COLOR" \
|
||||
popup.background.shadow.drawing="$SHADOW"
|
||||
|
||||
# Left
|
||||
# source "$ITEM_DIR/apple.sh"
|
||||
source "$ITEM_DIR/spaces.sh"
|
||||
source "$ITEM_DIR/front_app.sh"
|
||||
|
||||
# Center (of notch)
|
||||
source "$ITEM_DIR/spotify.sh"
|
||||
|
||||
# Right
|
||||
source "$ITEM_DIR/clock.sh"
|
||||
source "$ITEM_DIR/calendar.sh"
|
||||
source "$ITEM_DIR/battery.sh"
|
||||
source "$ITEM_DIR/volume.sh"
|
||||
source "$ITEM_DIR/cpu.sh"
|
||||
|
||||
#################### Finalizing Setup ####################
|
||||
|
||||
sketchybar --hotload true
|
||||
|
||||
sketchybar --update
|
||||
|
||||
echo "sketchybar configuration loaded.."
|
||||
20
private_dot_config/sketchybar/items/battery.sh
Normal file
20
private_dot_config/sketchybar/items/battery.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$CYAN"
|
||||
|
||||
sketchybar --add item battery right \
|
||||
--set battery \
|
||||
update_freq=60 \
|
||||
icon.color="$COLOR" \
|
||||
icon.padding_left=10 \
|
||||
label.padding_right=10 \
|
||||
label.color="$COLOR" \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.padding_right=5 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/power.sh" \
|
||||
--subscribe battery power_source_change
|
||||
18
private_dot_config/sketchybar/items/calendar.sh
Normal file
18
private_dot_config/sketchybar/items/calendar.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$BLUE"
|
||||
|
||||
sketchybar --add item calendar right \
|
||||
--set calendar update_freq=15 \
|
||||
icon.color="$COLOR" \
|
||||
icon.padding_left=10 \
|
||||
label.color="$COLOR" \
|
||||
label.padding_right=10 \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.padding_right=5 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/calendar.sh"
|
||||
21
private_dot_config/sketchybar/items/clock.sh
Normal file
21
private_dot_config/sketchybar/items/clock.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$MAGENTA"
|
||||
|
||||
sketchybar --add item clock right \
|
||||
--set clock update_freq=1 \
|
||||
icon.padding_left=10 \
|
||||
icon.color="$COLOR" \
|
||||
icon="" \
|
||||
label.color="$COLOR" \
|
||||
label.padding_right=5 \
|
||||
label.width=78 \
|
||||
align=center \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.padding_right=2 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/clock.sh"
|
||||
19
private_dot_config/sketchybar/items/cpu.sh
Normal file
19
private_dot_config/sketchybar/items/cpu.sh
Normal file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$YELLOW"
|
||||
|
||||
sketchybar --add item cpu right \
|
||||
--set cpu \
|
||||
update_freq=3 \
|
||||
icon.color="$COLOR" \
|
||||
icon.padding_left=10 \
|
||||
label.color="$COLOR" \
|
||||
label.padding_right=10 \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.padding_right=5 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/cpu.sh"
|
||||
20
private_dot_config/sketchybar/items/front_app.sh
Normal file
20
private_dot_config/sketchybar/items/front_app.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$WHITE"
|
||||
|
||||
sketchybar \
|
||||
--add item front_app left \
|
||||
--set front_app script="$PLUGIN_DIR/front_app.sh" \
|
||||
icon.drawing=off \
|
||||
background.height=26 \
|
||||
background.padding_left=0 \
|
||||
background.padding_right=10 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.color="$BAR_COLOR" \
|
||||
label.color="$COLOR" \
|
||||
label.padding_left=10 \
|
||||
label.padding_right=10 \
|
||||
associated_display=active \
|
||||
--subscribe front_app front_app_switched
|
||||
44
private_dot_config/sketchybar/items/spaces.sh
Normal file
44
private_dot_config/sketchybar/items/spaces.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10")
|
||||
|
||||
sketchybar --add item spacer.1 left \
|
||||
--set spacer.1 background.drawing=off \
|
||||
label.drawing=off \
|
||||
icon.drawing=off \
|
||||
width=10
|
||||
|
||||
for i in {0..9}; do
|
||||
sid=$((i + 1))
|
||||
sketchybar --add space space.$sid left \
|
||||
--set space.$sid associated_space=$sid \
|
||||
label.drawing=off \
|
||||
icon.padding_left=10 \
|
||||
icon.padding_right=10 \
|
||||
background.padding_left=-5 \
|
||||
background.padding_right=-5 \
|
||||
script="$PLUGIN_DIR/space.sh"
|
||||
done
|
||||
|
||||
sketchybar --add item spacer.2 left \
|
||||
--set spacer.2 background.drawing=off \
|
||||
label.drawing=off \
|
||||
icon.drawing=off \
|
||||
width=5
|
||||
|
||||
sketchybar --add bracket spaces '/space.*/' \
|
||||
--set spaces background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$RED" \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.height=26 \
|
||||
background.drawing=on
|
||||
|
||||
sketchybar --add item separator left \
|
||||
--set separator icon= \
|
||||
icon.font="$FONT:Regular:16.0" \
|
||||
background.padding_left=26 \
|
||||
background.padding_right=15 \
|
||||
label.drawing=off \
|
||||
associated_display=active \
|
||||
icon.color="$YELLOW"
|
||||
24
private_dot_config/sketchybar/items/spotify.sh
Normal file
24
private_dot_config/sketchybar/items/spotify.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
MUSIC_EVENT="com.spotify.client.PlaybackStateChanged"
|
||||
COLOR="$GREEN"
|
||||
sketchybar --add event music_change $MUSIC_EVENT \
|
||||
--add item music q \
|
||||
--set music ${bracket_defaults[@]}\
|
||||
scroll_texts=on \
|
||||
icon= \
|
||||
icon.color="$COLOR" \
|
||||
icon.padding_left=10 \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.padding_right=-5 \
|
||||
background.drawing=on \
|
||||
label.padding_right=10 \
|
||||
associated_display=active \
|
||||
updates=on \
|
||||
script="$PLUGIN_DIR/spotify.sh" \
|
||||
--subscribe music music_change
|
||||
20
private_dot_config/sketchybar/items/volume.sh
Normal file
20
private_dot_config/sketchybar/items/volume.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
COLOR="$GREEN"
|
||||
|
||||
sketchybar \
|
||||
--add item sound right \
|
||||
--set sound \
|
||||
icon.color="$COLOR" \
|
||||
icon.padding_left=10 \
|
||||
label.color="$COLOR" \
|
||||
label.padding_right=10 \
|
||||
background.height=26 \
|
||||
background.corner_radius="$CORNER_RADIUS" \
|
||||
background.padding_right=5 \
|
||||
background.border_width="$BORDER_WIDTH" \
|
||||
background.border_color="$COLOR" \
|
||||
background.color="$BAR_COLOR" \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/sound.sh" \
|
||||
--subscribe sound volume_change
|
||||
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sketchybar --set "$NAME" icon="" label="$(date '+%a %d. %b')"
|
||||
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
LABEL=$(date '+%H:%M:%S')
|
||||
sketchybar --set "$NAME" label="$LABEL"
|
||||
3
private_dot_config/sketchybar/plugins/executable_cpu.sh
Normal file
3
private_dot_config/sketchybar/plugins/executable_cpu.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sketchybar --set "$NAME" icon="" label="$(ps -A -o %cpu | awk '{s+=$1} END {s /= 8} END {printf "%.1f%%\n", s}')"
|
||||
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
case "$SENDER" in
|
||||
"front_app_switched")
|
||||
sketchybar --set "$NAME" label="$INFO"
|
||||
;;
|
||||
esac
|
||||
30
private_dot_config/sketchybar/plugins/executable_power.sh
Normal file
30
private_dot_config/sketchybar/plugins/executable_power.sh
Normal file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
|
||||
CHARGING=$(pmset -g batt | grep 'AC Power')
|
||||
|
||||
if [ "$PERCENTAGE" = "" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case ${PERCENTAGE} in
|
||||
9[0-9] | 100)
|
||||
ICON=""
|
||||
;;
|
||||
[6-8][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
[3-5][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
[1-2][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
*) ICON="" ;;
|
||||
esac
|
||||
|
||||
if [ "$CHARGING" != "" ]; then
|
||||
ICON=""
|
||||
fi
|
||||
|
||||
sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}% "
|
||||
20
private_dot_config/sketchybar/plugins/executable_sound.sh
Normal file
20
private_dot_config/sketchybar/plugins/executable_sound.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
VOLUME=$(osascript -e "output volume of (get volume settings)")
|
||||
MUTED=$(osascript -e "output muted of (get volume settings)")
|
||||
|
||||
if [ "$MUTED" != "false" ]; then
|
||||
ICON=""
|
||||
VOLUME=0
|
||||
else
|
||||
case ${VOLUME} in
|
||||
100) ICON="" ;;
|
||||
[5-9]*) ICON="" ;;
|
||||
[0-9]*) ICON="" ;;
|
||||
*) ICON="" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
sketchybar -m \
|
||||
--set "$NAME" icon=$ICON \
|
||||
--set "$NAME" label="$VOLUME%"
|
||||
19
private_dot_config/sketchybar/plugins/executable_space.sh
Normal file
19
private_dot_config/sketchybar/plugins/executable_space.sh
Normal file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source "$HOME/.config/sketchybar/variables.sh" # Loads all defined colors
|
||||
|
||||
SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10")
|
||||
|
||||
SPACE_CLICK_SCRIPT="yabai -m space --focus $SID 2>/dev/null"
|
||||
|
||||
if [ "$SELECTED" = "true" ]; then
|
||||
sketchybar --animate tanh 5 --set "$NAME" \
|
||||
icon.color="$RED" \
|
||||
icon="${SPACE_ICONS[$SID - 1]}" \
|
||||
click_script="$SPACE_CLICK_SCRIPT"
|
||||
else
|
||||
sketchybar --animate tanh 5 --set "$NAME" \
|
||||
icon.color="$COMMENT" \
|
||||
icon="${SPACE_ICONS[$SID - 1]}" \
|
||||
click_script="$SPACE_CLICK_SCRIPT"
|
||||
fi
|
||||
27
private_dot_config/sketchybar/plugins/executable_spotify.sh
Normal file
27
private_dot_config/sketchybar/plugins/executable_spotify.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
update() {
|
||||
PLAYING=1
|
||||
if [ "$(echo "$INFO" | jq -r '.["Player State"]')" = "Playing" ]; then
|
||||
PLAYING=0
|
||||
TRACK="$(echo "$INFO" | jq -r .Name | cut -c1-40)"
|
||||
ARTIST="$(echo "$INFO" | jq -r .Artist | cut -c1-20)"
|
||||
ALBUM="$(echo "$INFO" | jq -r .Album | cut -c1-20)"
|
||||
fi
|
||||
|
||||
args=()
|
||||
if [ $PLAYING -eq 0 ]; then
|
||||
if [ "$ARTIST" == "" ]; then
|
||||
args+=(--set music label="$ALBUM - $TRACK" drawing=on icon=)
|
||||
else
|
||||
args+=(--set music label="$ARTIST - $TRACK" drawing=on icon=)
|
||||
fi
|
||||
else
|
||||
args+=(--set music icon=)
|
||||
fi
|
||||
sketchybar -m "${args[@]}"
|
||||
}
|
||||
|
||||
update
|
||||
50
private_dot_config/sketchybar/variables.sh
Normal file
50
private_dot_config/sketchybar/variables.sh
Normal file
@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Color Palette
|
||||
# Tokyonight Night
|
||||
BLACK=0xff24283b
|
||||
WHITE=0xffa9b1d6
|
||||
MAGENTA=0xffbb9af7
|
||||
BLUE=0xff7aa2f7
|
||||
CYAN=0xff7dcfff
|
||||
GREEN=0xff9ece6a
|
||||
YELLOW=0xffe0af68
|
||||
ORANGE=0xffff9e64
|
||||
RED=0xfff7768e
|
||||
BAR_COLOR=0xff1a1b26
|
||||
COMMENT=0xff565f89
|
||||
|
||||
# Tokyonight Day
|
||||
# BLACK=0xffe9e9ed
|
||||
# WHITE=0xff3760bf
|
||||
# MAGENTA=0xff9854f1
|
||||
# BLUE=0xff2e7de9
|
||||
# CYAN=0xff007197
|
||||
# GREEN=0xff587539
|
||||
# YELLOW=0xff8c6c3e
|
||||
# ORANGE=0xffb15c00
|
||||
# RED=0xfff52a65
|
||||
# BAR_COLOR=0xffe1e2e7
|
||||
|
||||
TRANSPARENT=0x00000000
|
||||
|
||||
# General bar colors
|
||||
ICON_COLOR=$WHITE # Color of all icons
|
||||
LABEL_COLOR=$WHITE # Color of all labels
|
||||
|
||||
ITEM_DIR="$HOME/.config/sketchybar/items"
|
||||
PLUGIN_DIR="$HOME/.config/sketchybar/plugins"
|
||||
|
||||
FONT="Hack Nerd Font"
|
||||
|
||||
PADDINGS=3
|
||||
|
||||
POPUP_BORDER_WIDTH=2
|
||||
POPUP_CORNER_RADIUS=11
|
||||
POPUP_BACKGROUND_COLOR=$BLACK
|
||||
POPUP_BORDER_COLOR=$COMMENT
|
||||
|
||||
CORNER_RADIUS=15
|
||||
BORDER_WIDTH=2
|
||||
|
||||
SHADOW=on
|
||||
Loading…
Reference in New Issue
Block a user