This commit is contained in:
shuntagami 2026-04-19 08:37:41 +02:00 committed by GitHub
commit 2ca71d16ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 3 deletions

View file

@ -212,4 +212,5 @@ enum KeyboardVolume: Int {
case custom = 1
case both = 2
case disabled = 3
case mediaForce = 4
}

View file

@ -150,7 +150,7 @@ class MediaKeyTapManager: MediaKeyTapDelegate {
if [KeyboardBrightness.media.rawValue, KeyboardBrightness.both.rawValue].contains(prefs.integer(forKey: PrefKey.keyboardBrightness.rawValue)) {
keys.append(contentsOf: [.brightnessUp, .brightnessDown])
}
if [KeyboardVolume.media.rawValue, KeyboardVolume.both.rawValue].contains(prefs.integer(forKey: PrefKey.keyboardVolume.rawValue)) {
if [KeyboardVolume.media.rawValue, KeyboardVolume.both.rawValue, KeyboardVolume.mediaForce.rawValue].contains(prefs.integer(forKey: PrefKey.keyboardVolume.rawValue)) {
keys.append(contentsOf: [.mute, .volumeUp, .volumeDown])
}
// Remove brightness keys if no external displays are connected, but only if brightness fine control is not active
@ -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 (skip when user chose force-capture mode)
if prefs.integer(forKey: PrefKey.keyboardVolume.rawValue) != KeyboardVolume.mediaForce.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 {

View file

@ -1004,6 +1004,7 @@
<menu key="menu" id="LhY-cM-Msq">
<items>
<menuItem title="Standard keyboard volume and mute keys" state="on" id="1sy-Kd-WL5"/>
<menuItem title="Standard keys (force capture)" tag="4" id="fVk-mR-9Xp"/>
<menuItem title="Custom keyboard shortcuts" tag="1" id="4CG-0I-anB"/>
<menuItem title="Both standard and custom shortcuts" tag="2" id="QDG-SA-mRX">
<modifierMask key="keyEquivalentModifierMask"/>

View file

@ -415,5 +415,8 @@
/* Class = "NSButtonCell"; title = "Show percentages"; ObjectID = "ZUu-MR-XwA"; */
"ZUu-MR-XwA.title" = "Show percentages";
/* Class = "NSMenuItem"; title = "Standard keys (force capture)"; ObjectID = "fVk-mR-9Xp"; */
"fVk-mR-9Xp.title" = "Standard keys (force capture)";
/* Class = "NSTextFieldCell"; title = "Combined dimming switchover point:"; ObjectID = "zv8-pZ-OPy"; */
"zv8-pZ-OPy.title" = "Combined dimming switchover point:";