mirror of
https://github.com/MonitorControl/MonitorControl.git
synced 2026-05-21 06:46:18 -06:00
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
This commit is contained in:
parent
fc19ce2bd2
commit
fa5a345b04
2 changed files with 5 additions and 2 deletions
|
|
@ -78,6 +78,9 @@ enum PrefKey: String {
|
||||||
// Use fine OSD scale for volume
|
// Use fine OSD scale for volume
|
||||||
case useFineScaleVolume
|
case useFineScaleVolume
|
||||||
|
|
||||||
|
// Always capture standard volume media keys even when macOS output volume is controllable
|
||||||
|
case forceStandardVolumeMediaKeys
|
||||||
|
|
||||||
// Use smoothBrightness
|
// Use smoothBrightness
|
||||||
case disableSmoothBrightness
|
case disableSmoothBrightness
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -166,8 +166,8 @@ class MediaKeyTapManager: MediaKeyTapDelegate {
|
||||||
let keysToDelete: [MediaKey] = [.brightnessUp, .brightnessDown]
|
let keysToDelete: [MediaKey] = [.brightnessUp, .brightnessDown]
|
||||||
keys.removeAll { keysToDelete.contains($0) }
|
keys.removeAll { keysToDelete.contains($0) }
|
||||||
}
|
}
|
||||||
// Remove volume related keys if audio device is controllable
|
// Remove volume related keys if audio device is controllable unless the user opted into force-capturing them.
|
||||||
if let defaultAudioDevice = app.coreAudio.defaultOutputDevice {
|
if !prefs.bool(forKey: PrefKey.forceStandardVolumeMediaKeys.rawValue), let defaultAudioDevice = app.coreAudio.defaultOutputDevice {
|
||||||
let keysToDelete: [MediaKey] = [.volumeUp, .volumeDown, .mute]
|
let keysToDelete: [MediaKey] = [.volumeUp, .volumeDown, .mute]
|
||||||
if prefs.integer(forKey: PrefKey.multiKeyboardVolume.rawValue) == MultiKeyboardVolume.audioDeviceNameMatching.rawValue {
|
if prefs.integer(forKey: PrefKey.multiKeyboardVolume.rawValue) == MultiKeyboardVolume.audioDeviceNameMatching.rawValue {
|
||||||
if DisplayManager.shared.updateAudioControlTargetDisplays(deviceName: defaultAudioDevice.name) == 0 {
|
if DisplayManager.shared.updateAudioControlTargetDisplays(deviceName: defaultAudioDevice.name) == 0 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue