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
|
||||
# vim:fileencoding=utf-8:foldmethod=marker
|
||||
PLUGIN_DIR="$HOME/.config/sketchybar/plugins"
|
||||
PLUGIN_DIR="$HOME"/.config/sketchybar/plugins
|
||||
|
||||
## bar appearance {{{
|
||||
sketchybar --bar \
|
||||
height=32 \
|
||||
position=top \
|
||||
padding_left=0 \
|
||||
padding_right=0 \
|
||||
hidden=on \
|
||||
topmost=on
|
||||
height=32 \
|
||||
position=top \
|
||||
padding_left=0 \
|
||||
padding_right=0 \
|
||||
hidden=on \
|
||||
topmost=on
|
||||
|
||||
# colors are managed seperately in the colordummy,
|
||||
# which listens to theme_changed events,
|
||||
# to swap between Catppuccin Mocha and Latte
|
||||
sketchybar -m --add event theme_changed AppleInterfaceThemeChangedNotification
|
||||
sketchybar \
|
||||
--add item colordummy center \
|
||||
--set colordummy \
|
||||
drawing=off \
|
||||
script="$PLUGIN_DIR/colordummy.sh" \
|
||||
--subscribe colordummy theme_changed
|
||||
--add item colordummy center \
|
||||
--set colordummy \
|
||||
drawing=off \
|
||||
script="$PLUGIN_DIR/colordummy.sh" \
|
||||
--subscribe colordummy theme_changed
|
||||
|
||||
##### Changing Defaults #####
|
||||
sketchybar --default \
|
||||
updates=when_shown \
|
||||
drawing=on \
|
||||
icon.font="Symbols Nerd Font:2048-em:18.0" \
|
||||
label.font="SF Pro:Regular:16.0" \
|
||||
label.padding_left=2 \
|
||||
label.padding_right=2 \
|
||||
icon.padding_left=2 \
|
||||
icon.padding_right=2
|
||||
updates=when_shown \
|
||||
drawing=on \
|
||||
icon.font="Symbols Nerd Font:2048-em:18.0" \
|
||||
label.font="SF Pro:Regular:16.0" \
|
||||
label.padding_left=2 \
|
||||
label.padding_right=2 \
|
||||
icon.padding_left=2 \
|
||||
icon.padding_right=2
|
||||
# }}}
|
||||
|
||||
## left side of the bar {{{
|
||||
# spaces for yabai wm
|
||||
SPACE_ICONS=(
|
||||
"Ⅰ" "Ⅱ"
|
||||
"Ⅲ"
|
||||
"Ⅳ"
|
||||
"Ⅴ"
|
||||
"Ⅵ"
|
||||
"Ⅶ"
|
||||
"Ⅷ"
|
||||
"Ⅸ"
|
||||
"Ⅹ"
|
||||
"Ⅰ"
|
||||
"Ⅱ"
|
||||
"Ⅲ"
|
||||
"Ⅳ"
|
||||
"Ⅴ"
|
||||
"Ⅵ"
|
||||
"Ⅶ"
|
||||
"Ⅷ"
|
||||
"Ⅸ"
|
||||
"Ⅹ"
|
||||
)
|
||||
for i in "${!SPACE_ICONS[@]}"
|
||||
do
|
||||
sketchybar \
|
||||
--add space "space.$i" left \
|
||||
--set "space.$i" associated_space=$((i+1)) \
|
||||
icon="${SPACE_ICONS[i]}" \
|
||||
icon.padding_left=8 \
|
||||
icon.padding_right=8 \
|
||||
background.padding_left=1 \
|
||||
background.padding_right=1 \
|
||||
background.height=32 \
|
||||
label.drawing=off \
|
||||
script="$PLUGIN_DIR/space.sh" \
|
||||
click_script="yabai -m space --focus $((i+1))"
|
||||
for i in "${!SPACE_ICONS[@]}"; do
|
||||
sketchybar \
|
||||
--add space "space.$i" left \
|
||||
--set "space.$i" associated_space=$((i + 1)) \
|
||||
icon="${SPACE_ICONS[i]}" \
|
||||
icon.padding_left=8 \
|
||||
icon.padding_right=8 \
|
||||
background.padding_left=1 \
|
||||
background.padding_right=1 \
|
||||
background.height=32 \
|
||||
label.drawing=off \
|
||||
script="$PLUGIN_DIR/space.sh" \
|
||||
click_script="yabai -m space --focus $((i + 1))"
|
||||
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 \
|
||||
--add alias "Little Snitch Agent" right \
|
||||
icon.padding_left=0 \
|
||||
icon.padding_right=0 \
|
||||
--add alias "Control Centre,Battery" right \
|
||||
icon.padding_left=0 \
|
||||
icon.padding_right=0 \
|
||||
--add alias "Mullvad VPN" right \
|
||||
icon.padding_left=0 \
|
||||
icon.padding_right=0
|
||||
--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 \
|
||||
--add alias "Little Snitch Agent" right \
|
||||
icon.padding_left=0 \
|
||||
icon.padding_right=0 \
|
||||
--add alias "Control Centre,Battery" right \
|
||||
icon.padding_left=0 \
|
||||
icon.padding_right=0 \
|
||||
--add alias "Mullvad VPN" right \
|
||||
icon.padding_left=0 \
|
||||
icon.padding_right=0
|
||||
|
||||
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
|
||||
if [[ $(defaults read -g AppleInterfaceStyle) != 'Dark' ]]; then
|
||||
THEME="light"
|
||||
THEME="light"
|
||||
else
|
||||
THEME="dark"
|
||||
THEME="dark"
|
||||
fi
|
||||
|
||||
if [[ $THEME == 'dark' ]]; then
|
||||
PINK="f4b8e4"
|
||||
MAUVE="ca9ee6"
|
||||
TEXT="c6d0f5"
|
||||
BASE="303446"
|
||||
MANTLE="292c3c"
|
||||
CRUST="232634"
|
||||
# overrides
|
||||
BASE="000000"
|
||||
MANTLE="000000"
|
||||
CRUST="000000"
|
||||
PINK="f4b8e4"
|
||||
MAUVE="ca9ee6"
|
||||
TEXT="c6d0f5"
|
||||
BASE="303446"
|
||||
MANTLE="292c3c"
|
||||
CRUST="232634"
|
||||
# overrides
|
||||
BASE="000000"
|
||||
MANTLE="000000"
|
||||
CRUST="000000"
|
||||
else
|
||||
PINK="ea76cb"
|
||||
MAUVE="8839ef"
|
||||
TEXT="4c4f69"
|
||||
CRUST="dce0e8"
|
||||
MANTLE="e6e9ef"
|
||||
BASE="eff1f5"
|
||||
PINK="ea76cb"
|
||||
MAUVE="8839ef"
|
||||
TEXT="4c4f69"
|
||||
CRUST="dce0e8"
|
||||
MANTLE="e6e9ef"
|
||||
BASE="eff1f5"
|
||||
fi
|
||||
|
||||
function color() {
|
||||
alpha=${2:-255}
|
||||
color="$1"
|
||||
alpha=${2:-255}
|
||||
color="$1"
|
||||
|
||||
case $1 in
|
||||
pink) color=$PINK ;;
|
||||
mauve) color=$MAUVE ;;
|
||||
text) color=$TEXT ;;
|
||||
crust) color=$CRUST ;;
|
||||
mantle) color=$MANTLE ;;
|
||||
base) color=$BASE ;;
|
||||
*) color=$BASE ;;
|
||||
esac
|
||||
printf -v alpha "%02x" "$alpha"
|
||||
echo "0x${alpha}${color}"
|
||||
case $1 in
|
||||
pink) color=$PINK ;;
|
||||
mauve) color=$MAUVE ;;
|
||||
text) color=$TEXT ;;
|
||||
crust) color=$CRUST ;;
|
||||
mantle) color=$MANTLE ;;
|
||||
base) color=$BASE ;;
|
||||
*) color=$BASE ;;
|
||||
esac
|
||||
printf -v alpha "%02x" "$alpha"
|
||||
echo "0x${alpha}${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" \
|
||||
alias.color="$(color pink)" \
|
||||
--set "iStat Menus Status" \
|
||||
alias.color="$(color pink)" \
|
||||
--set "Control Centre,Battery" \
|
||||
alias.color="$(color pink)" \
|
||||
--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" \
|
||||
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
|
||||
yabai \
|
||||
-m config active_window_border_color "$(color pink)" \
|
||||
-m config normal_window_border_color "$(color mauve)" \
|
||||
-m config insert_feedback_color "$(color pink)"
|
||||
-m config active_window_border_color "$(color pink)" \
|
||||
-m config normal_window_border_color "$(color mauve)" \
|
||||
-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