On 19/10/2024 20:17, Greg Wooledge wrote:
So, in conclusion, I really don't understand*nearly* enough about what's happening here.
Do not forget about udev + systemd-logind uaccess feature that removes and adds ACLs to audio devices to the active user on VT switching.
You may use "ps auxfw" and systemd-cgls to check process tree. Some PAM sessions include the systemd module that may start PulseAudio or PipeWire.
Root likely can write to user's sockets under XDG_RUNTIME_DIR if environment is preserved. Another user can not do it.
I expect that after "loginctl enable-linger USER" some processes from systemd user session should be running even prior to user login, but with no access to audio devices.
P.S. Since gnome-terminal was mentioned, I would consider notify-send for desktop notifications instead of "beep". It should be possible to emit different events and to configure distinct sound files for them.