eval "env $(cat /proc/"$(pgrep -n xterm)"/environ |xargs -0 -n1 printf '%q ') bash"
To get the environment setup right. eval "env $(cat /proc/"$(pgrep -n xterm)"/environ |xargs -0 -n1 printf '%q ') bash"
To get the environment setup right.Thank god for NixOS where (1) we do a decent job of base config and (2) user config errors are basically trivially identifiable.
1. Open `pulsemixer` to monitor pulse clients
2. `ssh localhost "pacat < /dev/urandom"`
Observe that pacat is showing as a pulse client. This stuff is really easy and should absolutely just work.
1. (term1) `ssh remote pulsemixer`
2. (term2) `ssh remote "pacat </dev/urandom"`
Observe that (1) you can see a new client appear on the remote, and (2) audio will play from the default playback device on the remote (and you can trivially change that device with `pulsemixer`)
EDIT: for your speakers/ears-sake, I recommend turning down the default playback device before doing this.
If you use PulseAudio or pipewire-pulse on your local computer and that both computers are on the same network (or at least the machine you ssh into can access your local machine, possibly through a tunnel - PulseAudio listen to port 4713 by default), you can set the PULSE_SERVER environment variable.
PULSE_SERVER=X.X.X.X whatever_should_play_a_sound
Where X.X.X.X is the domain or IP of your local machine. Your local machine needs to be configured to allow remote computers to play sound locally (by loading module module-native-protocol-tcp as far as I know - a papref setting is available for PulseAudio).If the computer you ssh into has Pulseaudio or pipewire-pulse, on your local machine you can run:
PULSE_SERVER=Y.Y.Y.Y pavucontrol
Where Y.Y.Y.Y is your ssh server, and set the default output sink to your local computer's. Then it will play things through your local computer. You need to setup your local computer so it advertises its PulseAudio service, and your server needs to have the module-zeroconf-discover module loaded.You can load a module with pactl (for both PulseAudio or pipewire-pulse):
pactl load-module module-zeroconf-discover
pactl load-module module-native-protocol-tcp listen=0.0.0.0
edit: and if you just want to play something on your remote machine, then `PULSE_SERVER=localhost` can work. export $(dbus-launch) instead of your command possibly works too. With Pipewire on Debian I noticed it works out of the box though.PULSE_SERVER=localhost or export $(dbus-launch) could work.
1. I misremembered it was an alsa-client that couldn't use the pipewire virtual device.
2. your mention of dbus did help though; setting DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus seems to do the trick.
(And yes, I use pipewire. The socket is pipewire-pulse's.)
This pulseaudio approach might work with pipewire too -- I haven't tested it but I love this text-mode audio player... https://mathr.co.uk/harry/#sound