My laptop's audio output port is screwed up and only the left channel works. So I have my laptop connected by HDMI to a 22" monitor and a 3-feet aux cable hooked up to the audio output of the monitor. Linux Mint always toggles to the default sound output device so I use this systemd user service to toggle the HDMI output device.
Make sure you have pactl
available on your system.
- Run
pactl list
- Note the valid
output:
entries under theProfiles
section and theActive Profile
. At boot time, we need to set the active profile to one of the validoutput:*
options (output:hdmi-stereo
in my case) - Create a systemd user service file at
~/.config/systemd/user/set-sound-profile.service
with the following contents:
[Unit]
Description=Set default sound output device
Requires=sound.target dbus.service
After=sound.target dbus.service
[Service]
Type=simple
ExecStart=/usr/bin/pactl set-card-profile 0 output:hdmi-stereo
[Install]
WantedBy=default.target
- Remember to change
0
(per your system sound cards) andoutput:hdmi-stereo
(per valid profiles on your system) in the above file - Enable and start the systemd user service:
systemctl --user daemon-reload
systemctl --user enable set-sound-profile.service
systemctl --user start set-sound-profile.service