Better battery prompt + added letters
This commit is contained in:
@@ -1,16 +1,33 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
BATTERY=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state|to full|percentage" | awk -F': +' '
|
#BATTERY=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state|to full|percentage" | awk -F': +' '
|
||||||
/state:/{s=$2}
|
# /state:/{s=$2}
|
||||||
/time to full:/{split($2,a,",");h=int(a[1])}
|
# /time to full:/{split($2,a,",");h=int(a[1])}
|
||||||
/percentage:/{gsub(",",".",$2);p=$2}
|
# /percentage:/{gsub(",",".",$2);p=$2}
|
||||||
END{if(s=="charging") printf("%dh - %.2f%%\n",h,p)}
|
# END{if(s=="charging") printf("%dh - %.2f%%\n",h,p)}
|
||||||
')
|
#')
|
||||||
DATE=$(date +'%Y-%m-%d %X')
|
BATTERY=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | awk -F': +' '
|
||||||
VOLUME=$(echo "$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}') vol")
|
/state:/{state=$2}
|
||||||
|
/time to full:/{time_full=$2}
|
||||||
|
/time to empty:/{time_empty=$2}
|
||||||
|
/percentage:/{gsub(",",".",$2); percentage=$2}
|
||||||
|
END{
|
||||||
|
if (state == "charging") {
|
||||||
|
printf("B-P: %s - %.2f%%\n", time_full, percentage);
|
||||||
|
} else if (state == "discharging") {
|
||||||
|
printf("B-U: %s - %.2f%%\n", time_empty, percentage);
|
||||||
|
} else {
|
||||||
|
printf("B: %s - %.2f%%\n", state, percentage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
')
|
||||||
|
DISK=$(echo D:$(df -h / | awk 'NR==2 {print $5}'))
|
||||||
|
|
||||||
CPU=$(uptime | awk -F'load average:' '{ print $2 }' | awk '{ gsub(",", "", $1); gsub(",", "", $2); gsub(",", "", $3); print $1 " - " $2 " - " $3 }')
|
DATE=$(date +'%Y-%m-%d %X')
|
||||||
|
VOLUME=$(echo "V: $(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}')")
|
||||||
|
|
||||||
|
CPU=$(uptime | awk -F'load average:' '{ print $2 }' | awk '{ gsub(",", "", $1); gsub(",", "", $2); gsub(",", "", $3); print " L: " $1 " - " $2 " - " $3 }')
|
||||||
echo "$CPU | $VOLUME | $BATTERY | $DATE"
|
echo "$CPU | $VOLUME | $BATTERY | $DATE"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user