]> git.armaanb.net Git - bin.git/blobdiff - status
made smarter
[bin.git] / status
diff --git a/status b/status
index ee0a0c532c82a94f1ad20fd0820351deb416d142..292d714ecf49afd90b20ba21c0085c7bb9eaa1e3 100755 (executable)
--- a/status
+++ b/status
@@ -1,4 +1,17 @@
-#!/usr/bin/env sh
-notify-send -i "clock" "`date +%A" "%B" "%e" | "%1l:%M:%S `" "`upower -d | grep percentage | tail -c 4 | head -c 3 && echo " battery" && upower --dump | grep "time to empty" | tail -c 11 | head -c 11`"
+#!/usr/bin/env bash
 
+function time_set() {
+  date +%A", "%b" "%e", "%r
+}
 
+function power_set() {
+  upower -d | grep percentage | tail -c 5
+  if [[ $(upower -d | grep "discharging") ]]; then
+    echo " battery,"
+    echo $(upower -d | grep "time to empty" | tail -c 15) remaining
+  else
+    echo " battery"
+  fi
+}
+
+notify-send -i "clock" "`echo $(time_set)`" "`echo $(power_set)`"