Skip to content

Instantly share code, notes, and snippets.

@gtirloni
Last active May 25, 2024 07:40
Show Gist options
  • Save gtirloni/4384f4de6f4d3fda8446b04057ca5f9d to your computer and use it in GitHub Desktop.
Save gtirloni/4384f4de6f4d3fda8446b04057ca5f9d to your computer and use it in GitHub Desktop.
How to disable audio devices with Pipewire

Find your devices

$ pactl list short

Create the Wireplumber rule to disable the device

$ mkdir -p $HOME/.config/wireplumber/main.lua.d
$ vi $HOME/.config/wireplumber/main.lua.d/51-disable-devices.lua
$ systemctl --user restart wireplumber

Tested on Fedora 38 with Wireplumber 0.4.14 and Pipewire 0.3.70

rule = {
matches = {
{
{ "device.name", "equals", "alsa_card.usb-046d_HD_Pro_Webcam_C920_44FFD86F-02" },
},
{
{ "device.name", "equals", "alsa_card.pci-0000_01_00.1" },
},
},
apply_properties = {
["device.disabled"] = true,
},
}
table.insert(alsa_monitor.rules,rule)
@lunatic-gh
Copy link

lunatic-gh commented May 25, 2024

For Wireplumber 0.5+, use the following instead:

<yourEditor> $HOME/.config/wireplumber/wireplumber.conf.d/51-disable-devices.conf

monitor.alsa.rules = [
  {
    matches = [
      {
        device.name = "~alsa_card.pci-*"
      },
      {
        device.name = "alsa_card.usb-Sony_Interactive_Entertainment_DualSense_Wireless_Controller-00"
      }
    ]
    actions = {
      update-props = {
      	device.disabled = true
      }
    }
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment