diff --git a/MonitorControl/AppDelegate.swift b/MonitorControl/AppDelegate.swift index 7b972328..a6220f8c 100644 --- a/MonitorControl/AppDelegate.swift +++ b/MonitorControl/AppDelegate.swift @@ -54,6 +54,8 @@ class AppDelegate: NSObject, NSApplicationDelegate { self.statusItem.menu = self.statusMenu self.checkPermissions() CGDisplayRegisterReconfigurationCallback({ _, _, _ in app.displayReconfigured() }, nil) + + MediaKeyTap.useAlternateBrightnessKeys = prefs.bool(forKey: Utils.PrefKeys.altBrightnessKeys.rawValue) self.updateDisplays(firstrun: true) } diff --git a/MonitorControl/Info.plist b/MonitorControl/Info.plist index bc7d6ce1..0718666e 100644 --- a/MonitorControl/Info.plist +++ b/MonitorControl/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 3095 + 3103 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/MonitorControl/Support/Utils.swift b/MonitorControl/Support/Utils.swift index aec9c567..47c96c0b 100644 --- a/MonitorControl/Support/Utils.swift +++ b/MonitorControl/Support/Utils.swift @@ -92,6 +92,9 @@ class Utils: NSObject { /// Change Brightness/Volume for all screens case allScreens + /// Use F14 / F15 keys to control brightness + case altBrightnessKeys + /// Friendly name changed case friendlyName diff --git a/MonitorControl/Support/de.lproj/Localizable.strings b/MonitorControl/Support/de.lproj/Localizable.strings index 5f53c655..b010f5c0 100644 --- a/MonitorControl/Support/de.lproj/Localizable.strings +++ b/MonitorControl/Support/de.lproj/Localizable.strings @@ -68,7 +68,7 @@ "Safe Mode Activated" = "Safe Mode Activated"; /* Shown in the alert dialog */ -"Shift was pressed during launch. MonitorControl started in safe mode. Default preferences are reloaded, DDC read is blocked." = "Die Shift-Taste wurde beim Programmstart gehalten. MonitorControl wurde im Safe Mode gestartet. Die Standard-Einstellungen werden geladen, DDC lesen ist blockiert."; +"Shift was pressed during launch. MonitorControl started in safe mode. Default preferences are reloaded, DDC read is blocked." = "Shift was pressed during launch. MonitorControl started in safe mode. Default preferences are reloaded, DDC read is blocked."; /* Shown in the alert dialog */ "Shortcuts not available" = "Kurzbefehle sind nicht verfügbar"; diff --git a/MonitorControl/UI/Base.lproj/Main.storyboard b/MonitorControl/UI/Base.lproj/Main.storyboard index e1544f05..4f6dd618 100644 --- a/MonitorControl/UI/Base.lproj/Main.storyboard +++ b/MonitorControl/UI/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -11,10 +11,10 @@ - + - + @@ -32,6 +32,7 @@ + @@ -43,7 +44,7 @@ - + @@ -53,7 +54,7 @@ + + + + @@ -325,6 +339,7 @@ + @@ -337,7 +352,7 @@ - + diff --git a/MonitorControl/UI/de.lproj/Main.strings b/MonitorControl/UI/de.lproj/Main.strings index ac63514e..08b909e4 100644 --- a/MonitorControl/UI/de.lproj/Main.strings +++ b/MonitorControl/UI/de.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "Helligkeit und Lautstärke für alle Bildschirme ändern"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "Minimal"; diff --git a/MonitorControl/UI/en.lproj/Main.strings b/MonitorControl/UI/en.lproj/Main.strings index 3bd0d234..c2d42dc1 100644 --- a/MonitorControl/UI/en.lproj/Main.strings +++ b/MonitorControl/UI/en.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "Change Brightness and Volume for all screens"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "Minimal"; diff --git a/MonitorControl/UI/es-419.lproj/Main.strings b/MonitorControl/UI/es-419.lproj/Main.strings index 11307ca7..374d4d55 100644 --- a/MonitorControl/UI/es-419.lproj/Main.strings +++ b/MonitorControl/UI/es-419.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "Cambiar el brillo y volumen para todas las pantallas"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "Minimal"; diff --git a/MonitorControl/UI/fr.lproj/Main.strings b/MonitorControl/UI/fr.lproj/Main.strings index 6efe3161..5c525c55 100644 --- a/MonitorControl/UI/fr.lproj/Main.strings +++ b/MonitorControl/UI/fr.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "Change Brightness and Volume for all screens"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "Minimal"; diff --git a/MonitorControl/UI/hu.lproj/Main.strings b/MonitorControl/UI/hu.lproj/Main.strings index c3ba51a9..9a6dac87 100644 --- a/MonitorControl/UI/hu.lproj/Main.strings +++ b/MonitorControl/UI/hu.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "Fényerő/hangerő módosítása az összes képernyőn"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "Minimális"; diff --git a/MonitorControl/UI/it.lproj/Main.strings b/MonitorControl/UI/it.lproj/Main.strings index 6c627148..044add39 100644 --- a/MonitorControl/UI/it.lproj/Main.strings +++ b/MonitorControl/UI/it.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "Cambia Luminosità e Volume di tutti i display"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "Minimale"; diff --git a/MonitorControl/UI/ja.lproj/Main.strings b/MonitorControl/UI/ja.lproj/Main.strings index 1cdb0840..a0a9e01a 100644 --- a/MonitorControl/UI/ja.lproj/Main.strings +++ b/MonitorControl/UI/ja.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "すべての画面の画面輝度と音量を変更する"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "低頻度"; @@ -41,7 +44,7 @@ "f9g-8s-gdd.title" = "Reset Name"; /* Class = "NSButtonCell"; title = "Further lower brightness via software dimming"; ObjectID = "fhy-Er-0aI"; */ -"fhy-Er-0aI.title" = "画面輝度変更後、コントラストを下げる"; +"fhy-Er-0aI.title" = "ソフトウェアディミングを用いて輝度を通常以上に下げる"; /* Class = "NSMenuItem"; title = "None"; ObjectID = "FoA-yh-Yx3"; */ "FoA-yh-Yx3.title" = "設定しない"; diff --git a/MonitorControl/UI/ko.lproj/Main.strings b/MonitorControl/UI/ko.lproj/Main.strings index 0f2ef6d8..2e26ef11 100644 --- a/MonitorControl/UI/ko.lproj/Main.strings +++ b/MonitorControl/UI/ko.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "모든 화면의 밝기와 볼륨 조절"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "최소"; diff --git a/MonitorControl/UI/nl.lproj/Main.strings b/MonitorControl/UI/nl.lproj/Main.strings index 84227c02..d872c348 100644 --- a/MonitorControl/UI/nl.lproj/Main.strings +++ b/MonitorControl/UI/nl.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "Verander Helderheid en Volume voor alle beeldschermen"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Gebruik F14 / F15 keys voor helderheid"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "Minimaal"; diff --git a/MonitorControl/UI/pl.lproj/Main.strings b/MonitorControl/UI/pl.lproj/Main.strings index 633016af..ceda2aa1 100644 --- a/MonitorControl/UI/pl.lproj/Main.strings +++ b/MonitorControl/UI/pl.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "Zmień Jasność i Głośność dla wszystkich wyświetlaczy"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "Minimalny"; diff --git a/MonitorControl/UI/ru.lproj/Main.strings b/MonitorControl/UI/ru.lproj/Main.strings index f69e45cc..755311e2 100644 --- a/MonitorControl/UI/ru.lproj/Main.strings +++ b/MonitorControl/UI/ru.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "Изменить яркость и громоксть на всех экранах"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "Редко"; diff --git a/MonitorControl/UI/tr.lproj/Main.strings b/MonitorControl/UI/tr.lproj/Main.strings index b4327cf3..a834b6a7 100644 --- a/MonitorControl/UI/tr.lproj/Main.strings +++ b/MonitorControl/UI/tr.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "Tüm ekranlar için Parlaklığı ve Sesi değiştir"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "Minimal"; diff --git a/MonitorControl/UI/uk.lproj/Main.strings b/MonitorControl/UI/uk.lproj/Main.strings index 4c71b072..6674a0b0 100644 --- a/MonitorControl/UI/uk.lproj/Main.strings +++ b/MonitorControl/UI/uk.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "Change Brightness and Volume for all screens"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "Мінім."; diff --git a/MonitorControl/UI/zh-Hans.lproj/Main.strings b/MonitorControl/UI/zh-Hans.lproj/Main.strings index dad32004..500e56a1 100644 --- a/MonitorControl/UI/zh-Hans.lproj/Main.strings +++ b/MonitorControl/UI/zh-Hans.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "改变所有屏幕的亮度和音量"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "少量"; diff --git a/MonitorControl/UI/zh-Hant-TW.lproj/Main.strings b/MonitorControl/UI/zh-Hant-TW.lproj/Main.strings index f99881de..eb2f69fc 100644 --- a/MonitorControl/UI/zh-Hant-TW.lproj/Main.strings +++ b/MonitorControl/UI/zh-Hant-TW.lproj/Main.strings @@ -34,6 +34,9 @@ /* Class = "NSButtonCell"; title = "Change Brightness and Volume for all screens"; ObjectID = "E6M-ih-S8Y"; */ "E6M-ih-S8Y.title" = "更改所有螢幕的亮度和音量"; +/* Class = "NSButtonCell"; title = "Enable F14 / F15 keys for Brightness Control"; ObjectID = "E6M-ih-SZY"; */ +"E6M-ih-SZY.title" = "Enable F14 / F15 keys for Brightness Control"; + /* Class = "NSMenuItem"; title = "Minimal"; ObjectID = "Eq3-z9-yIo"; */ "Eq3-z9-yIo.title" = "少量"; diff --git a/MonitorControl/View Controllers/MainPrefsViewController.swift b/MonitorControl/View Controllers/MainPrefsViewController.swift index d6e70264..70e07004 100644 --- a/MonitorControl/View Controllers/MainPrefsViewController.swift +++ b/MonitorControl/View Controllers/MainPrefsViewController.swift @@ -1,4 +1,5 @@ import Cocoa +import MediaKeyTap import os.log import Preferences import ServiceManagement @@ -26,6 +27,7 @@ class MainPrefsViewController: NSViewController, PreferencePane { @IBOutlet var fallbackSw: NSButton! @IBOutlet var listenFor: NSPopUpButton! @IBOutlet var allScreens: NSButton! + @IBOutlet var altBrightnessKeys: NSButton! @IBOutlet var showAdvancedDisplays: NSButton! override func viewDidLoad() { @@ -51,6 +53,7 @@ class MainPrefsViewController: NSViewController, PreferencePane { self.fallbackSw.state = self.prefs.bool(forKey: Utils.PrefKeys.fallbackSw.rawValue) ? .on : .off self.listenFor.selectItem(at: self.prefs.integer(forKey: Utils.PrefKeys.listenFor.rawValue)) self.allScreens.state = self.prefs.bool(forKey: Utils.PrefKeys.allScreens.rawValue) ? .on : .off + self.altBrightnessKeys.state = self.prefs.bool(forKey: Utils.PrefKeys.altBrightnessKeys.rawValue) ? .on : .off self.showAdvancedDisplays.state = self.prefs.bool(forKey: Utils.PrefKeys.showAdvancedDisplays.rawValue) ? .on : .off } @@ -68,6 +71,20 @@ class MainPrefsViewController: NSViewController, PreferencePane { #endif } + @IBAction func altBrightnessKeysTouched(_ sender: NSButton) { + switch sender.state { + case .on: + self.prefs.set(true, forKey: Utils.PrefKeys.altBrightnessKeys.rawValue) + case .off: + self.prefs.set(false, forKey: Utils.PrefKeys.altBrightnessKeys.rawValue) + default: break + } + MediaKeyTap.useAlternateBrightnessKeys = (sender.state == .on) + #if DEBUG + os_log("Toggle altBrightnessKeys state: %{public}@", type: .info, sender.state == .on ? "on" : "off") + #endif + } + @IBAction func startAtLoginClicked(_ sender: NSButton) { switch sender.state { case .on: