mirror of
https://git.adityakumar.xyz/dwmbar.git
synced 2024-11-09 14:19:43 +00:00
Update volume module to work with pactl
This commit is contained in:
parent
36382a2604
commit
d68a1e3372
1 changed files with 4 additions and 4 deletions
|
@ -6,11 +6,11 @@ VOLUME_ON_ICON=''
|
||||||
VOLUME_MUTED_ICON=''
|
VOLUME_MUTED_ICON=''
|
||||||
|
|
||||||
get_volume(){
|
get_volume(){
|
||||||
active_sink=$(pacmd list-sinks | awk '/* index:/{print $3}')
|
active_sink=$(pactl list short sinks | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,' | head -n 1)
|
||||||
curStatus=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | awk '/muted/{ print $2}')
|
curStatus=$(pactl get-sink-mute $active_sink)
|
||||||
volume=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | grep 'volume:' | grep -E -v 'base volume:' | awk -F : '{print $3}' | grep -o -P '.{0,3}%'| sed s/.$// | tr -d ' ')
|
volume=$(pactl get-sink-volume $active_sink | tail -n 2 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' | head -n 1)
|
||||||
|
|
||||||
if [ "${curStatus}" = 'yes' ]
|
if [ "${curStatus}" = 'Mute: yes' ]
|
||||||
then
|
then
|
||||||
echo "$VOLUME_MUTED_ICON $volume%"
|
echo "$VOLUME_MUTED_ICON $volume%"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue