diff options
Diffstat (limited to 'dotfiles/.local/bin/bards4battery')
-rwxr-xr-x | dotfiles/.local/bin/bards4battery | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dotfiles/.local/bin/bards4battery b/dotfiles/.local/bin/bards4battery new file mode 100755 index 0000000..15ffb99 --- /dev/null +++ b/dotfiles/.local/bin/bards4battery @@ -0,0 +1,15 @@ +#!/bin/sh + +if [ -f /sys/class/power_supply/sony_controller_battery_*/capacity ]; then + percentage=$(cat /sys/class/power_supply/sony_controller_battery_*/capacity) + + if [ percentage -lt 40 ]; then + printf "<span color=\"#b2872f\">%s%%</span>" "$percentage" + exit + fi + if [ percentage -lt 20 ]; then + printf "<span color=\"#b73030\">%s%%</span>" "$percentage" + exit + fi + printf "<span color=\"#5b8277\">%s%%</span>" "$percentage" +fi |