feat(yabai): update
Add 10th workspace Add `get_menu_bar_height` objc program
This commit is contained in:
parent
22ccaedc94
commit
26cafb1599
7 changed files with 148 additions and 45 deletions
|
@ -1,34 +1,77 @@
|
|||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
|
||||
source "${UTIL_DIR}/colors.sh"
|
||||
|
||||
BATT_PERCENT=$(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
|
||||
sketchybar --set "${NAME}" icon.color=0xff989898
|
||||
|
||||
if [ ${CHARGING} != "" ]; then
|
||||
ICON=""
|
||||
fi
|
||||
case ${BATT_PERCENT} in
|
||||
100)
|
||||
ICON=""
|
||||
COLOR="${GREEN}"
|
||||
;;
|
||||
9[0-9])
|
||||
ICON=""
|
||||
COLOR="${GREEN}"
|
||||
;;
|
||||
8[0-9])
|
||||
ICON=""
|
||||
COLOR="${GREEN}"
|
||||
;;
|
||||
7[0-9])
|
||||
ICON=""
|
||||
COLOR="${GREEN}"
|
||||
;;
|
||||
6[0-9])
|
||||
ICON=""
|
||||
COLOR="${YELLOW}"
|
||||
;;
|
||||
5[0-9])
|
||||
ICON=""
|
||||
COLOR="${YELLOW}"
|
||||
;;
|
||||
4[0-9])
|
||||
ICON=""
|
||||
COLOR="${ORANGE}"
|
||||
;;
|
||||
3[0-9])
|
||||
ICON=""
|
||||
COLOR="${ORANGE}"
|
||||
;;
|
||||
2[0-9])
|
||||
ICON=""
|
||||
COLOR="${RED}"
|
||||
;;
|
||||
1[0-9])
|
||||
ICON=""
|
||||
COLOR="${RED}"
|
||||
;;
|
||||
*)
|
||||
ICON=""
|
||||
COLOR="${RED}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# The item invoking this script (name ${NAME}) will get its icon and label
|
||||
# updated with the current battery status
|
||||
sketchybar --set ${NAME} icon="${ICON}" label="${PERCENTAGE}%"
|
||||
sketchybar --set "${NAME}" icon="${ICON}" icon.color="${COLOR}"
|
||||
sketchybar --set "${NAME}" label="${BATT_PERCENT}%"
|
||||
else
|
||||
case ${BATT_PERCENT} in
|
||||
100) ICON="" COLOR="$GREEN" ;;
|
||||
9[0-9]) ICON="" COLOR="$GREEN" ;;
|
||||
8[0-9]) ICON="" COLOR="$GREEN" ;;
|
||||
7[0-9]) ICON="" COLOR="$GREEN" ;;
|
||||
6[0-9]) ICON="" COLOR="$YELLOW" ;;
|
||||
5[0-9]) ICON="" COLOR="$YELLOW" ;;
|
||||
4[0-9]) ICON="" COLOR="$ORANGE" ;;
|
||||
3[0-9]) ICON="" COLOR="$ORANGE" ;;
|
||||
2[0-9]) ICON="" COLOR="$RED" ;;
|
||||
1[0-9]) ICON="" COLOR="$RED" ;;
|
||||
*) ICON="" COLOR="$RED" ;;
|
||||
esac
|
||||
|
||||
sketchybar --set "${NAME}" icon="${ICON}" icon.color="${COLOR}"
|
||||
sketchybar --set "${NAME}" label="${BATT_PERCENT}%"
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue