Skip to content

Add "follow main output" support for system (alert) device#77

Open
schoenwaldnils wants to merge 1 commit into
deweller:masterfrom
schoenwaldnils:fix/follow-main
Open

Add "follow main output" support for system (alert) device#77
schoenwaldnils wants to merge 1 commit into
deweller:masterfrom
schoenwaldnils:fix/follow-main

Conversation

@schoenwaldnils

Copy link
Copy Markdown

Adds a new sub-command "follow" to -t system that restores the "Selected Sound Output Device" mode for alerts/sound effects:

SwitchAudioSource -t system follow

This performs the two writes that System Settings → Sound makes when the user picks "Selected Sound Output Device" from "Play sound effects through":

  1. AlertsUseMainDevice = true in com.apple.soundpref (CurrentHost).
  2. kAudioHardwarePropertyDefaultSystemOutputDevice ← current kAudioHardwarePropertyDefaultOutputDevice.

In addition, when AlertsUseMainDevice is true, -t output now also mirrors the new device to system output, so alerts stay in sync with the main output automatically. When the flag is false, behavior is unchanged (pinned-mode preserved).

System Settings caches com.apple.soundpref on launch — fully quit and reopen System Settings to see the popup label update.

fixes #12

Adds a new sub-command "follow" to -t system that restores the
"Selected Sound Output Device" mode for alerts/sound effects:

    SwitchAudioSource -t system follow

This performs the two writes that System Settings → Sound makes when
the user picks "Selected Sound Output Device" from "Play sound effects
through":

  1. AlertsUseMainDevice = true in com.apple.soundpref (CurrentHost).
  2. kAudioHardwarePropertyDefaultSystemOutputDevice ← current
     kAudioHardwarePropertyDefaultOutputDevice.

In addition, when AlertsUseMainDevice is true, -t output now also
mirrors the new device to system output, so alerts stay in sync with
the main output automatically. When the flag is false, behavior is
unchanged (pinned-mode preserved).

System Settings caches com.apple.soundpref on launch — fully quit and
reopen System Settings to see the popup label update.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switching audio source sets "Play sound effects through" to the now-previous audio source

1 participant