running
me$ sudo -u me $command
fails, while
me$ sudo -E -u me $command
works. But I didn't find variables related to pulse in my enovirenment.
Any suggestions (I don't even know what to search for right now)?
]]>I have a working script that can detect if the HDMI output is plugged or not and switch pulseaudio to the correct setting:
#! /bin/bash
if [ /sys/class/drm/card0-HDMI-A-1/status == "connected" ]; then
notify-send -u normal -t 500 -i gnome-sound-properties "HDMI On" "Sound to HDMI"
pacmd "set-card-profile 0 output:hdmi-stereo"
else
notify-send -u normal -t 500 -i gnome-sound-properties "HDMI Off" "Sound to Internal"
pacmd "set-card-profile 0 output:analog-stereo"
fi
additionally I have in the udev a rule that triggers when the HDMI is plugged or unplugged:
SUBSYSTEM=="drm", ACTION=="change", RUN+="/bin/bash /etc/pulse/hdmi-switch"
Unfortunatly the first script only works if executed as the logged in user. Not when run as root. Does anybody have an idea how to get this combination working or how to get pulseaudio to switch the audio output when HDMI is (un-)plugged?
]]>