chore: clean up sketchybar plugins

This commit is contained in:
winston 2022-12-01 07:58:02 +01:00
parent 3b337a93da
commit 0a1c45516b
Signed by: winston
GPG key ID: 3786770EDBC2B481
8 changed files with 114 additions and 241 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# vim:fileencoding=utf-8:foldmethod=marker
PLUGIN_DIR="$HOME/.config/sketchybar/plugins"
PLUGIN_DIR="$HOME"/.config/sketchybar/plugins
## bar appearance {{{
sketchybar --bar \
@ -37,7 +37,8 @@ sketchybar --default \
## left side of the bar {{{
# spaces for yabai wm
SPACE_ICONS=(
"" "Ⅱ"
""
"Ⅱ"
"Ⅲ"
"Ⅳ"
""
@ -47,8 +48,7 @@ SPACE_ICONS=(
"Ⅸ"
""
)
for i in "${!SPACE_ICONS[@]}"
do
for i in "${!SPACE_ICONS[@]}"; do
sketchybar \
--add space "space.$i" left \
--set "space.$i" associated_space=$((i + 1)) \
@ -64,14 +64,12 @@ do
done
sketchybar \
\
--add item clock right \
--set clock \
script="$PLUGIN_DIR/clock.sh" \
update_freq=10 \
lazy=true \
background.padding_right=4 \
\
--add alias "iStat Menus Status" right \
icon.padding_left=0 \
icon.padding_right=0 \

View file

@ -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}%"

View file

@ -47,19 +47,15 @@ function color() {
sketchybar \
--bar \
color="$(color crust)" \
\
--default \
icon.color="$(color pink)" \
label.color="$(color pink)" \
\
--set /space/ \
icon.color="$(color mauve 128)" \
icon.highlight_color="$(color pink)" \
\
--set clock \
icon.color="$(color pink)" \
label.color="$(color pink)" \
\
--set "Mullvad VPN" \
alias.color="$(color pink)" \
--set "Little Snitch Agent" \
@ -67,7 +63,7 @@ sketchybar \
--set "iStat Menus Status" \
alias.color="$(color pink)" \
--set "Control Centre,Battery" \
alias.color="$(color pink)" \
alias.color="$(color pink)"
# set the yabai colours as well
yabai \

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
sketchybar --set "$NAME" label="$(~/.local/bin/bar_date)" icon=" "

View file

@ -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"

View file

@ -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)

View file

@ -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%"

View file

@ -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"