The Pulseaudio source index integer doesn't just change on boot, it changes when you remove a USB device and plug it back in, too.

There are some more reliable ways to target the device.

1. Like Bert says, `pactl` recognizes the `@[email protected]` special name. It corresponds to whichever source Pulseaudio *currently* thinks is the default. This might be enough, but I wouldn't like to make any assumptions about what the default source currently is. Many desktop environments (Mate, Plasma) let you choose the default device via a GUI, and some distros also change the default device automatically when you plug in a USB sound card or headset.

2. You can target specific devices with `pactl`, using machine-names which seem to be reliable. Compare the output of `pulsemixer` with `pactl`...

$ # Shows some human readable names, and volatile ID integers
$ pulsemixer --list-sources
Source: ID: source-0, Name: Monitor of Built-in Audio Analogue Stereo, Mute: 0, Channels: 2, Volumes: ['100%', '100%']
Source: ID: source-1, Name: Built-in Audio Analogue Stereo, Mute: 1, Channels: 2, Volumes: ['55%', '55%']
Source: ID: source-8, Name: Monitor of G35 Headset Analogue Stereo, Mute: 0, Channels: 2, Volumes: ['100%', '100%']
Source: ID: source-9, Name: G35 Headset Mono, Mute: 0, Channels: 1, Volumes: ['80%'], Default

$ # Shows some reliable machine-names, and volatile ID integers
$ pactl list short sources
0 alsa_output.pci-0000_00_1b.0.analog-stereo.monitor module-alsa-card.c s16le 2ch 48000Hz SUSPENDED
1 alsa_input.pci-0000_00_1b.0.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
8 alsa_output.usb-Logitech_Logitech_G35_Headset-00.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
9 alsa_input.usb-Logitech_Logitech_G35_Headset-00.mono-fallback module-alsa-card.c s16le 1ch 44100Hz SUSPENDED

The latter tells you some machine names for the Pulseaudio sources, and you can target these directly:

$ pactl set-source-mute alsa_input.usb-Logitech_Logitech_G35_Headset-00.mono-fallback toggle

AFAICT these machine-names are reliable. The laptop's built-in devices are named after their PCI path, and the USB devices are named after the machine-readable vendor/model information. They remain the same across reboots and USB hot-plugging, and it doesn't matter which USB socket you use. I'm a bit suspicious of the `00` in the name of my headset; I suppose those digits would disambiguate sources if I plugged in two headsets of the same model? That's not something I'll be doing in practice. I don't know if the name changes when there are USB hubs/docks between the host and audio device.

3. Maybe you can write a `udev` rule which reacts to a particular device being plugged in, by telling Pulseaudio to treat it as the default source? I haven't tried that yet.