Alexander Gromnitsky's Blog

Renaming Devices in PipeWire

Latest update:

To rename a device description (for example, for a USB headset) you need to tweak your current PipeWire session manager settings.

At the time of writing, there are 2 of them available: Media Session & WirePlumber. Fedora 40 uses the latter.

To see which one you're running:

$ systemctl --user show pipewire-session-manager | grep -E ^Id\|SubState
Id=wireplumber.service
SubState=running

WirePlumber v0.5x uses a superset of JSON for its configuration, called SPA-JSON. It's the bizarre "enhancement" with no support from text editors (who is going to bother?), with exactly 1 redeeming feature: sh-style comments.

For out task, we need to create a file with a .conf extension in ~/.config/wireplumber/wireplumber.conf.d/ directory. For example, to rename a default built-in sink from a too generic "Built-in Audio Analog Stereo" to "Desktop Speakers":

monitor.alsa.rules = [
  {
    matches = [{ node.name = "alsa_output.pci-0000_30_00.6.analog-stereo" }]
    actions = {
      update-props = {
        node.description = "Desktop Speakers"
      }
    }
  },
  …
]

(To see how it looks like in regular JSON, type spa-json-dump file.conf.)

alsa_output.pci-0000_30_00.6.analog-stereo string is a node name. You can get it either from

$ pw-cli ls Node | awk 'BEGIN {RS="\n\tid "; ORS="\n\n"} /Sink/'

or

$ pw-dump | json -c 'this.info?.props["media.class"] === "Audio/Sink"' -a info.props

In any case, after you modify files in ~/.config/wireplumber/ directory, restart the PipeWire server:

$ systemctl --user restart pipewire


Tags: ойті
Authors: ag