22 lines
543 B
Text
22 lines
543 B
Text
|
#!/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
|