An OpenDeck plugin for Linux. Each key switches your default audio device from your own list:
- Press: mute or unmute the active device. A muted key shows its icon dimmed, with a red slash.
- Hold (half a second): switch to the next connected device in the key's list. Disconnected devices, such as a Bluetooth headset that's off, are skipped.
There are two key types, Audio output and Audio input. Each key has its own ordered list of devices, and each device in the list has its own icon and an optional label. The key always shows the active device's icon, and it updates straight away when you switch or mute somewhere else, for example from the desktop's volume applet.
Works on any desktop (KDE Plasma, GNOME, XFCE, …): it talks to the sound server, not to the desktop. Tested on KDE Plasma 6.
-
Drag Audio Switcher → Audio output (or Audio input) onto a key.
-
In the key's settings, add devices with + Add device, or + Add current device. Then put them in the order you want with ▲ ▼.
-
Optionally, give each device an icon:
- an icon-theme name such as
audio-headphones,audio-speakers,audio-headsetoraudio-input-microphone. These follow your current icon theme (KDE, GNOME or GTK) and update when you switch themes. - or a path to a PNG/SVG file.
An empty icon uses a default speaker or microphone icon. If the active device isn't in the key's list, the key shows the default icon with the device's name.
- an icon-theme name such as
-
Optionally, give each device a label: short text (up to 14 characters) shown under the icon, for example
XLRorHeadphones. The icon shrinks a little to make room, and the text size fits the key.
- Talking to the sound server:
pactl. This works with PipeWire (throughpipewire-pulse) and with PulseAudio.- Switching:
set-default-sink/set-default-source. Apps follow the new default. - Muting:
set-sink-mute/set-source-mute … toggle. Mute belongs to each device. - Live updates:
pactl subscribe.
- Switching:
- Saved devices: stored by their node name, which stays the same across reboots and replugging.
- Hold time: 500 ms.
- Inputs: the speaker "Monitor of …" sources are left out of the input list.
- No dependencies: plain Node.js, using its built-in WebSocket (Node 22 or newer).
- Linux with PipeWire (
pipewire-pulse) or PulseAudio. Any desktop environment. pactl(packagepulseaudio-utilson Debian/Ubuntu).- Node.js 22+ on the host.
Copy or clone this folder into OpenDeck's plugins folder, keeping the folder name
io.github.cptsoviet.audioswitch.sdPlugin, then restart OpenDeck:
- Native OpenDeck:
~/.config/opendeck/plugins/ - Flatpak OpenDeck:
~/.var/app/me.amankhanna.opendeck/config/opendeck/plugins/
The plugin has to run outside the sandbox to reach the sound server and read icons.
start.sh runs $NODE_BIN (default: node), so point NODE_BIN at a small wrapper that runs
the host's Node:
mkdir -p ~/.var/app/me.amankhanna.opendeck/data/bin
cat > ~/.var/app/me.amankhanna.opendeck/data/bin/node-host <<'EOF2'
#!/bin/sh
exec flatpak-spawn --host --watch-bus /usr/bin/node "$@"
EOF2
chmod +x ~/.var/app/me.amankhanna.opendeck/data/bin/node-host
flatpak override --user --talk-name=org.freedesktop.Flatpak \
--env=NODE_BIN=$HOME/.var/app/me.amankhanna.opendeck/data/bin/node-host \
me.amankhanna.opendeck(The same setup as App Badges. If you already did it for that plugin, you're set.)
MIT, see LICENSE.