I would like the sound and the image from the TV to switch automatically after connecting the HDMI. Currently, after connecting, for example, a TV via the HDMI port, there is basically no problem with the image. The sound must be manually switched in the “Sound” applet.
Has anyone tried this or other solutions? Do you have any suggestions for solving this problem?
I am a Linux beginner so please give me a detailed explanation.
When working with issues in fedora the first step should always be to do a full system update in case you have not already received a fix that may affect your issue. Please do sudo dnf upgrade then reboot and try again so you can tell if it has already been solved for you with a software update.
It may also be related to the HDMI cable in use. Some earlier and less expensive cables are designed to only carry the minimum data for video and do not support audio, and the system will not configure the hdmi audio device if it does not see the sink (in your case the TV) audio device at the other end. The fix for that is to try a different hdmi cable and possibly purchase a new & better cable.
# Connect your HDMI cable and select the output audio manually to this connection.
# Please make sure the audio already played from the HDMI.
# Move any contents inside `~/.local/state/wireplumber` to other place as backup.
mv ~/.local/state/wireplumber ~/to/backup/folder
# This command will reinitialize your ALSA profile.
# Restart pipewire and wireplumber
systemctl --user restart pipewire
systemctl --user restart wireplumber
# Check again with `wpctl status`.
# If you can find the sinks to HDMI, change the default to HDMI with `wpctl set-default ID` above.
Assuming you’re using gnome:
On pavucontrol on the output devices tab make sure your hdmi output is set to be the fallback device.
It is the box on the far right of the screen on the line with the audio devices name in it with a check icon.
Mine looks something like:
You can also install: gnome-shell-extension-sound-output-device-chooser
You will still have to switch, but you should be able to do it with out opening additional applications. Left click on the (network/sound/power icon on the right) and you should be able to change it from there.
If that doesn’t work for you can start looking at doing something with udev and a script to automatically swap it or you can use a manual command to toggle or set it to what you want.