reo101
10a013d6a6
- Now written in `Clojure`, using `Babashka` Checked with `clj-kondo` - Add TODO for module upstreaming (of allowing file or script for `config`) - Set `yabai` `window_border_radius` to `0` - Fix ` battery` script (`grep` does not do `\d`)
77 lines
1.9 KiB
Bash
Executable file
77 lines
1.9 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
source "${UTIL_DIR}/colors.sh"
|
|
|
|
BATT_PERCENT=$(pmset -g batt | grep -Eo '[[:digit:]]+%' | cut -d% -f1)
|
|
CHARGING=$(pmset -g batt | grep 'AC Power')
|
|
|
|
sketchybar --set "${NAME}" icon.color=0xff989898
|
|
|
|
if [ "${CHARGING}" != "" ]; then
|
|
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}%"
|
|
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
|