The command is working so far as expected.
During a session i activate my bluetooth headset -> notebook with enabled bluetooth connects
After disabling my bluetooth headset the notebook falls back to build in audio device but not to hdmi audio (my default -> audio conn to hdmi monitor)
a default.pa can't be found but exist in /etc/pulse/...
If i set manually or by command see above my default sink to hdmi it also survive a reboot all good so far.
Only the "fallback to hdmi audio after using bluetooth" during a running session will not work as expected.
I am really not sure on this one. The default.pa in /etc/pulse should work.
You might try creating a udev rule with a script, instead. This will then manage disconnecting from headphones to redirect to HDMI sound output.
Create new document in your home directory and name it.
For this example, I will name it hdmi-sound.sh.
Open the file with text editor and paste in:
I configured the missing files as described and tested the *.sh if it does it's job - ok no errors and the ~/.config/pulse/**-default-sink switches (back) to hadmi audio.
I rebooted (weather nescessary or not) and tried to activate my bt headset (ok - as before) then turned it off ... waited a couple of seconds but the default-sink stays switched to bluez_sink.50_C2_75_E6_AD_3B.a2dp_sink
After several seconds i triggered the hdmi-sound.sh manual by terminal and after 3-4 seconds my default-sink was back on hdmi.
So the script work so far but does not be triggered automatically by the mechanism of switching on / off my bt headset.
It is a Jabra in Ear that switches of when i set the headset into its charging box.
The Bt Icon of ZorinOS disappear in the same moment i close the charging box.
Any further ideas?
i looked at my logs journalctl -a | grep udevd
and see entries like Okt 18 13:25:44 pc121 systemd-udevd: hci0:256: Process '/home/$USER/.config/pulse/hdmi-fallback.sh' failed with exit code 1.
the file "hdmi-fallback.sh" has following rights -rwxrwxr-x 1 $USER $USERGROUP 83 Okt 18 12:29 hdmi-fallback.sh
and i can run it from user terminal without errors.
setting the rights of hdmi-fallback.sh to $USER:root delivers same errors...
So the udev rule 99... is triggered but the RUN command fails...
Any ideas what causes udev to throw these errors?
I tried to run the script from a sudo shell (sudo su) # /home/$USER/.config/pulse/hdmi-fallback.sh
or # sudo -u $USER /home/$USER/.config/pulse/hdmi-fallback.sh
always delivers an error Es läuft kein PulseAudio-Dienst oder nicht als Sitzungsdienst.
(no pulseaudio service running nor as session service)
So the udev rules run as system service? -> then the exit code 1 maybe reference to the circumstance that the ENV system service is unlike user context...
So i don't know how to tell udev to run the script as $USER instead of system service?
As mentioned above same script running in $USER shell works as expected!