polybar: Ignore/abort on missing commands/files
Catch if the files needed in the battery module are missing and exit early. Do not mess up the bar by printing error messages. Instead abort.
This commit is contained in:
@@ -11,8 +11,8 @@ red='%{F#f00}'
|
||||
green='%{F#0f0}'
|
||||
end='%{F-}'
|
||||
|
||||
bat="$(cat /sys/class/power_supply/BAT0/capacity)"
|
||||
ac="$(cat /sys/class/power_supply/AC/online)"
|
||||
bat="$(cat /sys/class/power_supply/BAT0/capacity 2>/dev/null)" || exit
|
||||
ac="$(cat /sys/class/power_supply/AC/online 2>/dev/null)"
|
||||
declare -a ramp
|
||||
ramp=( )
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
command -v playerctl >/dev/null 2>&1 || { printf "playerctl not found.\n" >&2; exit 1; }
|
||||
command -v playerctl >/dev/null 2>&1 || exit 1
|
||||
|
||||
metadata="$(playerctl metadata --format '{{status}} {{artist}}' 2>/dev/null)"
|
||||
title="$(playerctl metadata --format '{{title}}' 2>/dev/null)"
|
||||
|
||||
Reference in New Issue
Block a user