marioortizmanero / polybar-pulseaudio-control

A feature-full Polybar module to control PulseAudio
MIT License
471 stars 49 forks source link

Run pactl with preset language #6

Closed wgorecki closed 4 years ago

wgorecki commented 4 years ago

pactl runs with system language while script expects english. pactl has to be ran with language set to english. Otherwise, it will not update changes such as volume level, mute on/off.

marioortizmanero commented 4 years ago

Is this the only call where LANG=$LANGUAGE is needed? I call pactl a few more times in the script too.

wgorecki commented 4 years ago

Yes. pactl is called multiple times but only two calls rely on it's output. First call is on line 144th: inputs=$(pactl list sink-inputs short | cut -f 1) inputs contains sink ids which are numbers, no need to specify language. Example:

10:09:30 [~] > pactl list sink-inputs short | cut -f 1
53
62

The second one is pactl subscribe

When used with english:

on 1st terminal
10:19:05 [~] > LANG=en pactl subscribe | grep -e "on card" -e "on sink" -e "on server"
Event 'change' on sink #7

2nd terminal
10:19:18 [~] > pactl set-sink-mute alsa_output.pci-0000_26_00.1.hdmi-stereo-extra1 0

When used with system language:

1st terminal
10:19:57 [~] > pactl subscribe | grep -e "on card" -e "on sink" -e "on server"

10:20:06 [~] > 

2nd terminal
10:20:02 [~] > pactl set-sink-mute alsa_output.pci-0000_26_00.1.hdmi-stereo-extra1 0

Example for polish language:

10:17:26 [~] > pactl subscribe
Zdarzenie „nowy” w klient #6956
Zdarzenie „usuń” w klient #6956
Zdarzenie „nowy” w klient #6957
Zdarzenie „usuń” w klient #6957
Zdarzenie „nowy” w klient #6958
marioortizmanero commented 4 years ago

Great, thanks for the detailed answer and the PR.