add swaybar for minimalist battery + clock status

This commit is contained in:
Daniel Lundin 2019-12-04 13:18:50 +01:00
parent a191893dc6
commit f39e227eb8
3 changed files with 40 additions and 2 deletions

21
bin/sway-status Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
# Date and time
date_fmt=$(date "+%b %d")
current_time=$(date "+%H:%M")
#############
# Commands
#############
battery_charge=$(upower --show-info $(upower --enumerate | grep 'BAT') | egrep "percentage" | awk '{print $2}')
battery_status=$(upower --show-info $(upower --enumerate | grep 'BAT') | egrep "state" | awk '{print $2}')
if [ "$battery_status" = "discharging" ]; then
battery_pluggedin='⚠'
else
battery_pluggedin='⚡'
fi
echo "$battery_pluggedin$battery_charge | $date_fmt | $current_time "
sleep 5
exec $0