chore: clean up sketchybar plugins
This commit is contained in:
parent
3b337a93da
commit
0a1c45516b
8 changed files with 114 additions and 241 deletions
|
@ -1,88 +1,86 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# vim:fileencoding=utf-8:foldmethod=marker
|
# vim:fileencoding=utf-8:foldmethod=marker
|
||||||
PLUGIN_DIR="$HOME/.config/sketchybar/plugins"
|
PLUGIN_DIR="$HOME"/.config/sketchybar/plugins
|
||||||
|
|
||||||
## bar appearance {{{
|
## bar appearance {{{
|
||||||
sketchybar --bar \
|
sketchybar --bar \
|
||||||
height=32 \
|
height=32 \
|
||||||
position=top \
|
position=top \
|
||||||
padding_left=0 \
|
padding_left=0 \
|
||||||
padding_right=0 \
|
padding_right=0 \
|
||||||
hidden=on \
|
hidden=on \
|
||||||
topmost=on
|
topmost=on
|
||||||
|
|
||||||
# colors are managed seperately in the colordummy,
|
# colors are managed seperately in the colordummy,
|
||||||
# which listens to theme_changed events,
|
# which listens to theme_changed events,
|
||||||
# to swap between Catppuccin Mocha and Latte
|
# to swap between Catppuccin Mocha and Latte
|
||||||
sketchybar -m --add event theme_changed AppleInterfaceThemeChangedNotification
|
sketchybar -m --add event theme_changed AppleInterfaceThemeChangedNotification
|
||||||
sketchybar \
|
sketchybar \
|
||||||
--add item colordummy center \
|
--add item colordummy center \
|
||||||
--set colordummy \
|
--set colordummy \
|
||||||
drawing=off \
|
drawing=off \
|
||||||
script="$PLUGIN_DIR/colordummy.sh" \
|
script="$PLUGIN_DIR/colordummy.sh" \
|
||||||
--subscribe colordummy theme_changed
|
--subscribe colordummy theme_changed
|
||||||
|
|
||||||
##### Changing Defaults #####
|
##### Changing Defaults #####
|
||||||
sketchybar --default \
|
sketchybar --default \
|
||||||
updates=when_shown \
|
updates=when_shown \
|
||||||
drawing=on \
|
drawing=on \
|
||||||
icon.font="Symbols Nerd Font:2048-em:18.0" \
|
icon.font="Symbols Nerd Font:2048-em:18.0" \
|
||||||
label.font="SF Pro:Regular:16.0" \
|
label.font="SF Pro:Regular:16.0" \
|
||||||
label.padding_left=2 \
|
label.padding_left=2 \
|
||||||
label.padding_right=2 \
|
label.padding_right=2 \
|
||||||
icon.padding_left=2 \
|
icon.padding_left=2 \
|
||||||
icon.padding_right=2
|
icon.padding_right=2
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
## left side of the bar {{{
|
## left side of the bar {{{
|
||||||
# spaces for yabai wm
|
# spaces for yabai wm
|
||||||
SPACE_ICONS=(
|
SPACE_ICONS=(
|
||||||
"Ⅰ" "Ⅱ"
|
"Ⅰ"
|
||||||
"Ⅲ"
|
"Ⅱ"
|
||||||
"Ⅳ"
|
"Ⅲ"
|
||||||
"Ⅴ"
|
"Ⅳ"
|
||||||
"Ⅵ"
|
"Ⅴ"
|
||||||
"Ⅶ"
|
"Ⅵ"
|
||||||
"Ⅷ"
|
"Ⅶ"
|
||||||
"Ⅸ"
|
"Ⅷ"
|
||||||
"Ⅹ"
|
"Ⅸ"
|
||||||
|
"Ⅹ"
|
||||||
)
|
)
|
||||||
for i in "${!SPACE_ICONS[@]}"
|
for i in "${!SPACE_ICONS[@]}"; do
|
||||||
do
|
sketchybar \
|
||||||
sketchybar \
|
--add space "space.$i" left \
|
||||||
--add space "space.$i" left \
|
--set "space.$i" associated_space=$((i + 1)) \
|
||||||
--set "space.$i" associated_space=$((i+1)) \
|
icon="${SPACE_ICONS[i]}" \
|
||||||
icon="${SPACE_ICONS[i]}" \
|
icon.padding_left=8 \
|
||||||
icon.padding_left=8 \
|
icon.padding_right=8 \
|
||||||
icon.padding_right=8 \
|
background.padding_left=1 \
|
||||||
background.padding_left=1 \
|
background.padding_right=1 \
|
||||||
background.padding_right=1 \
|
background.height=32 \
|
||||||
background.height=32 \
|
label.drawing=off \
|
||||||
label.drawing=off \
|
script="$PLUGIN_DIR/space.sh" \
|
||||||
script="$PLUGIN_DIR/space.sh" \
|
click_script="yabai -m space --focus $((i + 1))"
|
||||||
click_script="yabai -m space --focus $((i+1))"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
sketchybar \
|
sketchybar \
|
||||||
\
|
--add item clock right \
|
||||||
--add item clock right \
|
--set clock \
|
||||||
--set clock \
|
script="$PLUGIN_DIR/clock.sh" \
|
||||||
script="$PLUGIN_DIR/clock.sh" \
|
update_freq=10 \
|
||||||
update_freq=10 \
|
lazy=true \
|
||||||
lazy=true \
|
background.padding_right=4 \
|
||||||
background.padding_right=4 \
|
--add alias "iStat Menus Status" right \
|
||||||
\
|
icon.padding_left=0 \
|
||||||
--add alias "iStat Menus Status" right \
|
icon.padding_right=0 \
|
||||||
icon.padding_left=0 \
|
--add alias "Little Snitch Agent" right \
|
||||||
icon.padding_right=0 \
|
icon.padding_left=0 \
|
||||||
--add alias "Little Snitch Agent" right \
|
icon.padding_right=0 \
|
||||||
icon.padding_left=0 \
|
--add alias "Control Centre,Battery" right \
|
||||||
icon.padding_right=0 \
|
icon.padding_left=0 \
|
||||||
--add alias "Control Centre,Battery" right \
|
icon.padding_right=0 \
|
||||||
icon.padding_left=0 \
|
--add alias "Mullvad VPN" right \
|
||||||
icon.padding_right=0 \
|
icon.padding_left=0 \
|
||||||
--add alias "Mullvad VPN" right \
|
icon.padding_right=0
|
||||||
icon.padding_left=0 \
|
|
||||||
icon.padding_right=0
|
|
||||||
|
|
||||||
sketchybar --update
|
sketchybar --update
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
#!/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 battery icon="$ICON" label="${PERCENTAGE}%"
|
|
|
@ -2,75 +2,71 @@
|
||||||
|
|
||||||
# check wether or not macOS is in dark mode
|
# check wether or not macOS is in dark mode
|
||||||
if [[ $(defaults read -g AppleInterfaceStyle) != 'Dark' ]]; then
|
if [[ $(defaults read -g AppleInterfaceStyle) != 'Dark' ]]; then
|
||||||
THEME="light"
|
THEME="light"
|
||||||
else
|
else
|
||||||
THEME="dark"
|
THEME="dark"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $THEME == 'dark' ]]; then
|
if [[ $THEME == 'dark' ]]; then
|
||||||
PINK="f4b8e4"
|
PINK="f4b8e4"
|
||||||
MAUVE="ca9ee6"
|
MAUVE="ca9ee6"
|
||||||
TEXT="c6d0f5"
|
TEXT="c6d0f5"
|
||||||
BASE="303446"
|
BASE="303446"
|
||||||
MANTLE="292c3c"
|
MANTLE="292c3c"
|
||||||
CRUST="232634"
|
CRUST="232634"
|
||||||
# overrides
|
# overrides
|
||||||
BASE="000000"
|
BASE="000000"
|
||||||
MANTLE="000000"
|
MANTLE="000000"
|
||||||
CRUST="000000"
|
CRUST="000000"
|
||||||
else
|
else
|
||||||
PINK="ea76cb"
|
PINK="ea76cb"
|
||||||
MAUVE="8839ef"
|
MAUVE="8839ef"
|
||||||
TEXT="4c4f69"
|
TEXT="4c4f69"
|
||||||
CRUST="dce0e8"
|
CRUST="dce0e8"
|
||||||
MANTLE="e6e9ef"
|
MANTLE="e6e9ef"
|
||||||
BASE="eff1f5"
|
BASE="eff1f5"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function color() {
|
function color() {
|
||||||
alpha=${2:-255}
|
alpha=${2:-255}
|
||||||
color="$1"
|
color="$1"
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
pink) color=$PINK ;;
|
pink) color=$PINK ;;
|
||||||
mauve) color=$MAUVE ;;
|
mauve) color=$MAUVE ;;
|
||||||
text) color=$TEXT ;;
|
text) color=$TEXT ;;
|
||||||
crust) color=$CRUST ;;
|
crust) color=$CRUST ;;
|
||||||
mantle) color=$MANTLE ;;
|
mantle) color=$MANTLE ;;
|
||||||
base) color=$BASE ;;
|
base) color=$BASE ;;
|
||||||
*) color=$BASE ;;
|
*) color=$BASE ;;
|
||||||
esac
|
esac
|
||||||
printf -v alpha "%02x" "$alpha"
|
printf -v alpha "%02x" "$alpha"
|
||||||
echo "0x${alpha}${color}"
|
echo "0x${alpha}${color}"
|
||||||
}
|
}
|
||||||
|
|
||||||
sketchybar \
|
sketchybar \
|
||||||
--bar \
|
--bar \
|
||||||
color="$(color crust)" \
|
color="$(color crust)" \
|
||||||
\
|
--default \
|
||||||
--default \
|
icon.color="$(color pink)" \
|
||||||
icon.color="$(color pink)" \
|
label.color="$(color pink)" \
|
||||||
label.color="$(color pink)" \
|
--set /space/ \
|
||||||
\
|
icon.color="$(color mauve 128)" \
|
||||||
--set /space/ \
|
icon.highlight_color="$(color pink)" \
|
||||||
icon.color="$(color mauve 128)" \
|
--set clock \
|
||||||
icon.highlight_color="$(color pink)" \
|
icon.color="$(color pink)" \
|
||||||
\
|
label.color="$(color pink)" \
|
||||||
--set clock \
|
--set "Mullvad VPN" \
|
||||||
icon.color="$(color pink)" \
|
alias.color="$(color pink)" \
|
||||||
label.color="$(color pink)" \
|
--set "Little Snitch Agent" \
|
||||||
\
|
alias.color="$(color pink)" \
|
||||||
--set "Mullvad VPN" \
|
--set "iStat Menus Status" \
|
||||||
alias.color="$(color pink)" \
|
alias.color="$(color pink)" \
|
||||||
--set "Little Snitch Agent" \
|
--set "Control Centre,Battery" \
|
||||||
alias.color="$(color pink)" \
|
alias.color="$(color pink)"
|
||||||
--set "iStat Menus Status" \
|
|
||||||
alias.color="$(color pink)" \
|
|
||||||
--set "Control Centre,Battery" \
|
|
||||||
alias.color="$(color pink)" \
|
|
||||||
|
|
||||||
# set the yabai colours as well
|
# set the yabai colours as well
|
||||||
yabai \
|
yabai \
|
||||||
-m config active_window_border_color "$(color pink)" \
|
-m config active_window_border_color "$(color pink)" \
|
||||||
-m config normal_window_border_color "$(color mauve)" \
|
-m config normal_window_border_color "$(color mauve)" \
|
||||||
-m config insert_feedback_color "$(color pink)"
|
-m config insert_feedback_color "$(color pink)"
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
sketchybar --set "$NAME" label="$(~/.local/bin/bar_date)" icon=" "
|
|
|
@ -1,30 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
UNREAD_ONLY=false
|
|
||||||
MAIL_DIR=~/.local/share/mail
|
|
||||||
|
|
||||||
COUNT=0
|
|
||||||
|
|
||||||
if [[ -d ${MAIL_DIR} ]]; then
|
|
||||||
for dir in "${MAIL_DIR}"/*/; do
|
|
||||||
# get file count for the unread mailbox, add to count
|
|
||||||
unreads=$( find "${dir}INBOX/new" | wc -l)
|
|
||||||
COUNT=$((COUNT+unreads))
|
|
||||||
|
|
||||||
# also add the rest of the inbox if var is set
|
|
||||||
if ! ($UNREAD_ONLY); then
|
|
||||||
other=$( find "${dir}INBOX/new" | wc -l)
|
|
||||||
COUNT=$((COUNT+other))
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $COUNT -gt 0 ]]; then
|
|
||||||
ICON=" "
|
|
||||||
LABEL="$COUNT"
|
|
||||||
else
|
|
||||||
ICON=" "
|
|
||||||
fi
|
|
||||||
|
|
||||||
sketchybar --set "$NAME" label="$LABEL" icon="$ICON"
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# path where mullvad is kept
|
|
||||||
PATH=/usr/local/bin:$PATH
|
|
||||||
|
|
||||||
if ! [ -x "$(command -v mullvad)" ]; then
|
|
||||||
sketchybar --set "$NAME" icon=" " label=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
while read -r LINE; do
|
|
||||||
if echo "$LINE" | grep -q 'Connected'; then
|
|
||||||
ICON=" "
|
|
||||||
else
|
|
||||||
ICON=" "
|
|
||||||
fi
|
|
||||||
|
|
||||||
sketchybar --set "$NAME" icon="$ICON"
|
|
||||||
done < <(mullvad status listen)
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
VOLUME=$(osascript -e "get volume settings" | cut -d " " -d ":" -f2 | cut -d "," -f1)
|
|
||||||
MUTED=$(osascript -e "get volume settings" | grep "muted:true")
|
|
||||||
|
|
||||||
if [[ "$MUTED" != "" ]]; then
|
|
||||||
ICON="ﱝ "
|
|
||||||
else
|
|
||||||
case ${VOLUME} in
|
|
||||||
100) ICON="墳";;
|
|
||||||
9[0-9]) ICON="墳";;
|
|
||||||
8[0-9]) ICON="墳";;
|
|
||||||
7[0-9]) ICON="墳";;
|
|
||||||
6[0-9]) ICON="奔";;
|
|
||||||
5[0-9]) ICON="奔";;
|
|
||||||
4[0-9]) ICON="奔";;
|
|
||||||
3[0-9]) ICON="奔";;
|
|
||||||
2[0-9]) ICON="奄";;
|
|
||||||
1[0-9]) ICON="奄";;
|
|
||||||
[0-9]) ICON="奄";;
|
|
||||||
*) ICON="奄"
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%"
|
|
|
@ -1,19 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
urg=$(task count due.before:tomorrow status:pending)
|
|
||||||
week=$(task count due.before:eow status:pending)
|
|
||||||
month=$(task count due.before:eom status:pending)
|
|
||||||
total=$(task count status:pending)
|
|
||||||
|
|
||||||
if [[ $total -eq 0 ]]; then
|
|
||||||
ICON=" "
|
|
||||||
LABEL="All done"
|
|
||||||
elif [[ $urg -eq 0 ]]; then
|
|
||||||
ICON=" "
|
|
||||||
LABEL="$week/$month/$total"
|
|
||||||
else
|
|
||||||
ICON=" "
|
|
||||||
LABEL="$week/$month/$total"
|
|
||||||
fi
|
|
||||||
|
|
||||||
sketchybar --set "$NAME" label="$LABEL" icon="$ICON"
|
|
Loading…
Reference in a new issue