[pulseaudio-discuss] Change sound via acpid

Sean Greenslade sean at seangreenslade.com
Tue Dec 22 21:50:38 PST 2015

On December 23, 2015 12:39:57 AM EST, John W <jwdevel at gmail.com> wrote:
>I'm trying to make the mute/unmute key on my laptop work.
>It generates acpi events, but does not generate XF86AudioMute X11
>message - In fact, I prefer it to be that way, since I don't want to
>rely upon X11 running in order to do this.
>I'm trying to figure out the "right" way to do this.
>N.B.: It is my understanding that running in system mode, while it may
>work, is not the "right" way to do this. I am looking for an
>alternative to that, if possible.
>My acpi script runs (as root), and I want it to toggle the mute state.
>I tried "amixer set Master toggle", but that doesn't work as root.
>I can reproduce it with "sudo" - see below:
>    $ sudo amixer set Master toggle
>    ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to
>connect: Connection refused
>    amixer: Mixer attach default error: Connection refused
>From reading around, I came to learn that this can be caused by a
>missing "cookie" file.
>However, even copying the /home/myuser/.config/pulse/cookie file to
>/root/.config/pulse/cookie did not solve this issue.
>Question 0: Is there any way to get logging information about these
>denials, from pulseaudio? The usual advice is to run pulseaudio as a
>non-daemon, with "-vvvv" option. I can do this, but even so, none of
>these "Connection refused" incidents appear.
>Is there somewhere else I should look?
>Question 1:
>What other reason could there be for this "Connection refused" from
>pulse? Any ideas?
>Is there any good way for me to confirm that my copied cookie file is
>correct, to try to narrow down the problem?
>So, I abandoned that approach. Even in the best case, this would
>require re-copying the cookie every time I rebooted, or having my
>script figure out who spawned pulseaudio, then look in their user
>directory, etc. Seems hacky to me.
>I learned about "system mode", but given that the developers
>themselves say it is unsupported and bad, I am not touching that. Nor
>do I trust all that pulseaudio code running as root (:
>Next, I found out about the unix socket authentication options in
>I created /etc/pulse/client.conf, and added:
>    default-server = unix:/tmp/pulse-access-socket
>And made a corresponding change in /etc/pulse/default.pa:
>    load-module module-native-protocol-unix auth-anonymous=1
>But this does not seem to work.
>Looking at the manpages, there are some hints that maybe these options
>only apply in system mode? I am not sure...
>Question 2:
>Can anyone confirm or deny that that method is legitimate?
>And really, any other suggestions of how to get this to work are
>pulseaudio-discuss mailing list
>pulseaudio-discuss at lists.freedesktop.org

Have you seen this:


That's how I make the media keys on my machines work. I use my DE / WM's global shortcuts to trigger the scripts.

Also, IIRC amixer is for alsa. If you want to control pulse, that's probably the wrong way to do it, even if it did work.


More information about the pulseaudio-discuss mailing list