swaybar: +power status, +volume

This commit is contained in:
Felipe M 2020-12-24 12:51:15 +01:00
parent 6d50037111
commit 25c51046fa
1 changed files with 13 additions and 1 deletions

View File

@ -5,13 +5,25 @@ function getPowerValue() {
echo $POWER
}
function getPowerStatus() {
POWERSTATUS=$(cat /sys/class/power_supply/BAT0/status)
if [ "$POWERSTATUS" == "Charging" ]; then
echo "+"
else
echo "-"
fi
}
function getDate() {
echo $(date +'%Y-%m-%d %H:%M')
}
function getVolume() {
echo $(amixer get Master | grep 'Left:' | awk -F"[][]" '{ print $2 }')
}
while [ True ]; do
echo "$(getPowerValue) | $(getDate)"
echo "$(getVolume) | $(getPowerValue)$(getPowerStatus) | $(getDate)"
sleep 30
done