Add --refresh to repair stale device IDs, and rename to audioswitch

Windows gives a device a new endpoint ID when it reappears as another
instance, typically a DAC moved to a different USB port, which also
gains a "2- " name prefix. The old config line then silently dropped out
of the cycle. --refresh re-points each stale line at the present output
with the same name (ignoring that prefix), keeps order and comments, adds
unmentioned outputs as commented-out lines, and keeps a .bak of the
previous file.

Also replace every remaining "win-audio-output-switcher" with
"audioswitch": the config now lives in %APPDATA%\audioswitch, and the
autostart Run value and single-instance mutex use the new name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
khannurien
2026-09-19 13:43:55 +00:00
parent c2825fa062
commit 70494e96bc
4 changed files with 209 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
# win-audio-output-switcher
# audioswitch
A global hotkey that cycles the Windows 11 default audio output, and a flyout that tells
you where you landed.
@@ -76,6 +76,7 @@ $old = [Environment]::GetEnvironmentVariable('Path', 'User')
audioswitch Run in the background (single instance)
audioswitch --list List outputs and their endpoint IDs
audioswitch --config Create/open the config file
audioswitch --refresh Update config device IDs to match current outputs
audioswitch --quit Stop the running instance
audioswitch --autostart on Start with Windows (off to undo)
```
@@ -89,7 +90,7 @@ GUI-subsystem binary, a shell may hand back the prompt before the output arrives
## Config
`%APPDATA%\win-audio-output-switcher\config.ini`, created by `--config` already populated
`%APPDATA%\audioswitch\config.ini`, created by `--config` already populated
with the outputs you have right now. Edits apply on the next hotkey press — no restart.
```ini
@@ -106,6 +107,13 @@ osd_fade = false
{0.0.0.00000000}.{ff879682-...} = Haut-parleurs (Focusrite USB Audio)
```
Windows sometimes gives a device a new endpoint ID. Plugging a DAC into a different USB
port is the usual cause, and its name gains a `2- ` prefix as well. The old line then
silently drops out of the cycle. `audioswitch --refresh` fixes this. It moves each stale
line to the present output with the same name (ignoring that prefix), keeps your order and
comments, and adds outputs the file doesn't mention yet as commented-out lines. The
previous file is kept as `config.ini.bak`.
`osd_fade` is off by default. Fading needs `WS_EX_LAYERED`, which on some builds suppresses
the acrylic backdrop that makes the flyout look like part of the shell. Turn it on and see
which you prefer on your machine.