Prevent error when having no battery (#731)
* Prevent error when having no battery * Send error to /dev/null instead of separate check
This commit is contained in:
parent
107a99f274
commit
a0c659d719
1 changed files with 1 additions and 1 deletions
|
@ -20,7 +20,7 @@ esac
|
|||
for battery in /sys/class/power_supply/BAT?
|
||||
do
|
||||
# Get its remaining capacity and charge status.
|
||||
capacity=$(cat "$battery"/capacity) || break
|
||||
capacity=$(cat "$battery"/capacity 2>/dev/null) || break
|
||||
status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/⚡/" "$battery"/status)
|
||||
|
||||
# If it is discharging and 25% or less, we will add a ❗ as a warning.
|
||||
|
|
Loading…
Reference in a new issue