add swaybar for minimalist battery + clock status
This commit is contained in:
parent
a191893dc6
commit
f39e227eb8
3 changed files with 40 additions and 2 deletions
bin
21
bin/sway-status
Executable file
21
bin/sway-status
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue