Give EWW scripts proper extensions

This commit is contained in:
Michael Bradley 2025-06-22 14:25:02 -04:00
parent 448bdfc231
commit 287df92d65
Signed by: MichaelBradley
SSH key fingerprint: SHA256:BKO2eI2LPsCbQS3n3i5SdwZTAIV3F1lHezR07qP+Ob0
13 changed files with 11 additions and 11 deletions

19
eww/scripts/get-battery.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/env sh
BATTERY='/sys/class/power_supply/BAT1/'
FULL="$(cat "${BATTERY}/charge_full")"
NOW="$(cat "${BATTERY}/charge_now")"
CHARGE=$((100*NOW/FULL))
CHARGE_ICONS="󰂎󰁺󰁻󰁼󰁽󰁾󰁿󰂀󰂁󰂂󰁹"
CHARGE_ICON_INDEX=$((CHARGE/10))
CHARGE_ICON="${CHARGE_ICONS:CHARGE_ICON_INDEX:1}"
charging() {
case "$(cat "${BATTERY}/status")" in
"Charging") echo "true";;
*) echo "false";;
esac
}
echo "{\"charge\":$CHARGE,\"icon\":\"$CHARGE_ICON\",\"charging\":$(charging)}"