No longer calls cat twice
This commit is contained in:
@@ -25,8 +25,6 @@ esac
|
|||||||
# Defines the formatting for the info from the battery folders
|
# Defines the formatting for the info from the battery folders
|
||||||
format()
|
format()
|
||||||
{
|
{
|
||||||
# Will make a warn variable if discharging and low
|
|
||||||
[ $(cat "$1/status") = "[Dd]ischarging" ] && [ $(cat "$1/capacity") -le 25 ] && local warn="❗ "
|
|
||||||
# Sets up the status and capacity
|
# Sets up the status and capacity
|
||||||
status=$(cat "$1/status")
|
status=$(cat "$1/status")
|
||||||
case "$status" in
|
case "$status" in
|
||||||
@@ -44,6 +42,8 @@ format()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
capacity=$(cat "$1/capacity")
|
capacity=$(cat "$1/capacity")
|
||||||
|
# Will make a warn variable if discharging and low
|
||||||
|
[ "$status" = "🔋 " ] && [ "$capacity" -le 25 ] && local warn="❗ "
|
||||||
# Prints the info
|
# Prints the info
|
||||||
printf "%s%s%d%%\n" "$status" "$warn" "$capacity"
|
printf "%s%s%d%%\n" "$status" "$warn" "$capacity"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user