about summary refs log tree commit diff stats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--hm/soispha/pkgs/scripts.nix7
-rwxr-xr-xhm/soispha/pkgs/scripts/wrappers/battery.sh11
2 files changed, 18 insertions, 0 deletions
diff --git a/hm/soispha/pkgs/scripts.nix b/hm/soispha/pkgs/scripts.nix
index a1603656..75e3f88a 100644
--- a/hm/soispha/pkgs/scripts.nix
+++ b/hm/soispha/pkgs/scripts.nix
@@ -51,6 +51,12 @@
     dependencies = builtins.attrValues {inherit (pkgs) udisks gawk gnused gnugrep sudo;};
   };
 
+  battery-scr = write_shell {
+    name = "battery";
+    path = "wrappers";
+    dependencies = [];
+  };
+
   con2pdf-scr = sysLib.writeShellScript {
     name = "con2pdf";
     src = ./scripts/apps/con2pdf.sh;
@@ -289,6 +295,7 @@
 in [
   # llp-scr # TODO: see above
   aumo-scr
+  battery-scr
   con2pdf-scr
   description-scr
   fupdate-scr
diff --git a/hm/soispha/pkgs/scripts/wrappers/battery.sh b/hm/soispha/pkgs/scripts/wrappers/battery.sh
new file mode 100755
index 00000000..b2446ac3
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/wrappers/battery.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH
+
+capacity="$(cat /sys/class/power_supply/BAT0/capacity)";
+status="$(cat /sys/class/power_supply/BAT0/status)"
+
+printf "%s%% (%s)\n" "$capacity" "$status"
+
+# vim: ft=sh