From 0ed9d0f3be89b7782b869c4e9a5bab0c008d1345 Mon Sep 17 00:00:00 2001 From: Istvan T <37590873+waydabber@users.noreply.github.com> Date: Sat, 9 Oct 2021 14:34:10 +0200 Subject: [PATCH] Keyboard pane now fits small screen when custom shortcuts enabled (#693) - Keyboard preferences still did not fit to a 1280x800 screen if custom shortcuts were enabled. I did some redesign to fix that. - Updated dutch translation --- MonitorControl/Enums/PrefKey.swift | 26 ++- MonitorControl/Info.plist | 2 +- MonitorControl/Support/DisplayManager.swift | 8 +- .../Support/MediaKeyTapManager.swift | 2 +- MonitorControl/UI/Base.lproj/Main.storyboard | 195 +++++++++--------- MonitorControl/UI/de.lproj/Main.strings | 60 +++--- MonitorControl/UI/en.lproj/Main.strings | 62 +++--- MonitorControl/UI/es-419.lproj/Main.strings | 56 +++-- MonitorControl/UI/fr.lproj/Main.strings | 60 +++--- MonitorControl/UI/hu.lproj/Main.strings | 62 +++--- MonitorControl/UI/it.lproj/Main.strings | 60 +++--- MonitorControl/UI/ja.lproj/Main.strings | 56 +++-- MonitorControl/UI/ko.lproj/Main.strings | 60 +++--- MonitorControl/UI/nl.lproj/Main.strings | 70 +++---- MonitorControl/UI/pl.lproj/Main.strings | 56 +++-- MonitorControl/UI/ru.lproj/Main.strings | 56 +++-- MonitorControl/UI/tr.lproj/Main.strings | 60 +++--- MonitorControl/UI/uk.lproj/Main.strings | 56 +++-- MonitorControl/UI/zh-Hans.lproj/Main.strings | 60 +++--- .../UI/zh-Hant-TW.lproj/Main.strings | 60 +++--- .../DisplaysPrefsViewController.swift | 4 +- .../KeyboardPrefsViewController.swift | 113 +++------- .../MainPrefsViewController.swift | 18 +- .../MenuslidersPrefsViewController.swift | 18 +- MonitorControlHelper/Info.plist | 2 +- 25 files changed, 572 insertions(+), 710 deletions(-) diff --git a/MonitorControl/Enums/PrefKey.swift b/MonitorControl/Enums/PrefKey.swift index b2c9617..4e4b335 100644 --- a/MonitorControl/Enums/PrefKey.swift +++ b/MonitorControl/Enums/PrefKey.swift @@ -66,20 +66,14 @@ enum PrefKey: String { // Show advanced options under Displays tab in Preferences case showAdvancedSettings - // Change Brightness for all screens - case allScreensBrightness - // Allow zero software brightness case allowZeroSwBrightness - // Use focus instead of mouse position to determine which display to control for brightness - case useFocusInsteadOfMouse + // Keyboard brightness control for multiple displays + case multiKeyboardBrightness - // Change Volume for all screens - case allScreensVolume - - // Use audio device name matching to determine display to control for volume - case useAudioDeviceNameMatching + // Keyboard volume control for multiple devices + case multiKeyboardVolume // Use fine OSD scale for brightness case useFineScaleBrightness @@ -164,6 +158,18 @@ enum PrefKey: String { case remapDDC } +enum MultiKeyboardBrightness: Int { + case mouse = 0 + case allScreens = 1 + case focusInsteadOfMouse = 2 +} + +enum MultiKeyboardVolume: Int { + case mouse = 0 + case allScreens = 1 + case audioDeviceNameMatching = 2 +} + enum StartupAction: Int { case doNothing = 0 case write = 1 diff --git a/MonitorControl/Info.plist b/MonitorControl/Info.plist index 0ac9e9b..b729fbb 100644 --- a/MonitorControl/Info.plist +++ b/MonitorControl/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 6517 + 6539 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/MonitorControl/Support/DisplayManager.swift b/MonitorControl/Support/DisplayManager.swift index 5bff354..b1edfb6 100644 --- a/MonitorControl/Support/DisplayManager.swift +++ b/MonitorControl/Support/DisplayManager.swift @@ -347,17 +347,17 @@ class DisplayManager { let allDisplays = self.getAllDisplays() var currentDisplay: Display? if isBrightness { - if prefs.bool(forKey: PrefKey.allScreensBrightness.rawValue) { + if prefs.integer(forKey: PrefKey.multiKeyboardBrightness.rawValue) == MultiKeyboardBrightness.allScreens.rawValue { affectedDisplays = allDisplays return affectedDisplays } - currentDisplay = self.getCurrentDisplay(byFocus: prefs.bool(forKey: PrefKey.useFocusInsteadOfMouse.rawValue)) + currentDisplay = self.getCurrentDisplay(byFocus: prefs.integer(forKey: PrefKey.multiKeyboardBrightness.rawValue) == MultiKeyboardBrightness.focusInsteadOfMouse.rawValue) } if isVolume { - if prefs.bool(forKey: PrefKey.allScreensVolume.rawValue) { + if prefs.integer(forKey: PrefKey.multiKeyboardVolume.rawValue) == MultiKeyboardVolume.allScreens.rawValue { affectedDisplays = allDisplays return affectedDisplays - } else if prefs.bool(forKey: PrefKey.useAudioDeviceNameMatching.rawValue) { + } else if prefs.integer(forKey: PrefKey.multiKeyboardVolume.rawValue) == MultiKeyboardVolume.audioDeviceNameMatching.rawValue { return self.audioControlTargetDisplays } currentDisplay = self.getCurrentDisplay(byFocus: false) diff --git a/MonitorControl/Support/MediaKeyTapManager.swift b/MonitorControl/Support/MediaKeyTapManager.swift index 383c8a3..ff09879 100644 --- a/MonitorControl/Support/MediaKeyTapManager.swift +++ b/MonitorControl/Support/MediaKeyTapManager.swift @@ -175,7 +175,7 @@ class MediaKeyTapManager: MediaKeyTapDelegate { // Remove volume related keys if audio device is controllable if let defaultAudioDevice = app.coreAudio.defaultOutputDevice { let keysToDelete: [MediaKey] = [.volumeUp, .volumeDown, .mute] - if !prefs.bool(forKey: PrefKey.allScreensVolume.rawValue), prefs.bool(forKey: PrefKey.useAudioDeviceNameMatching.rawValue) { + if prefs.integer(forKey: PrefKey.multiKeyboardVolume.rawValue) == MultiKeyboardVolume.audioDeviceNameMatching.rawValue { if DisplayManager.shared.updateAudioControlTargetDisplays(deviceName: defaultAudioDevice.name) == 0 { keys.removeAll { keysToDelete.contains($0) } } diff --git a/MonitorControl/UI/Base.lproj/Main.storyboard b/MonitorControl/UI/Base.lproj/Main.storyboard index 325be4a..bdde63e 100644 --- a/MonitorControl/UI/Base.lproj/Main.storyboard +++ b/MonitorControl/UI/Base.lproj/Main.storyboard @@ -387,7 +387,7 @@ - + @@ -804,18 +804,17 @@ - + - + - + - - + @@ -824,12 +823,10 @@ - + - - @@ -838,7 +835,7 @@ - + @@ -848,7 +845,7 @@ - + @@ -871,7 +868,7 @@ - + Use the brightness keys of your Apple keyboard to control brightness. You can hold Control to adjust the built-in display, Control+Command to adjust external displays. Hold Shift+Option for fine control. Control+Option+Command adjusts contrast on DDC compatible displays. @@ -883,7 +880,7 @@ - + @@ -955,7 +952,7 @@ - - - - + - - + + - MonitorControl uses mouse position to determine which display to control. Using window focus instead might not work well with full screen apps. @@ -1025,7 +1017,7 @@ - + @@ -1035,8 +1027,8 @@ + - + @@ -1212,35 +1222,30 @@ - - - - - - + + - Without this the app uses mouse position to determine which display to control. You can override audio device name under Displays if needed. - + + + + + + + + + + - - @@ -1264,8 +1267,6 @@ - - @@ -1276,30 +1277,30 @@ + + + - + - - - - + @@ -1435,7 +1436,7 @@