You are not logged in.
As per the pipewire wiki page says, first I determine the node number of the 2 concerned sinks using wpctl status:
...
Audio
├─ Devices:
│ 48. Navi 10 HDMI Audio [alsa]
│ 62. JDS Labs Atom DAC+ [alsa]
│ 64. Starship/Matisse HD Audio Controller [alsa]
│
├─ Sinks:
│ * 32. JDS Labs Atom DAC+ Analog Stereo [vol: 1.00]
│ 46. Starship/Matisse HD Audio Controller Digital Stereo (IEC958) [vol: 1.00]
│ 70. Navi 10 HDMI Audio Digital Stereo (HDMI 4) [vol: 0.40]
...
I determined that node 32 and node 46 are 2 sinks that I want to switch on-the-fly
After that, this script is what i have so far:
pipewire-switch-default
#!/bin/sh
# Script to switch between speaker and headphones using wireplumber
# assumed IDs are 32 (for headphones) and 46 (for speakers)
TOGGLE=$HOME/.toggle
if [ ! -e $TOGGLE ]; then
touch $TOGGLE
wpctl set-default 32
else
rm $TOGGLE
wpctl set-default 46
fi
Now normally this would work as I tested it multiple times, but after a reboot, the nodes numbers randomized and mess up my script. Is there a way to set a default sink in WirePlumber using something more permanent across system reboots? I have an idea to write 2 Lua scripts that sets the nodes priority, but i am not sure how to make WirePlumber loads the correct one on-the-fly as I understand it, policies and configs are loaded at startup time.
Offline