Skip to main content

Portname: Rename Audio Ports on Linux

Ever wished you could change "Line Out" to "JBL Headset" or "Headphones" to "Pebble Speakers" in your Sound Settings? Now you can.

Portname lets you rename the audio input/output ports that appear in your system's Sound Settings panel. Works with PipeWire and ALSA on any Linux distribution, for both built-in sound cards and USB audio devices.

Before & After

Before:                              After:
  Line Out                             JBL Headset
  Starship/Matisse HD Audio            Starship/Matisse HD Audio

  Headphones                           Pebble Speakers
  Starship/Matisse HD Audio            Starship/Matisse HD Audio

Install

pip install portname

To update to the latest version:

pip install --upgrade portname

Alternative, install from source:

git clone https://github.com/offbyonebit/portname.git
cd portname
chmod +x install.sh
./install.sh

To update a source installation, run these commands from its checkout. The installer must be run again because it copies the code into /usr/lib/portname:

git pull --ff-only origin master
./install.sh
sudo portname repair

Usage

Just run portname or find Portname in your application menu. Click Rename next to any audio port, type a new name, and enter your password when prompted.

Command Line

# List all audio devices and ports
portname list

# Rename a port (requires sudo)
sudo portname rename analog-output-lineout "JBL Headset"
sudo portname rename analog-output-headphones "Pebble Speakers"
sudo portname rename analog-input-rear-mic "JBL Headset Mic"

# When several devices share a route, select the device shown by 'portname list'
sudo portname rename analog-stereo "USB Headset" --device alsa_card.usb-Generic_USB_Audio_1234-00

# Revert a single port
sudo portname revert analog-output-lineout

# Revert all renamed ports
sudo portname revert --all

# Check for renames clobbered by a package upgrade and re-apply them (Arch/Fedora)
sudo portname check

# Recover missing ports left by older versions (also available in the GUI)
sudo portname repair

# Toggle Auto-Mute Mode (fixes issue where front jack silences rear jacks)
portname auto-mute off
portname auto-mute on
portname auto-mute status

How It Works

Portname picks the method for you based on the device.

Built-in (PCI/HDA) sound cards

Audio port names on Linux come from ALSA card profile path files in /usr/share/alsa-card-profile/mixer/paths/. Portname:

  1. Backs up the original file to <name>.conf.orig
  2. Writes a modified copy with your custom name
  3. Restarts PipeWire so the change appears immediately

Your custom names survive reboots. On Debian/Ubuntu the backup is registered with dpkg-divert, which also tells the package manager to skip the file on upgrades. On other distros (Arch, Fedora, etc.) the backup/restore logic is identical but there is no package-manager hook. An upgrade of alsa-card-profile can silently overwrite the modified file. Run sudo portname check after such an upgrade to detect and automatically re-apply any clobbered names. AUR/Copr package descriptions should note this and suggest adding a post-upgrade hook that calls portname check.

Recovering missing ports on Linux Mint / Ubuntu

Older versions could leave the original profile in a .conf.distrib backup while looking for .conf.orig. After updating, click Repair Missing Ports in the GUI or run sudo portname repair. This restores missing profiles even when no custom name was saved, and reapplies saved names where available. Existing .distrib diversions are supported without manual removal. Repair keeps the original backup and reports any files it cannot recover. It also restores overwritten USB rename rules. Revert all removes both the rules and saved USB names, so repair will not bring reverted names back.

USB audio devices

USB devices (headsets, DACs, webcams) have no ALSA profile path to edit, so portname rename writes a WirePlumber rule instead and restarts PipeWire. The command is the same as for built-in cards. Portname detects your WirePlumber version and writes the matching format:

  • WirePlumber 0.4 (Ubuntu 24.04, Linux Mint 22): a Lua rule at /etc/wireplumber/main.lua.d/90-portname-<node>.lua
  • WirePlumber 0.5+: a config rule at /etc/wireplumber/wireplumber.conf.d/90-portname-<node>.conf

portname revert deletes the rule, and ./install.sh --uninstall removes any left over.

A WirePlumber rule renames the device (the sink or source), not the port label. Portname also uses one when two identical USB cards share a port, so renaming one card does not rename both. portname list then shows [device renamed: <name>] next to the unchanged port label, and the new name appears in apps that list devices, such as pavucontrol or wpctl status.

Compatibility

Distro Status
Linux Mint 22 Fully tested
Ubuntu 22.10+ Fully tested
Arch Linux Core features tested via CI, real-machine audio feedback not yet verified
Fedora Core features tested via CI, real-machine audio feedback not yet verified
Other PipeWire distros Should work, but untested

Arch / Fedora users: portname works on your distro, but hasn't been tested by a real person on real hardware yet. If something doesn't behave as expected, names not showing up in Sound Settings, the audio system not restarting, anything, please open an issue and describe what happened. That feedback is how we close the gap.

Does not work on distros still using PulseAudio without PipeWire.

Requirements

  • Linux with PipeWire (standard on most distros from 2022 onward)
  • Python 3.8+
  • GTK3 via PyGObject (pre-installed on most desktop Linux distros)

Uninstall

cd portname
./install.sh --uninstall

This reverts all renamed ports to their original names and removes portname.

Support

This project is free and I don't ask for anything. If it's useful to you, a star on the repo is appreciated, and if you want to follow along with other things I'm building, you can find them under @offbyonebit.

If you'd like to support development, you can sponsor me on GitHub.

License

MIT

Metadata

Release files for portname 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for portname 1.1.1
File Size Uploaded Provenance Actions
portname-1.1.1.tar.gz 37.5 kB Without provenance Details for portname-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for portname 1.1.1
File Interpreter ABI Platform Actions
portname-1.1.1-py3-none-any.whl Python 3 none any Details for portname-1.1.1-py3-none-any.whl

Total release size: 61.7 kB

Release files / portname-1.1.1.tar.gz

Download URL portname-1.1.1.tar.gz
Size 37.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8e25bb62d26ac5f4eacd5ea5ee9b67842fa92a69491471d84d4efbe010a5a0a4
BLAKE2b-256 checksum
How to use checksums
d8b0733444d5ce571b11f691e2349a747ed0a4a12e9f3a289a659a6a2f0ce4b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / portname-1.1.1-py3-none-any.whl

Download URL portname-1.1.1-py3-none-any.whl
Size 24.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
553790bf0d00c1164346704f464e404e190e931542c268c3e29c87d4b10a4dc3
BLAKE2b-256 checksum
How to use checksums
f46e118c532ffabef57d6c1b8e23dad6bf9da1fb05038390db76aadac230d4bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for portname 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page