fix(scripts): switch pactl to wpctl

This commit is contained in:
Tibo De Peuter 2026-09-24 18:00:20 +02:00
parent bdfa3988f9
commit 956c7718a4
No known key found for this signature in database
GPG key ID: 9187B5FA0F4B6F6D

View file

@ -22,15 +22,15 @@ while getopts ":bvt:p:" options; do
;; ;;
v) v)
# Get volume (don't use pamixer because that is way slower) # Get volume (don't use pamixer because that is way slower)
value=$( pactl get-sink-volume @DEFAULT_SINK@ \ float=$( wpctl get-volume @DEFAULT_SINK@ \
| grep -o '[0-9]*%' \ | grep -Eo '[01].[0-9]{2}' )
| tr -d '%' \ # Converting to base 10 to drop leading zeroes
| head -n1 ) value="$(( 10#"$( tr -d '.' <<< "${float}" )" ))"
title="Volume: ${value}%" title="Volume: ${value}%"
category='sysinfo' category='sysinfo'
# If audio disabled, set value to zero. # If audio disabled, set value to zero.
if [ "$( pactl get-sink-mute @DEFAULT_SINK@ | grep -o '\(yes\|no\)' | head -n1 )" == 'yes' ] ; then if [ ! -z "$( wpctl get-volume @DEFAULT_SINK@ | grep '[MUTED]' )" ] ; then
title="Volume: ${value}% (Disabled)" title="Volume: ${value}% (Disabled)"
value=0 value=0
fi fi