From fa5a345b040365e7cd0a20094bfbf96722d730d1 Mon Sep 17 00:00:00 2001 From: shuntagami Date: Sun, 22 Mar 2026 17:00:00 +0900 Subject: [PATCH] Add opt-in override for standard volume media keys. Keep the current safety behavior by default, but allow advanced users to force-capture standard volume media keys even when macOS output volume is controllable. Made-with: Cursor --- MonitorControl/Enums/PrefKey.swift | 3 +++ MonitorControl/Support/MediaKeyTapManager.swift | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/MonitorControl/Enums/PrefKey.swift b/MonitorControl/Enums/PrefKey.swift index 76b5f29..39dbdf7 100644 --- a/MonitorControl/Enums/PrefKey.swift +++ b/MonitorControl/Enums/PrefKey.swift @@ -78,6 +78,9 @@ enum PrefKey: String { // Use fine OSD scale for volume case useFineScaleVolume + // Always capture standard volume media keys even when macOS output volume is controllable + case forceStandardVolumeMediaKeys + // Use smoothBrightness case disableSmoothBrightness diff --git a/MonitorControl/Support/MediaKeyTapManager.swift b/MonitorControl/Support/MediaKeyTapManager.swift index f484a6e..df68108 100644 --- a/MonitorControl/Support/MediaKeyTapManager.swift +++ b/MonitorControl/Support/MediaKeyTapManager.swift @@ -166,8 +166,8 @@ class MediaKeyTapManager: MediaKeyTapDelegate { let keysToDelete: [MediaKey] = [.brightnessUp, .brightnessDown] keys.removeAll { keysToDelete.contains($0) } } - // Remove volume related keys if audio device is controllable - if let defaultAudioDevice = app.coreAudio.defaultOutputDevice { + // Remove volume related keys if audio device is controllable unless the user opted into force-capturing them. + if !prefs.bool(forKey: PrefKey.forceStandardVolumeMediaKeys.rawValue), let defaultAudioDevice = app.coreAudio.defaultOutputDevice { let keysToDelete: [MediaKey] = [.volumeUp, .volumeDown, .mute] if prefs.integer(forKey: PrefKey.multiKeyboardVolume.rawValue) == MultiKeyboardVolume.audioDeviceNameMatching.rawValue { if DisplayManager.shared.updateAudioControlTargetDisplays(deviceName: defaultAudioDevice.name) == 0 {