Only show the int value of the battery percentage by default, rather than including the decimals.
This commit is contained in:
@@ -2,7 +2,17 @@
|
||||
# 2025-11-10 Hyperling
|
||||
|
||||
function battery-display {
|
||||
detailed="N"
|
||||
if [[ -n $1 ]]; then
|
||||
detailed="Y"
|
||||
fi
|
||||
|
||||
if [[ "$detailed" == "Y" ]]; then
|
||||
upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | grep -o "[0-9.%]*"
|
||||
else
|
||||
int="`upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | grep -o "[0-9]*" | head -n 1`"
|
||||
echo "${int}%"
|
||||
fi
|
||||
}
|
||||
alias show-battery="battery-display"
|
||||
alias battery="battery-display"
|
||||
|
||||
Reference in New Issue
Block a user