From 07d294425a98ee5d1e22d03e2b24ae2c76e487c0 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sat, 23 Aug 2025 12:42:37 +0900 Subject: updates --- mac/.config/sketchybar.allapp/plugins/battery.sh | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 mac/.config/sketchybar.allapp/plugins/battery.sh (limited to 'mac/.config/sketchybar.allapp/plugins/battery.sh') diff --git a/mac/.config/sketchybar.allapp/plugins/battery.sh b/mac/.config/sketchybar.allapp/plugins/battery.sh new file mode 100755 index 0000000..7487662 --- /dev/null +++ b/mac/.config/sketchybar.allapp/plugins/battery.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +source "$CONFIG_DIR/colors.sh" + +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 + [8-9][0-9] | 100) + ICON="􀛨" + ICON_COLOR=$BATTERY_1 + ;; + 7[0-9]) + ICON="􀺸" + ICON_COLOR=$BATTERY_2 + ;; + [4-6][0-9]) + ICON="􀺶" + ICON_COLOR=$BATTERY_3 + ;; + [1-3][0-9]) + ICON="􀛩" + ICON_COLOR=$BATTERY_4 + ;; + [0-9]) + ICON="􀛪" + ICON_COLOR=$BATTERY_5 + ;; +esac + +if [[ "$CHARGING" != "" ]]; then + ICON="􀢋" + ICON_COLOR=$YELLOW +fi + +# 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}%" icon.color=${ICON_COLOR} -- cgit v1.2.3