0

I am running i3wm and am setting up keybindings for it. I would like to use a set of keybindings to control the volume of my system.

I have set a key to: exec pactl set-sink-mute 0 toggle

Pressing this key has no effect. I can however run pactl set-sink-mute 0 toggle in my terminal and it works. However when run as root (sudo pactl ...) it fails with:

Connection failure: Connection refused pa_context_connect() failed: Connection refused

However it acts as expected when called as a user.

FYI I am running arch linux.

  • Pulseaudio by default runs as the logged in user, so it will only react to pactl as the logged in user (unless you give other users permissions). The more interesting question is why your i3wm is running as root, usually the WM should also run as the user who is connected to X. If you run your WM this way (as I do), pulseaudio keybindings will just work out of the box. – dirkt Jul 24 '18 at 8:30
  • How are you starting i3? Even if it's not running as root, it needs to have e.g. XDG_RUNTIME_DIR in its environment so that pactl can find the PulseAudio server socket. – Vladimir Panteleev Jul 25 '18 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.