summaryrefslogtreecommitdiff
path: root/.local/bin/dwmbar/dwmb-bat
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2020-10-08 01:53:07 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2020-10-08 01:53:07 -0400
commite860d9a8f7ca586fa88ba2f0b1325377ebb14615 (patch)
tree22775fb8343e95ae56b26a8207b6a31c857ee419 /.local/bin/dwmbar/dwmb-bat
parentc295d8331ff5193cb97b1e3f6b15836654b010cc (diff)
dwmblocks scripts
Diffstat (limited to '.local/bin/dwmbar/dwmb-bat')
-rwxr-xr-x.local/bin/dwmbar/dwmb-bat29
1 files changed, 29 insertions, 0 deletions
diff --git a/.local/bin/dwmbar/dwmb-bat b/.local/bin/dwmbar/dwmb-bat
new file mode 100755
index 0000000..4cc14ec
--- /dev/null
+++ b/.local/bin/dwmbar/dwmb-bat
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) notify-send hey ;;
+ 2) setsid -f "$TERMINAL" -e calcurse ;;
+ 3) notify-send " Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\`
+- Middle click opens calcurse if installed" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+# Charging:  #
+# Discharching:  #
+# Full: underscore:  #
+# LOW BATTERY:  #
+
+batstatus=$(acpi | tail -n 1)
+
+ico=""
+
+# Change the underscore color according to the charging state
+case "$batstatus" in
+ *Charging*) ico=" ";;
+ *Discharging*) ico="  " ;;
+ *) ico="  " ;;
+esac
+
+percentage=$( echo "$batstatus" | sed "s/.*\(\ [0-9]*\)\%.*$/\1/; s/\ //g; 1q")
+
+echo "$ico$percentage% "