You are not logged in.

#1 2018-09-25 16:49:26

riri
Member
Registered: 2007-05-21
Posts: 28

[SOLVED-Hack] Multiple users on use PulseAudio

I start some programs on a different user from my X11 session (no DE), and I used the method explained on the wiki for that, but if it makes it working for the secondary user, clients from primary user can't work anymore. From what I understood with my tests:

I add in the ~/.config/pulse/default.pa:

load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/riri-pulse-socket

Which creates the socket in a shared folder to be accessible to other users

Then I put in /home/secondaryuser/.config/pulse/client.confg

default-server = unix:/tmp/riri-pulse-socket
autospawn = no

Which works perfectly. The problem is that primary clients can't connect to the server. So I tried to add the same on the primary user client.conf:

default-server = unix:/tmp/riri-pulse-socket

And then it works... until the next start, then pulseaudio --start (or any other method like the xdg desktop file) refuses to work, saying server has been configured by the user.
So how could I start the daemon, while having the default-server in client.conf ?

Cheers! riri

Edit to make it work

I leave the primary user configuration without the default-server settings, then immediately after starting pulseaudio, set the PULSE_SERVER environment variable and use pactl to publish environment variables to the X11 root window (which can be done automatically with the XDG autostart script too):

export PULSE_SERVER='unix:/tmp/riri-pulse-socket'
pactl load-module module-x11-publish "display=$DISPLAY"

Last edited by riri (2018-09-26 10:54:09)

Offline

Board footer

Powered by FluxBB