We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d26459b commit 55f0fa6Copy full SHA for 55f0fa6
scripts/battery_percentage.sh
@@ -7,9 +7,9 @@ source "$CURRENT_DIR/helpers.sh"
7
print_battery_percentage() {
8
# percentage displayed in the 2nd field of the 2nd row
9
if is_wsl; then
10
- local battery
11
- battery=$(find /sys/class/power_supply/*/capacity | tail -n1)
12
- cat "$battery"
+ if [ -e /sys/class/power_supply/*/capacity ]; then
+ echo $(cat $(find /sys/class/power_supply/*/capacity | tail -n1))%
+ fi
13
elif command_exists "pmset"; then
14
pmset -g batt | grep -o "[0-9]\{1,3\}%"
15
elif command_exists "acpi"; then
0 commit comments