]> git.armaanb.net Git - bin.git/commitdiff
made smarter
authorArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Fri, 30 Oct 2020 15:59:49 +0000 (11:59 -0400)
committerArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Fri, 30 Oct 2020 15:59:49 +0000 (11:59 -0400)
status

diff --git a/status b/status
index 98e0614eec4a1ec044b6ddcdebaf74742c32ed48..292d714ecf49afd90b20ba21c0085c7bb9eaa1e3 100755 (executable)
--- a/status
+++ b/status
@@ -1,13 +1,17 @@
 #!/usr/bin/env bash
+
 function time_set() {
-  date +%A", "%b" "%e" | "%r
+  date +%A", "%b" "%e", "%r
 }
 
 function power_set() {
   upower -d | grep percentage | tail -c 5
-  echo " battery,"
-  upower --dump | grep "time to empty" | tail -c 15
+  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) remaining`"
+notify-send -i "clock" "`echo $(time_set)`" "`echo $(power_set)`"