swaybar: +power status, +volume
This commit is contained in:
parent
6d50037111
commit
25c51046fa
1 changed files with 13 additions and 1 deletions
|
@ -5,13 +5,25 @@ function getPowerValue() {
|
||||||
echo $POWER
|
echo $POWER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPowerStatus() {
|
||||||
|
POWERSTATUS=$(cat /sys/class/power_supply/BAT0/status)
|
||||||
|
if [ "$POWERSTATUS" == "Charging" ]; then
|
||||||
|
echo "+"
|
||||||
|
else
|
||||||
|
echo "-"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function getDate() {
|
function getDate() {
|
||||||
echo $(date +'%Y-%m-%d %H:%M')
|
echo $(date +'%Y-%m-%d %H:%M')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getVolume() {
|
||||||
|
echo $(amixer get Master | grep 'Left:' | awk -F"[][]" '{ print $2 }')
|
||||||
|
}
|
||||||
|
|
||||||
while [ True ]; do
|
while [ True ]; do
|
||||||
echo "$(getPowerValue) | $(getDate)"
|
echo "$(getVolume) | $(getPowerValue)$(getPowerStatus) | $(getDate)"
|
||||||
sleep 30
|
sleep 30
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue