Fix swaybar lighting getter

This commit is contained in:
Akemi Izuko 2023-12-23 20:14:18 -07:00
parent 47e36e0bbb
commit 8010c3189e
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC

View file

@ -11,12 +11,18 @@ battery_charge() {
} }
display_brightness() { display_brightness() {
local x
if command -v ddcutil &>/dev/null; then if command -v ddcutil &>/dev/null; then
ddcutil getvcp 10 | awk ' x="$(ddcutil getvcp 10 2>/dev/null |\
match($0, /[0-9]+,/) { printf "%s", substr($0, RSTART, RLENGTH - 1) }' awk 'match($0, /[0-9]+,/) { printf "%s", substr($0, RSTART, RLENGTH - 1) }')"
else
light -G | awk '{ split($0, a, "."); printf "%s", a[1] }'
fi fi
if [[ -z "$x" ]]; then
x="$(light -G | awk '{ split($0, a, "."); printf "%s", a[1] }')"
fi
printf "%s" "$x"
} }
get_volume() { get_volume() {