Views:
2,137β
Votes: 3β
β
Solution
Tags:
sound
suspend
hdmi
kodi
Link:
π See Original Answer on Ask Ubuntu β§ π
URL:
https://askubuntu.com/q/840543
Title:
Ubuntu changing default audio output after suspend
ID:
/2016/10/22/Ubuntu-changing-default-audio-output-after-suspend
Created:
October 22, 2016
Edited: June 12, 2020
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
Fixing PulseAudio switching from TV to Laptop on Suspend
This βundocumented featureβ appeared with Ubuntu 16.04 and new version of PulseAudio 8.
Create a new file /lib/systemd/system-sleep/tv-sound
and copy in:
#!/bin/sh
case $1/$2 in
pre/*)
echo "Going to $2..."
# Place your pre suspend commands here, or `exit 0`
# if no pre suspend action required
sleep 1
;;
post/*)
echo "Waking up from $2..."
# Place your post suspend (resume) commands here, or `exit 0`
# if no post suspend action required
sleep 2
export PULSE_RUNTIME_PATH="/run/user/1000/pulse/"
sudo -u rick -E pacmd set-card-profile 0 output:hdmi-stereo
;;
esac
NOTE: replace user name rick
(third line from the bottom) with your user name.
Then mark it executable with the command:
sudo chmod +x /lib/systemd/system-sleep/tv-sound
An additional step might be required if output:hdmi-stereo
(the device for most people) is different on your system.