/ website / blog

rename pulseaudio sinks

February 21, 2020

One might notice the names of output devices (called “sinks”) that pulseaudio uses are not very pretty. Unless you’re a robot, something like pci-0000_0b_00.1.hdmi-stereo just doesn’t roll off the tongue quite like, Headphones. Fortunately, there is a way to reconfigure the names to whatever we want them to be.

First, get a list of the sinks pulseaudio is aware of …

$ pacmd list-sinks | grep name: | fields 2 | sed 's/<//g' | sed 's/>//g'
alsa_output.usb-0c76_USB_PnP_Audio_Device-00.analog-stereo
alsa_output.pci-0000_0b_00.1.hdmi-stereo
alsa_output.pci-0000_0d_00.4.analog-stereo

That is a list of the three output devices plugged into my computer. Actually, one of them happens to be a microphone that reports itself as both a sink and a source.

Now create a file at ~/.config/pulse/default.pa that includes an include directive and a list of our devices with our preferred names. For me, the file ends uplooking like this …

$ cat .config/pulse/default.pa 
.include /etc/pulse/default.pa
update-sink-proplist alsa_output.usb-0c76_USB_PnP_Audio_Device-00.analog-stereo device.description="Ignore"
update-sink-proplist alsa_output.pci-0000_0b_00.1.hdmi-stereo device.description="Headphones"
update-sink-proplist alsa_output.pci-0000_0d_00.4.analog-stereo device.description="Google Max"

That include directive is important - we still want all of the normal pulseaudio configuration to be loaded first.

Beyond that, we use the update-sink-proplist command to create an alias for each sink using the device.description setting. In my case there are three of them, and I named them Headphones, Google Max, and Ignore.

If needed reboot (or logout/in) to get your desktop environment to detect and respect the changes. For Ubuntu / Gnome, the indicator thingy should list the custom names …

gnome

gl;hf!

➡️ related posts in the tweaks series ...