summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hosts/omar/desktop-environment/window-manager.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/hosts/omar/desktop-environment/window-manager.nix b/hosts/omar/desktop-environment/window-manager.nix
index 1237148..926268e 100644
--- a/hosts/omar/desktop-environment/window-manager.nix
+++ b/hosts/omar/desktop-environment/window-manager.nix
@@ -12,7 +12,21 @@
serviceConfig.ExecStart = pkgs.writeShellScript "dwm-battery" ''
while true; do
- echo "$(date +%H:%M) - $(cat /sys/class/power_supply/BAT0/capacity)%"
+ echo -n "$(date +%H:%M) - ";
+
+ # See: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power
+ case "$(cat /sys/class/power_supply/BAT0/status)" in
+ Charging) echo -n "🔋 " ;;
+ Discharging) echo -n "🪫 " ;;
+ "Not charging") echo -n "🪫 " ;;
+ Full) echo -n "🔋 " ;;
+ Unknown) echo -n "? " ;;
+ ""|*) echo -n "?? " ;;
+ esac
+
+ echo -n "$(cat /sys/class/power_supply/BAT0/capacity)%"
+
+ echo
sleep 5
done | ${pkgs.dwm-setstatus}/bin/dwm-setstatus
'';