From 5c82b996ed46dffa70f98b9a7695e9e8636d7aa7 Mon Sep 17 00:00:00 2001 From: Istvan T <37590873+waydabber@users.noreply.github.com> Date: Sun, 14 Nov 2021 10:43:49 +0100 Subject: [PATCH] Some minor fixes and improvements (#786) --- .swift-version | 2 +- MonitorControl.xcodeproj/project.pbxproj | 54 ++- .../CGDirectDisplayID+Extension.swift | 6 +- .../Extensions/NSScreen+Extension.swift | 2 +- MonitorControl/Info.plist | 2 +- MonitorControl/Model/Display.swift | 18 +- MonitorControl/Model/OtherDisplay.swift | 10 +- MonitorControl/Support/AppDelegate.swift | 9 +- MonitorControl/Support/DisplayManager.swift | 12 +- .../Support/MediaKeyTapManager.swift | 10 +- MonitorControl/Support/OSDUtils.swift | 6 +- MonitorControl/Support/SliderHandler.swift | 2 +- MonitorControl/Support/UpdaterDelegate.swift | 2 +- MonitorControl/UI/Base.lproj/Main.storyboard | 50 +-- MonitorControl/UI/es.lproj/Main.strings | 337 ++++++++---------- .../DisplaysPrefsViewController.swift | 2 +- MonitorControlHelper/Info.plist | 2 +- 17 files changed, 269 insertions(+), 257 deletions(-) diff --git a/.swift-version b/.swift-version index 819e07a..9ad974f 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -5.0 +5.5 diff --git a/MonitorControl.xcodeproj/project.pbxproj b/MonitorControl.xcodeproj/project.pbxproj index e678429..15ba7ca 100644 --- a/MonitorControl.xcodeproj/project.pbxproj +++ b/MonitorControl.xcodeproj/project.pbxproj @@ -41,6 +41,13 @@ AA99521926FE49A300612E07 /* MenuHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA99521826FE49A300612E07 /* MenuHandler.swift */; }; AA9AE86F26B5BF3D00B6CA65 /* OSD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA9AE86E26B5BF3D00B6CA65 /* OSD.framework */; }; AA9AE87126B5BFB700B6CA65 /* CoreDisplay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA9AE87026B5BFB700B6CA65 /* CoreDisplay.framework */; }; + AAB2F638273ED099004AB5A4 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = AAB2F637273ED099004AB5A4 /* .swiftlint.yml */; }; + AAB2F63C273ED0AD004AB5A4 /* .swift-version in Resources */ = {isa = PBXBuildFile; fileRef = AAB2F639273ED0AD004AB5A4 /* .swift-version */; }; + AAB2F63D273ED0AD004AB5A4 /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = AAB2F63A273ED0AD004AB5A4 /* .gitignore */; }; + AAB2F63E273ED0AD004AB5A4 /* .swiftformat in Resources */ = {isa = PBXBuildFile; fileRef = AAB2F63B273ED0AD004AB5A4 /* .swiftformat */; }; + AAB2F640273ED0B8004AB5A4 /* .bartycrouch.toml in Resources */ = {isa = PBXBuildFile; fileRef = AAB2F63F273ED0B8004AB5A4 /* .bartycrouch.toml */; }; + AAB2F642273ED0C7004AB5A4 /* .github in Resources */ = {isa = PBXBuildFile; fileRef = AAB2F641273ED0C7004AB5A4 /* .github */; }; + AAB2F644273ED0E9004AB5A4 /* License.txt in Resources */ = {isa = PBXBuildFile; fileRef = AAB2F643273ED0E9004AB5A4 /* License.txt */; }; AACE5E2327050C63006C2A48 /* NSNotification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AACE5E2227050C63006C2A48 /* NSNotification+Extension.swift */; }; AADB625A26BC196900DFFAA5 /* DisplayServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AADB625926BC196900DFFAA5 /* DisplayServices.framework */; }; F01B0699228221B7008E64DB /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F01B0680228221B6008E64DB /* Localizable.strings */; }; @@ -128,6 +135,13 @@ AA9CB6402704C1A40086DC0E /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; AA9CB6412704C1B80086DC0E /* zh-Hant-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant-TW"; path = "zh-Hant-TW.lproj/Main.strings"; sourceTree = ""; }; AA9CB6422704C1B80086DC0E /* zh-Hant-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant-TW"; path = "zh-Hant-TW.lproj/Localizable.strings"; sourceTree = ""; }; + AAB2F637273ED099004AB5A4 /* .swiftlint.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = ""; }; + AAB2F639273ED0AD004AB5A4 /* .swift-version */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ".swift-version"; sourceTree = ""; }; + AAB2F63A273ED0AD004AB5A4 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; + AAB2F63B273ED0AD004AB5A4 /* .swiftformat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .swiftformat; sourceTree = ""; }; + AAB2F63F273ED0B8004AB5A4 /* .bartycrouch.toml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .bartycrouch.toml; sourceTree = ""; }; + AAB2F641273ED0C7004AB5A4 /* .github */ = {isa = PBXFileReference; lastKnownFileType = folder; path = .github; sourceTree = ""; }; + AAB2F643273ED0E9004AB5A4 /* License.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = License.txt; sourceTree = ""; }; AACE5E2227050C63006C2A48 /* NSNotification+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSNotification+Extension.swift"; sourceTree = ""; }; AADB625926BC196900DFFAA5 /* DisplayServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DisplayServices.framework; path = ../../../../../System/Library/PrivateFrameworks/DisplayServices.framework; sourceTree = ""; }; F01B0682228221B6008E64DB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; @@ -193,7 +207,7 @@ 56754EA21D9A4016007BCDC5 = { isa = PBXGroup; children = ( - AA3B4A2726AE103C00B74CD2 /* README.md */, + AAB2F646273ED127004AB5A4 /* Misc */, 28D1DDD1227FB759004CB494 /* Frameworks */, 56754EAD1D9A4016007BCDC5 /* MonitorControl */, F06792E8200A73460066C438 /* MonitorControlHelper */, @@ -248,6 +262,21 @@ path = Enums; sourceTree = ""; }; + AAB2F646273ED127004AB5A4 /* Misc */ = { + isa = PBXGroup; + children = ( + AAB2F641273ED0C7004AB5A4 /* .github */, + AAB2F63A273ED0AD004AB5A4 /* .gitignore */, + AAB2F637273ED099004AB5A4 /* .swiftlint.yml */, + AAB2F639273ED0AD004AB5A4 /* .swift-version */, + AAB2F63B273ED0AD004AB5A4 /* .swiftformat */, + AAB2F63F273ED0B8004AB5A4 /* .bartycrouch.toml */, + AAB2F643273ED0E9004AB5A4 /* License.txt */, + AA3B4A2726AE103C00B74CD2 /* README.md */, + ); + name = Misc; + sourceTree = ""; + }; F01B067F228221B6008E64DB /* Support */ = { isa = PBXGroup; children = ( @@ -412,12 +441,19 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + AAB2F642273ED0C7004AB5A4 /* .github in Resources */, + AAB2F63E273ED0AD004AB5A4 /* .swiftformat in Resources */, 56754EB11D9A4016007BCDC5 /* Assets.xcassets in Resources */, 6CDA0FCF26485A8300F52125 /* Main.storyboard in Resources */, + AAB2F640273ED0B8004AB5A4 /* .bartycrouch.toml in Resources */, 8C1741852707B91100E88D53 /* InternetAccessPolicy.plist in Resources */, + AAB2F638273ED099004AB5A4 /* .swiftlint.yml in Resources */, + AAB2F63C273ED0AD004AB5A4 /* .swift-version in Resources */, AA3B4A2826AE103C00B74CD2 /* README.md in Resources */, F01B0699228221B7008E64DB /* Localizable.strings in Resources */, + AAB2F63D273ED0AD004AB5A4 /* .gitignore in Resources */, 8C1741882707B91F00E88D53 /* InternetAccessPolicy.strings in Resources */, + AAB2F644273ED0E9004AB5A4 /* License.txt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -759,13 +795,13 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 4.0.1; + MARKETING_VERSION = 4.0.2; PRODUCT_BUNDLE_IDENTIFIER = me.guillaumeb.MonitorControl; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "MonitorControl/Support/Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 5.5; SYSTEM_FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", @@ -794,13 +830,13 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 4.0.1; + MARKETING_VERSION = 4.0.2; PRODUCT_BUNDLE_IDENTIFIER = me.guillaumeb.MonitorControl; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "MonitorControl/Support/Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 5.5; SYSTEM_FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", @@ -829,11 +865,11 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 4.0.1; + MARKETING_VERSION = 4.0.2; PRODUCT_BUNDLE_IDENTIFIER = me.guillaumeb.MonitorControlHelper; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 5.5; }; name = Debug; }; @@ -858,11 +894,11 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 4.0.1; + MARKETING_VERSION = 4.0.2; PRODUCT_BUNDLE_IDENTIFIER = me.guillaumeb.MonitorControlHelper; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 5.5; }; name = Release; }; diff --git a/MonitorControl/Extensions/CGDirectDisplayID+Extension.swift b/MonitorControl/Extensions/CGDirectDisplayID+Extension.swift index 536e5d4..e98626e 100644 --- a/MonitorControl/Extensions/CGDirectDisplayID+Extension.swift +++ b/MonitorControl/Extensions/CGDirectDisplayID+Extension.swift @@ -4,14 +4,14 @@ import Cocoa public extension CGDirectDisplayID { var vendorNumber: UInt32? { - return CGDisplayVendorNumber(self) + CGDisplayVendorNumber(self) } var modelNumber: UInt32? { - return CGDisplayModelNumber(self) + CGDisplayModelNumber(self) } var serialNumber: UInt32? { - return CGDisplaySerialNumber(self) + CGDisplaySerialNumber(self) } } diff --git a/MonitorControl/Extensions/NSScreen+Extension.swift b/MonitorControl/Extensions/NSScreen+Extension.swift index e69f5ad..b6cd0b7 100644 --- a/MonitorControl/Extensions/NSScreen+Extension.swift +++ b/MonitorControl/Extensions/NSScreen+Extension.swift @@ -4,7 +4,7 @@ import Cocoa public extension NSScreen { var displayID: CGDirectDisplayID { - return (self.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as? CGDirectDisplayID)! + (self.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as? CGDirectDisplayID)! } var vendorNumber: UInt32? { diff --git a/MonitorControl/Info.plist b/MonitorControl/Info.plist index 1b6ff21..3537c98 100644 --- a/MonitorControl/Info.plist +++ b/MonitorControl/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 6941 + 6956 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/MonitorControl/Model/Display.swift b/MonitorControl/Model/Display.swift index 0563b50..7cdae8c 100644 --- a/MonitorControl/Model/Display.swift +++ b/MonitorControl/Model/Display.swift @@ -16,7 +16,7 @@ class Display: Equatable { let swBrightnessSemaphore = DispatchSemaphore(value: 1) static func == (lhs: Display, rhs: Display) -> Bool { - return lhs.identifier == rhs.identifier + lhs.identifier == rhs.identifier } var sliderHandler: [Command: SliderHandler] = [:] @@ -31,7 +31,7 @@ class Display: Equatable { var defaultGammaTablePeak: Float = 1 func prefExists(key: PrefKey? = nil, for command: Command? = nil) -> Bool { - return prefs.object(forKey: self.getKey(key: key, for: command)) != nil + prefs.object(forKey: self.getKey(key: key, for: command)) != nil } func removePref(key: PrefKey, for command: Command? = nil) { @@ -43,23 +43,23 @@ class Display: Equatable { } func readPrefAsFloat(key: PrefKey? = nil, for command: Command? = nil) -> Float { - return prefs.float(forKey: self.getKey(key: key, for: command)) + prefs.float(forKey: self.getKey(key: key, for: command)) } func readPrefAsInt(key: PrefKey? = nil, for command: Command? = nil) -> Int { - return prefs.integer(forKey: self.getKey(key: key, for: command)) + prefs.integer(forKey: self.getKey(key: key, for: command)) } func readPrefAsBool(key: PrefKey? = nil, for command: Command? = nil) -> Bool { - return prefs.bool(forKey: self.getKey(key: key, for: command)) + prefs.bool(forKey: self.getKey(key: key, for: command)) } func readPrefAsString(key: PrefKey? = nil, for command: Command? = nil) -> String { - return prefs.string(forKey: self.getKey(key: key, for: command)) ?? "" + prefs.string(forKey: self.getKey(key: key, for: command)) ?? "" } private func getKey(key: PrefKey? = nil, for command: Command? = nil) -> String { - return (key ?? PrefKey.value).rawValue + (command != nil ? String((command ?? Command.none).rawValue) : "") + self.prefsId + (key ?? PrefKey.value).rawValue + (command != nil ? String((command ?? Command.none).rawValue) : "") + self.prefsId } internal init(_ identifier: CGDirectDisplayID, name: String, vendorNumber: UInt32?, modelNumber: UInt32?, isVirtual: Bool = false, isDummy: Bool = false) { @@ -321,7 +321,7 @@ class Display: Equatable { } func resetSwBrightness() -> Bool { - return self.setSwBrightness(1) + self.setSwBrightness(1) } func isSwBrightnessNotDefault() -> Bool { @@ -335,7 +335,7 @@ class Display: Equatable { } func refreshBrightness() -> Float { - return 0 + 0 } func isBuiltIn() -> Bool { diff --git a/MonitorControl/Model/OtherDisplay.swift b/MonitorControl/Model/OtherDisplay.swift index 9c95cb5..e91a918 100644 --- a/MonitorControl/Model/OtherDisplay.swift +++ b/MonitorControl/Model/OtherDisplay.swift @@ -72,7 +72,7 @@ class OtherDisplay: Display { } func getDDCValueFromPrefs(_ command: Command) -> UInt16 { - return self.convValueToDDC(for: command, from: (!prefs.bool(forKey: PrefKey.disableCombinedBrightness.rawValue) && command == .brightness) ? max(0, self.readPrefAsFloat(for: command) - self.combinedBrightnessSwitchingValue()) * (1 / (1 - self.combinedBrightnessSwitchingValue())) : self.readPrefAsFloat(for: command)) + self.convValueToDDC(for: command, from: (!prefs.bool(forKey: PrefKey.disableCombinedBrightness.rawValue) && command == .brightness) ? max(0, self.readPrefAsFloat(for: command) - self.combinedBrightnessSwitchingValue()) * (1 / (1 - self.combinedBrightnessSwitchingValue())) : self.readPrefAsFloat(for: command)) } func restoreDDCSettingsToDisplay(command: Command) { @@ -162,7 +162,7 @@ class OtherDisplay: Display { } func setupSliderCurrentValue(command: Command) -> Float { - return (command == .audioSpeakerVolume && self.readPrefAsBool(key: .enableMuteUnmute) && self.readPrefAsInt(for: .audioMuteScreenBlank) == 1) ? 0 : self.readPrefAsFloat(for: command) + (command == .audioSpeakerVolume && self.readPrefAsBool(key: .enableMuteUnmute) && self.readPrefAsInt(for: .audioMuteScreenBlank) == 1) ? 0 : self.readPrefAsFloat(for: command) } func stepVolume(isUp: Bool, isSmallIncrement: Bool) { @@ -255,7 +255,7 @@ class OtherDisplay: Display { } func isSwOnly() -> Bool { - return (!self.arm64ddc && self.ddc == nil) || self.isVirtual || self.isDummy + (!self.arm64ddc && self.ddc == nil) || self.isVirtual || self.isDummy } func isSw() -> Bool { @@ -362,7 +362,7 @@ class OtherDisplay: Display { } override func getBrightness() -> Float { - return self.prefExists(for: .brightness) ? self.readPrefAsFloat(for: .brightness) : 1 + self.prefExists(for: .brightness) ? self.readPrefAsFloat(for: .brightness) : 1 } func getRemapControlCodes(command: Command) -> [UInt8] { @@ -510,6 +510,6 @@ class OtherDisplay: Display { } func combinedBrightnessSwitchingValue() -> Float { - return Float(self.readPrefAsInt(key: .combinedBrightnessSwitchingPoint) + 8) / 16 + Float(self.readPrefAsInt(key: .combinedBrightnessSwitchingPoint) + 8) / 16 } } diff --git a/MonitorControl/Support/AppDelegate.swift b/MonitorControl/Support/AppDelegate.swift index 8b777fd..8a5eee2 100644 --- a/MonitorControl/Support/AppDelegate.swift +++ b/MonitorControl/Support/AppDelegate.swift @@ -117,12 +117,13 @@ class AppDelegate: NSObject, NSApplicationDelegate { DisplayManager.shared.resetSwBrightnessForAllDisplays(noPrefSave: true) CGDisplayRestoreColorSyncSettings() self.reconfigureID += 1 + self.updateMediaKeyTap() os_log("Bumping reconfigureID to %{public}@", type: .info, String(self.reconfigureID)) _ = DisplayManager.shared.destroyAllShades() if self.sleepID == 0 { let dispatchedReconfigureID = self.reconfigureID os_log("Display to be reconfigured with reconfigureID %{public}@", type: .info, String(dispatchedReconfigureID)) - DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { self.configure(dispatchedReconfigureID: dispatchedReconfigureID) } } @@ -159,7 +160,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { func checkPermissions() { let permissionsRequired: Bool = [KeyboardVolume.media.rawValue, KeyboardVolume.both.rawValue].contains(prefs.integer(forKey: PrefKey.keyboardVolume.rawValue)) || [KeyboardBrightness.media.rawValue, KeyboardBrightness.both.rawValue].contains(prefs.integer(forKey: PrefKey.keyboardBrightness.rawValue)) - if !MediaKeyTapManager.readPrivileges(prompt: false) && permissionsRequired { + if !MediaKeyTapManager.readPrivileges(prompt: false), permissionsRequired { MediaKeyTapManager.acquirePrivileges() } } @@ -177,13 +178,14 @@ class AppDelegate: NSObject, NSApplicationDelegate { @objc private func sleepNotification() { self.sleepID += 1 os_log("Sleeping with sleep %{public}@", type: .info, String(self.sleepID)) + self.updateMediaKeyTap() } @objc private func wakeNotification() { if self.sleepID != 0 { os_log("Waking up from sleep %{public}@", type: .info, String(self.sleepID)) let dispatchedSleepID = self.sleepID - DispatchQueue.main.asyncAfter(deadline: .now() + 6.0) { // Some displays take time to recover... + DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { // Some displays take time to recover... self.soberNow(dispatchedSleepID: dispatchedSleepID) } } @@ -203,6 +205,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { self.job(start: true) } self.startupActionWriteRepeatAfterSober() + self.updateMediaKeyTap() } } diff --git a/MonitorControl/Support/DisplayManager.swift b/MonitorControl/Support/DisplayManager.swift index f426972..062e248 100644 --- a/MonitorControl/Support/DisplayManager.swift +++ b/MonitorControl/Support/DisplayManager.swift @@ -235,15 +235,15 @@ class DisplayManager { } func getOtherDisplays() -> [OtherDisplay] { - return self.displays.compactMap { $0 as? OtherDisplay } + self.displays.compactMap { $0 as? OtherDisplay } } func getAllDisplays() -> [Display] { - return self.displays + self.displays } func getDdcCapableDisplays() -> [OtherDisplay] { - return self.displays.compactMap { display -> OtherDisplay? in + self.displays.compactMap { display -> OtherDisplay? in if let otherDisplay = display as? OtherDisplay, !otherDisplay.isSw() { return otherDisplay } else { return nil } @@ -251,11 +251,11 @@ class DisplayManager { } func getAppleDisplays() -> [AppleDisplay] { - return self.displays.compactMap { $0 as? AppleDisplay } + self.displays.compactMap { $0 as? AppleDisplay } } func getBuiltInDisplay() -> Display? { - return self.displays.first { CGDisplayIsBuiltin($0.identifier) != 0 } + self.displays.first { CGDisplayIsBuiltin($0.identifier) != 0 } } func getCurrentDisplay(byFocus: Bool = false) -> Display? { @@ -481,7 +481,7 @@ class DisplayManager { } static func getByDisplayID(displayID: CGDirectDisplayID) -> NSScreen? { - return NSScreen.screens.first { $0.displayID == displayID } + NSScreen.screens.first { $0.displayID == displayID } } static func getDisplayRawNameByID(displayID: CGDirectDisplayID) -> String { diff --git a/MonitorControl/Support/MediaKeyTapManager.swift b/MonitorControl/Support/MediaKeyTapManager.swift index ff09879..906156b 100644 --- a/MonitorControl/Support/MediaKeyTapManager.swift +++ b/MonitorControl/Support/MediaKeyTapManager.swift @@ -164,11 +164,15 @@ class MediaKeyTapManager: MediaKeyTapDelegate { keys.append(contentsOf: [.mute, .volumeUp, .volumeDown]) } // Remove brightness keys if no external displays are connected, but only if brightness fine control is not active - var isInternalDisplayOnly = true + var disengageBrightness = true for display in DisplayManager.shared.getAllDisplays() where !display.isBuiltIn() { - isInternalDisplayOnly = false + disengageBrightness = false } - if isInternalDisplayOnly, !prefs.bool(forKey: PrefKey.useFineScaleBrightness.rawValue) { + // Disengage brightness keys on sleep so MacBook native screen can be controlled meanwhile + if app.sleepID != 0 || app.reconfigureID != 0 { + disengageBrightness = true + } + if disengageBrightness, !prefs.bool(forKey: PrefKey.useFineScaleBrightness.rawValue) { let keysToDelete: [MediaKey] = [.brightnessUp, .brightnessDown] keys.removeAll { keysToDelete.contains($0) } } diff --git a/MonitorControl/Support/OSDUtils.swift b/MonitorControl/Support/OSDUtils.swift index a79ff8a..b3b7207 100644 --- a/MonitorControl/Support/OSDUtils.swift +++ b/MonitorControl/Support/OSDUtils.swift @@ -64,15 +64,15 @@ class OSDUtils: NSObject { static let chicletCount: Float = 16 static func chiclet(fromValue value: Float, maxValue: Float, half: Bool = false) -> Float { - return (value * self.chicletCount * (half ? 2 : 1)) / maxValue + (value * self.chicletCount * (half ? 2 : 1)) / maxValue } static func value(fromChiclet chiclet: Float, maxValue: Float, half: Bool = false) -> Float { - return (chiclet * maxValue) / (self.chicletCount * (half ? 2 : 1)) + (chiclet * maxValue) / (self.chicletCount * (half ? 2 : 1)) } static func getDistance(fromNearestChiclet chiclet: Float) -> Float { - return abs(chiclet.rounded(.towardZero) - chiclet) + abs(chiclet.rounded(.towardZero) - chiclet) } static func showOSDLockOnAllDisplays(osdImage: Int64) { diff --git a/MonitorControl/Support/SliderHandler.swift b/MonitorControl/Support/SliderHandler.swift index a1c2cc4..4be2f45 100644 --- a/MonitorControl/Support/SliderHandler.swift +++ b/MonitorControl/Support/SliderHandler.swift @@ -204,7 +204,7 @@ class SliderHandler { class ClickThroughImageView: NSImageView { override func hitTest(_ point: NSPoint) -> NSView? { - return subviews.first { subview in subview.hitTest(point) != nil + subviews.first { subview in subview.hitTest(point) != nil } } } diff --git a/MonitorControl/Support/UpdaterDelegate.swift b/MonitorControl/Support/UpdaterDelegate.swift index 5a48bf3..df108a5 100644 --- a/MonitorControl/Support/UpdaterDelegate.swift +++ b/MonitorControl/Support/UpdaterDelegate.swift @@ -5,6 +5,6 @@ import Sparkle class UpdaterDelegate: NSObject, SPUUpdaterDelegate { func allowedChannels(for _: SPUUpdater) -> Set { - return prefs.bool(forKey: PrefKey.isBetaChannel.rawValue) ? Set(["beta"]) : Set([]) + prefs.bool(forKey: PrefKey.isBetaChannel.rawValue) ? Set(["beta"]) : Set([]) } } diff --git a/MonitorControl/UI/Base.lproj/Main.storyboard b/MonitorControl/UI/Base.lproj/Main.storyboard index a209a08..8defea0 100644 --- a/MonitorControl/UI/Base.lproj/Main.storyboard +++ b/MonitorControl/UI/Base.lproj/Main.storyboard @@ -315,15 +315,15 @@ - + - + - - - + + + @@ -349,7 +349,7 @@ - + @@ -359,7 +359,7 @@ - + @@ -378,7 +378,7 @@ - + @@ -388,7 +388,7 @@ - + @@ -405,10 +405,21 @@ - - + + + + + + + + + + + + + - - - - - - - - - - - @@ -686,7 +686,7 @@ - + @@ -700,7 +700,7 @@ - + diff --git a/MonitorControl/UI/es.lproj/Main.strings b/MonitorControl/UI/es.lproj/Main.strings index 4f867e4..1524e02 100644 --- a/MonitorControl/UI/es.lproj/Main.strings +++ b/MonitorControl/UI/es.lproj/Main.strings @@ -1,30 +1,23 @@ - /* Class = "NSButtonCell"; title = "Sync brightness changes from Built-in and Apple displays"; ObjectID = "0ca-DG-AgB"; */ "0ca-DG-AgB.title" = "Sincronizar los cambios del brillo de la pantalla incorporada con la pantalla de Apple"; -/* Class = "NSTextFieldCell"; title = "MonitorControl"; ObjectID = "1PJ-14-Bvn"; */ -"1PJ-14-Bvn.title" = "MonitorControl"; - /* Class = "NSMenuItem"; title = "Assume last saved settings are valid (recommended)"; ObjectID = "1in-79-6qm"; */ "1in-79-6qm.title" = "Asumir que la última configuración guardada es válida (recomendado)"; +/* Class = "NSTextFieldCell"; title = "MonitorControl"; ObjectID = "1PJ-14-Bvn"; */ +"1PJ-14-Bvn.title" = "MonitorControl"; + /* Class = "NSMenuItem"; title = "Standard keyboard volume and mute keys"; ObjectID = "1sy-Kd-WL5"; */ "1sy-Kd-WL5.title" = "Teclas por defecto para silenciar y el volumen"; /* Class = "NSTextFieldCell"; title = "DDC min"; ObjectID = "1zE-fg-xEm"; */ "1zE-fg-xEm.title" = "DDC mín"; -/* Class = "NSMenuItem"; title = "Apply last saved values to the display"; ObjectID = "3Jr-bW-YYq"; */ -"3Jr-bW-YYq.title" = "Aplicar los últimos valores guardados a la pantalla"; - -/* Class = "NSBox"; title = "#bc-ignore!"; ObjectID = "3a3-In-jeQ"; */ -"3a3-In-jeQ.title" = "#bc-ignore!"; - /* Class = "NSMenuItem"; title = "Show separate controls for each display in menu"; ObjectID = "3eO-bN-ZRl"; */ "3eO-bN-ZRl.title" = "Mostrar controles separados para cada pantalla en el menú"; -/* Class = "NSButtonCell"; title = "https://monitorcontrol.app"; ObjectID = "42n-Zy-AqF"; Note = "#bc-ignore!"; */ -"42n-Zy-AqF.title" = "https://monitorcontrol.app"; +/* Class = "NSMenuItem"; title = "Apply last saved values to the display"; ObjectID = "3Jr-bW-YYq"; */ +"3Jr-bW-YYq.title" = "Aplicar los últimos valores guardados a la pantalla"; /* Class = "NSMenuItem"; title = "Custom keyboard shortcuts"; ObjectID = "4CG-0I-anB"; */ "4CG-0I-anB.title" = "Atajos de teclado personalizados"; @@ -32,15 +25,9 @@ /* Class = "NSTextFieldCell"; title = "Using window focus might not work properly with full screen apps."; ObjectID = "4dX-o1-xAc"; */ "4dX-o1-xAc.title" = "Usar el enfoque de ventana podría no funcionar en apps a pantalla completa."; -/* Class = "NSBox"; title = "#bc-ignore!"; ObjectID = "4wn-2u-KRo"; */ -"4wn-2u-KRo.title" = "#bc-ignore!"; - /* Class = "NSButtonCell"; title = "Reset Preferences"; ObjectID = "5yT-5F-X5R"; */ "5yT-5F-X5R.title" = "Restablecer Preferencias"; -/* Class = "NSTextFieldCell"; title = "#bc-ignore!"; ObjectID = "6GJ-6Q-gqz"; */ -"6GJ-6Q-gqz.title" = "#bc-ignore!"; - /* Class = "NSMenuItem"; title = "Always hide"; ObjectID = "6mo-7S-oOO"; */ "6mo-7S-oOO.title" = "Siempre oculto"; @@ -59,9 +46,6 @@ /* Class = "NSButtonCell"; title = "Special thanks to our contributors!"; ObjectID = "95V-M4-2l5"; */ "95V-M4-2l5.title" = "Agradecimientos especiales a nuestros colaboradores!"; -/* Class = "NSBox"; title = "#bc-ignore!"; ObjectID = "9aX-gm-8TS"; */ -"9aX-gm-8TS.title" = "#bc-ignore!"; - /* Class = "NSMenuItem"; title = "Custom keyboard shortcuts"; ObjectID = "9eC-PD-FHl"; */ "9eC-PD-FHl.title" = "Atajos de teclado personalizados"; @@ -71,11 +55,14 @@ /* Class = "NSTextFieldCell"; title = "Show tick marks at 0%, 25%, 50%, 75% and 100% for accuracy."; ObjectID = "A8P-vn-DEJ"; */ "A8P-vn-DEJ.title" = "Mostrar muecas en 0%, 25%, 50%, 75% y 100% para una mayor precisión."; +/* Class = "NSTextFieldCell"; title = "Use brightness, volume and other settings from last time or use defaults. Values will be applied to the display upon first change by the user."; ObjectID = "an7-Aj-3fZ"; */ +"an7-Aj-3fZ.title" = "Usar el brillo, volumen y otras configuraciones de la última vez o por defecto. Los valores serán aplicados a la pantalla cuando el usuario los cambie por primera vez."; + /* Class = "NSMenuItem"; title = "Use audio device name to determine which display to control"; ObjectID = "AqF-uD-KCY"; */ "AqF-uD-KCY.title" = "Usar nombre del dispositivo de audio para determinar qué pantalla controlar"; -/* Class = "NSButtonCell"; title = "Reset settings"; ObjectID = "BYS-7Y-bRz"; */ -"BYS-7Y-bRz.title" = "Restablecer configuración"; +/* Class = "NSMenuItem"; title = "Show sliders only for the display currently showing the menu"; ObjectID = "bbf-sS-uGv"; */ +"bbf-sS-uGv.title" = "Mostrar sliders solo para las pantallas que actualmente se muestran en el menú"; /* Class = "NSTextFieldCell"; title = "Brightness:"; ObjectID = "Bhb-6l-uPQ"; */ "Bhb-6l-uPQ.title" = "Brillo:"; @@ -83,12 +70,33 @@ /* Class = "NSTextFieldCell"; title = "(Software->DDC)"; ObjectID = "Bid-UL-blc"; */ "Bid-UL-blc.title" = "(Software->DDC)"; +/* Class = "NSTextFieldCell"; title = "For hardware (DDC) controlled displays only. Results may vary."; ObjectID = "bIe-6O-xEH"; */ +"bIe-6O-xEH.title" = "Sólo para pantallas controladas por hardware (DDC). Los resultados pueden variar."; + +/* Class = "NSButtonCell"; title = "Disable macOS volume OSD"; ObjectID = "bkM-Px-U3b"; */ +"bkM-Px-U3b.title" = "Deshabilitar OSD de macOS para el volumen"; + +/* Class = "NSTextFieldCell"; title = "OSD scale:"; ObjectID = "bP4-GJ-vhJ"; */ +"bP4-GJ-vhJ.title" = "Escala OSD:"; + /* Class = "NSTextFieldCell"; title = "OSD scale:"; ObjectID = "Bqc-s3-C0w"; */ "Bqc-s3-C0w.title" = "Escala OSD:"; +/* Class = "NSButtonCell"; title = "Reset settings"; ObjectID = "BYS-7Y-bRz"; */ +"BYS-7Y-bRz.title" = "Restablecer configuración"; + +/* Class = "NSButtonCell"; title = "Enable Mute DDC command"; ObjectID = "bZq-0d-lJa"; */ +"bZq-0d-lJa.title" = "Habilitar comando DDC para silenciar"; + +/* Class = "NSButtonCell"; title = "Show volume slider in menu"; ObjectID = "c9D-MB-lma"; */ +"c9D-MB-lma.title" = "Mostrar slider de volumen en el menú"; + /* Class = "NSMenuItem"; title = "Custom"; ObjectID = "Cle-DD-vR7"; */ "Cle-DD-vR7.title" = "Personalizado"; +/* Class = "NSTextFieldCell"; title = "Upon startup or wake:"; ObjectID = "cNt-Cq-vK4"; */ +"cNt-Cq-vK4.title" = "Al iniciar o arrancar:"; + /* Class = "NSTextFieldCell"; title = "⚠️ Warning! Changing some of these settings may cause system freezes or unexpected behavior!"; ObjectID = "Cz1-Mh-llk"; */ "Cz1-Mh-llk.title" = "⚠️ ¡Atención! ¡Cambiar algunos de estos valores puede causar cuelgues en el sistema o comportamientos anómalos!"; @@ -113,27 +121,60 @@ /* Class = "NSTextFieldCell"; title = "Mute:"; ObjectID = "EvN-FT-vdZ"; */ "EvN-FT-vdZ.title" = "Silencio:"; -/* Class = "NSTextFieldCell"; title = "Volume:"; ObjectID = "FER-Ri-4UO"; */ -"FER-Ri-4UO.title" = "Volumen:"; +/* Class = "NSTextFieldCell"; title = "Normally keyboard controls change one OSD chiclet worth of value and Shift+Option allows fine control. This makes fine control default."; ObjectID = "f6J-Ui-uMB"; */ +"f6J-Ui-uMB.title" = "Normalmente, los controles de teclado cambian un valor completo del escalón del OSD y Shift+Option permite un control más preciso. Esto hace el control más preciso por defecto."; + +/* Class = "NSButtonCell"; title = "Reset Name"; ObjectID = "f9g-8s-gdd"; */ +"f9g-8s-gdd.title" = "Restablecer Nombre"; /* Class = "NSButtonCell"; title = "Automatically check for updates"; ObjectID = "Faf-9L-TXx"; */ "Faf-9L-TXx.title" = "Comprobar actualizaciones automáticamente"; +/* Class = "NSTextFieldCell"; title = "Brightness control:"; ObjectID = "fe9-Ia-t9m"; */ +"fe9-Ia-t9m.title" = "Control del brillo:"; + +/* Class = "NSTextFieldCell"; title = "Volume:"; ObjectID = "FER-Ri-4UO"; */ +"FER-Ri-4UO.title" = "Volumen:"; + /* Class = "NSButtonCell"; title = "Allow zero brightness via software or combined dimming"; ObjectID = "FjB-XL-fG5"; */ "FjB-XL-fG5.title" = "Permitir brillo cero vía software u atenuación combinada"; +/* Class = "NSTextFieldCell"; title = "Apple and built-in displays already have a brightness slider in Control Center."; ObjectID = "fmZ-HI-Mdc"; */ +"fmZ-HI-Mdc.title" = "Las pantallas de Apple e incorporadas ya tienen un slider para el brillo en el Centro de Control."; + /* Class = "NSMenuItem"; title = "None"; ObjectID = "FoA-yh-Yx3"; */ "FoA-yh-Yx3.title" = "Ninguno"; +/* Class = "NSMenuItem"; title = "Show as icons"; ObjectID = "fR3-kq-cps"; */ +"fR3-kq-cps.title" = "Mostrar como iconos"; + +/* Class = "NSMenuItem"; title = "Show as text"; ObjectID = "fWd-Es-zsy"; */ +"fWd-Es-zsy.title" = "Mostrar como texto"; + /* Class = "NSTextFieldCell"; title = "Invert"; ObjectID = "G5A-y3-eZz"; */ "G5A-y3-eZz.title" = "Invertir"; +/* Class = "NSMenuItem"; title = "Use window focus to determine which display to control"; ObjectID = "gTR-FW-FHc"; */ +"gTR-FW-FHc.title" = "Usar foco de ventana para determinar qué pantalla controlar"; + +/* Class = "NSTextFieldCell"; title = "Brightness slider for hardware or software controlled displays or TVs."; ObjectID = "gXH-HL-ZOL"; */ +"gXH-HL-ZOL.title" = "Slider del brillo para pantallas o TVs controladas por hardware o software."; + /* Class = "NSTextFieldCell"; title = "Override audio device name:"; ObjectID = "H9X-it-sXs"; */ "H9X-it-sXs.title" = "Sobrescribir nombre del dispositivo de audio:"; +/* Class = "NSTextFieldCell"; title = "Relaunch the app to access Preferences if the menu option is not accessible. Use the button below to quit the app."; ObjectID = "hF7-fM-aKr"; */ +"hF7-fM-aKr.title" = "Reinicia la app para acceder a Preferencias si el menú opción no es accesible. Usa el botón de arriba para cerrar la app."; + +/* Class = "NSButtonCell"; title = "Get current"; ObjectID = "hkC-vq-IcD"; */ +"hkC-vq-IcD.title" = "Obtener actual"; + /* Class = "NSMenuItem"; title = "Hide"; ObjectID = "HUT-Qc-kuu"; */ "HUT-Qc-kuu.title" = "Esconder"; +/* Class = "NSTextFieldCell"; title = "Additional controls:"; ObjectID = "i5X-M5-Tf5"; */ +"i5X-M5-Tf5.title" = "Controles adicionales:"; + /* Class = "NSTextFieldCell"; title = "Brightness:"; ObjectID = "IJB-mO-e8I"; */ "IJB-mO-e8I.title" = "Brillo:"; @@ -143,153 +184,6 @@ /* Class = "NSButtonCell"; title = "Use fine OSD scale for volume"; ObjectID = "J3L-MW-iJL"; */ "J3L-MW-iJL.title" = "Usar escala OSD de volumen precisa"; -/* Class = "NSTextFieldCell"; title = "Note: you can press Shift during startup for 'Safe mode' to restore defaults and avoid reading or setting anything."; ObjectID = "Jx2-gO-nq9"; */ -"Jx2-gO-nq9.title" = "Nota: puedes presionar la tecla Shift mientras arrancas la app para entrar en el 'Modo Seguro' para restaurar los valores por defecto y evitar leer o establecer la configuración."; - -/* Class = "NSButtonCell"; title = "Enable for Apple branded and built-in displays as well"; ObjectID = "K6A-4z-1aQ"; */ -"K6A-4z-1aQ.title" = "Habilitar también para pantallas de Apple o incorporadas"; - -/* Class = "NSTextFieldCell"; title = "Screen to control:"; ObjectID = "Kfj-WK-aSL"; */ -"Kfj-WK-aSL.title" = "Ventana de control:"; - -/* Class = "NSTextFieldCell"; title = "Brightness and contrast:"; ObjectID = "LO4-4k-gxY"; */ -"LO4-4k-gxY.title" = "Brillo y contraste:"; - -/* Class = "NSMenuItem"; title = "Always show in the menu bar"; ObjectID = "MM0-Lf-VgF"; */ -"MM0-Lf-VgF.title" = "Mostrar siempre en la barra de menú"; - -/* Class = "NSTextFieldCell"; title = "Contrast:"; ObjectID = "MMk-S2-yJN"; */ -"MMk-S2-yJN.title" = "Contraste:"; - -/* Class = "NSButtonCell"; title = "Show brightness slider in menu"; ObjectID = "MWo-6I-s9L"; */ -"MWo-6I-s9L.title" = "Mostrar slider del brillo en el menú"; - -/* Class = "NSButtonCell"; title = "Enable slider snapping"; ObjectID = "MlU-hl-d46"; */ -"MlU-hl-d46.title" = "Habilitar ajuste por slider"; - -/* Class = "NSButtonCell"; title = "Separate scales for combined hardware & software dimming"; ObjectID = "O8o-hI-8eR"; */ -"O8o-hI-8eR.title" = "Separar escalas de atenuación por hardware & software"; - -/* Class = "NSMenuItem"; title = "Standard keyboard brightness keys"; ObjectID = "Oke-bW-cb1"; */ -"Oke-bW-cb1.title" = "Teclas estándar para el brillo"; - -/* Class = "NSTextFieldCell"; title = "count:"; ObjectID = "Orv-yj-Nad"; */ -"Orv-yj-Nad.title" = "conteo:"; - -/* Class = "NSTextFieldCell"; title = "Control method:"; ObjectID = "PaK-1f-DsW"; */ -"PaK-1f-DsW.title" = "Método de control:"; - -/* Class = "NSTextFieldCell"; title = "#bc-ignore!"; ObjectID = "Pqk-VW-JGY"; */ -"Pqk-VW-JGY.title" = "#bc-ignore!"; - -/* Class = "NSTextFieldCell"; title = "Use software dimming after the display reached zero hardware brightness for extended range. Works for DDC controlled displays only."; ObjectID = "PyY-p9-3NP"; */ -"PyY-p9-3NP.title" = "Usar atenuación por software una vez que la pantalla alcanza el brillo 0 para un rango extendido. Funciona sólo para pantallas controladas por DDC."; - -/* Class = "NSMenuItem"; title = "Both standard and custom shortcuts"; ObjectID = "QDG-SA-mRX"; */ -"QDG-SA-mRX.title" = "Ambos, atajos estándar y personalizados"; - -/* Class = "NSMenuItem"; title = "Normal"; ObjectID = "Riq-uM-bTs"; */ -"Riq-uM-bTs.title" = "Normal"; - -/* Class = "NSTextFieldCell"; title = "@the0neyouseek (Guillaume B.)\n@JoniVR (Joni Van Roost)\n@waydabber (István T.)"; ObjectID = "TKd-J8-Iyk"; */ -"TKd-J8-Iyk.title" = "@the0neyouseek (Guillaume B.)\n@JoniVR (Joni Van Roost)\n@waydabber (István T.)"; - -/* Class = "NSButtonCell"; title = "Show advanced settings"; ObjectID = "UBq-Od-SIB"; */ -"UBq-Od-SIB.title" = "Mostrar configuración avanzada"; - -/* Class = "NSButtonCell"; title = "Enable keyboard control for display"; ObjectID = "UqR-WE-jHl"; */ -"UqR-WE-jHl.title" = "Habilitar control por teclado para las pantallas"; - -/* Class = "NSTextFieldCell"; title = "General options:"; ObjectID = "W58-ch-j69"; */ -"W58-ch-j69.title" = "Opciones generales:"; - -/* Class = "NSTextFieldCell"; title = "Works best with various syncing and 'control all' keyboard settings enabled."; ObjectID = "XU4-Bn-bwH"; */ -"XU4-Bn-bwH.title" = "Funciona mejor cuando están habilitadas varias sincronizaciones y la configuración del teclado para 'controlar todo'."; - -/* Class = "NSMenuItem"; title = "Change volume for all screens"; ObjectID = "Xih-P5-NyM"; */ -"Xih-P5-NyM.title" = "Cambiar volumen para todas las pantallas"; - -/* Class = "NSTextFieldCell"; title = "Full OSD scale will be available for hardware brightness control and after reaching 0 brightness, further software dimming will be used."; ObjectID = "YHZ-VL-QJ3"; */ -"YHZ-VL-QJ3.title" = "La escala completa del OSD estará disponible para el control del brillo por hardware y después de alcanzar el brillo 0, será usada la atenuación por software."; - -/* Class = "NSTextFieldCell"; title = "Identifier:"; ObjectID = "YqZ-LS-YvR"; */ -"YqZ-LS-YvR.title" = "Identificador:"; - -/* Class = "NSMenuItem"; title = "Depends on mouse pointer position"; ObjectID = "Ytd-mg-N5E"; */ -"Ytd-mg-N5E.title" = "Depender de la posición del cursor del ratón"; - -/* Class = "NSButtonCell"; title = "Donate"; ObjectID = "ZKk-ve-rS4"; */ -"ZKk-ve-rS4.title" = "Donar"; - -/* Class = "NSButtonCell"; title = "Show percentages"; ObjectID = "ZUu-MR-XwA"; */ -"ZUu-MR-XwA.title" = "Mostrar porcentajes"; - -/* Class = "NSButtonCell"; title = "Use hardware DDC control"; ObjectID = "ZdU-gV-V05"; */ -"ZdU-gV-V05.title" = "Usar control DDC por hardware"; - -/* Class = "NSTextFieldCell"; title = "Use brightness, volume and other settings from last time or use defaults. Values will be applied to the display upon first change by the user."; ObjectID = "an7-Aj-3fZ"; */ -"an7-Aj-3fZ.title" = "Usar el brillo, volumen y otras configuraciones de la última vez o por defecto. Los valores serán aplicados a la pantalla cuando el usuario los cambie por primera vez."; - -/* Class = "NSTextFieldCell"; title = "For hardware (DDC) controlled displays only. Results may vary."; ObjectID = "bIe-6O-xEH"; */ -"bIe-6O-xEH.title" = "Sólo para pantallas controladas por hardware (DDC). Los resultados pueden variar."; - -/* Class = "NSTextFieldCell"; title = "OSD scale:"; ObjectID = "bP4-GJ-vhJ"; */ -"bP4-GJ-vhJ.title" = "Escala OSD:"; - -/* Class = "NSButtonCell"; title = "Enable Mute DDC command"; ObjectID = "bZq-0d-lJa"; */ -"bZq-0d-lJa.title" = "Habilitar comando DDC para silenciar"; - -/* Class = "NSMenuItem"; title = "Show sliders only for the display currently showing the menu"; ObjectID = "bbf-sS-uGv"; */ -"bbf-sS-uGv.title" = "Mostrar sliders solo para las pantallas que actualmente se muestran en el menú"; - -/* Class = "NSButtonCell"; title = "Disable macOS volume OSD"; ObjectID = "bkM-Px-U3b"; */ -"bkM-Px-U3b.title" = "Deshabilitar OSD de macOS para el volumen"; - -/* Class = "NSButtonCell"; title = "Show volume slider in menu"; ObjectID = "c9D-MB-lma"; */ -"c9D-MB-lma.title" = "Mostrar slider de volumen en el menú"; - -/* Class = "NSTextFieldCell"; title = "Upon startup or wake:"; ObjectID = "cNt-Cq-vK4"; */ -"cNt-Cq-vK4.title" = "Al iniciar o arrancar:"; - -/* Class = "NSTextFieldCell"; title = "#bc-ignore!"; ObjectID = "e0q-fb-k7R"; */ -"e0q-fb-k7R.title" = "#bc-ignore!"; - -/* Class = "NSTextFieldCell"; title = "Normally keyboard controls change one OSD chiclet worth of value and Shift+Option allows fine control. This makes fine control default."; ObjectID = "f6J-Ui-uMB"; */ -"f6J-Ui-uMB.title" = "Normalmente, los controles de teclado cambian un valor completo del escalón del OSD y Shift+Option permite un control más preciso. Esto hace el control más preciso por defecto."; - -/* Class = "NSButtonCell"; title = "Reset Name"; ObjectID = "f9g-8s-gdd"; */ -"f9g-8s-gdd.title" = "Restablecer Nombre"; - -/* Class = "NSMenuItem"; title = "Show as icons"; ObjectID = "fR3-kq-cps"; */ -"fR3-kq-cps.title" = "Mostrar como iconos"; - -/* Class = "NSMenuItem"; title = "Show as text"; ObjectID = "fWd-Es-zsy"; */ -"fWd-Es-zsy.title" = "Mostrar como texto"; - -/* Class = "NSTextFieldCell"; title = "Brightness control:"; ObjectID = "fe9-Ia-t9m"; */ -"fe9-Ia-t9m.title" = "Control del brillo:"; - -/* Class = "NSTextFieldCell"; title = "Apple and built-in displays already have a brightness slider in Control Center."; ObjectID = "fmZ-HI-Mdc"; */ -"fmZ-HI-Mdc.title" = "Las pantallas de Apple e incorporadas ya tienen un slider para el brillo en el Centro de Control."; - -/* Class = "NSMenuItem"; title = "Use window focus to determine which display to control"; ObjectID = "gTR-FW-FHc"; */ -"gTR-FW-FHc.title" = "Usar foco de ventana para determinar qué pantalla controlar"; - -/* Class = "NSTextFieldCell"; title = "Brightness slider for hardware or software controlled displays or TVs."; ObjectID = "gXH-HL-ZOL"; */ -"gXH-HL-ZOL.title" = "Slider del brillo para pantallas o TVs controladas por hardware o software."; - -/* Class = "NSTextFieldCell"; title = "Relaunch the app to access Preferences if the menu option is not accessible. Use the button below to quit the app."; ObjectID = "hF7-fM-aKr"; */ -"hF7-fM-aKr.title" = "Reinicia la app para acceder a Preferencias si el menú opción no es accesible. Usa el botón de arriba para cerrar la app."; - -/* Class = "NSButtonCell"; title = "Get current"; ObjectID = "hkC-vq-IcD"; */ -"hkC-vq-IcD.title" = "Obtener actual"; - -/* Class = "NSTextFieldCell"; title = "Additional controls:"; ObjectID = "i5X-M5-Tf5"; */ -"i5X-M5-Tf5.title" = "Controles adicionales:"; - -/* Class = "NSTextFieldCell"; title = "#bc-ignore!"; ObjectID = "ibQ-4u-ClE"; */ -"ibQ-4u-ClE.title" = "#bc-ignore!"; - /* Class = "NSButtonCell"; title = "Start at Login"; ObjectID = "j72-NF-zsW"; */ "j72-NF-zsW.title" = "Abrir al Iniciar sesión"; @@ -299,69 +193,117 @@ /* Class = "NSButtonCell"; title = "Check for updates"; ObjectID = "jVH-oc-rUi"; */ "jVH-oc-rUi.title" = "Comprobar actualizaciones"; +/* Class = "NSTextFieldCell"; title = "Note: you can press Shift during startup for 'Safe mode' to restore defaults and avoid reading or setting anything."; ObjectID = "Jx2-gO-nq9"; */ +"Jx2-gO-nq9.title" = "Nota: puedes presionar la tecla Shift mientras arrancas la app para entrar en el 'Modo Seguro' para restaurar los valores por defecto y evitar leer o establecer la configuración."; + +/* Class = "NSButtonCell"; title = "Enable for Apple branded and built-in displays as well"; ObjectID = "K6A-4z-1aQ"; */ +"K6A-4z-1aQ.title" = "Habilitar también para pantallas de Apple o incorporadas"; + +/* Class = "NSTextFieldCell"; title = "Screen to control:"; ObjectID = "Kfj-WK-aSL"; */ +"Kfj-WK-aSL.title" = "Ventana de control:"; + /* Class = "NSMenuItem"; title = "Depends on mouse pointer position"; ObjectID = "km4-hK-auM"; */ "km4-hK-auM.title" = "Depender de la posición del cursor del ratón"; /* Class = "NSMenuItem"; title = "Use combined slider for all displays"; ObjectID = "lA0-tv-qRs"; */ "lA0-tv-qRs.title" = "Usar slider combinado para todas las pantallas"; +/* Class = "NSTextFieldCell"; title = "Brightness and contrast:"; ObjectID = "LO4-4k-gxY"; */ +"LO4-4k-gxY.title" = "Brillo y contraste:"; + /* Class = "NSTextFieldCell"; title = "Display type:"; ObjectID = "lSJ-6w-KJ2"; */ "lSJ-6w-KJ2.title" = "Tipo de pantalla:"; /* Class = "NSTextFieldCell"; title = "Screen to control:"; ObjectID = "ltL-gR-K3Z"; */ "ltL-gR-K3Z.title" = "Pantalla a controlar:"; -/* Class = "NSTextFieldCell"; title = "#bc-ignore!"; ObjectID = "mBs-6m-13Q"; */ -"mBs-6m-13Q.title" = "#bc-ignore!"; +/* Class = "NSButtonCell"; title = "Enable slider snapping"; ObjectID = "MlU-hl-d46"; */ +"MlU-hl-d46.title" = "Habilitar ajuste por slider"; + +/* Class = "NSMenuItem"; title = "Always show in the menu bar"; ObjectID = "MM0-Lf-VgF"; */ +"MM0-Lf-VgF.title" = "Mostrar siempre en la barra de menú"; + +/* Class = "NSTextFieldCell"; title = "Contrast:"; ObjectID = "MMk-S2-yJN"; */ +"MMk-S2-yJN.title" = "Contraste:"; /* Class = "NSTextFieldCell"; title = "Volume:"; ObjectID = "mue-fa-8z6"; */ "mue-fa-8z6.title" = "Volumen:"; +/* Class = "NSButtonCell"; title = "Show brightness slider in menu"; ObjectID = "MWo-6I-s9L"; */ +"MWo-6I-s9L.title" = "Mostrar slider del brillo en el menú"; + /* Class = "NSButtonCell"; title = "Avoid gamma table manipulation"; ObjectID = "na6-mS-MPi"; */ "na6-mS-MPi.title" = "Evitar manipulación de la tabla gamma"; +/* Class = "NSButtonCell"; title = "Separate scales for combined hardware & software dimming"; ObjectID = "O8o-hI-8eR"; */ +"O8o-hI-8eR.title" = "Separar escalas de atenuación por hardware & software"; + /* Class = "NSMenuItem"; title = "Disable keyboard"; ObjectID = "oHf-Gh-68c"; */ "oHf-Gh-68c.title" = "Deshabilitar teclado"; /* Class = "NSTextFieldCell"; title = "Application:"; ObjectID = "okD-DG-pYa"; */ "okD-DG-pYa.title" = "Aplicación:"; -/* Class = "NSButtonCell"; title = "Longer delay during DDC read operations"; ObjectID = "pF5-Sw-7BR"; */ -"pF5-Sw-7BR.title" = "Retraso más largo durante las operaciones DDC de lectura"; +/* Class = "NSMenuItem"; title = "Standard keyboard brightness keys"; ObjectID = "Oke-bW-cb1"; */ +"Oke-bW-cb1.title" = "Teclas estándar para el brillo"; -/* Class = "NSTextFieldCell"; title = "#bc-ignore!"; ObjectID = "pIy-Lk-kkm"; */ -"pIy-Lk-kkm.title" = "#bc-ignore!"; +/* Class = "NSTextFieldCell"; title = "count:"; ObjectID = "Orv-yj-Nad"; */ +"Orv-yj-Nad.title" = "conteo:"; /* Class = "NSTextFieldCell"; title = "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."; ObjectID = "pa0-Hz-ace"; */ "pa0-Hz-ace.title" = "Usar las teclas de brillo de tu teclado de Apple para controlar el brillo. Puedes mantener la tecla Control para ajustar la pantalla incorporada, Control+Command para ajustar las pantallas externas. Mantén Shift+Option para un control más preciso. Control+Option+Command ajusta el contraste en pantallas compatibles con DDC."; +/* Class = "NSTextFieldCell"; title = "Control method:"; ObjectID = "PaK-1f-DsW"; */ +"PaK-1f-DsW.title" = "Método de control:"; + +/* Class = "NSButtonCell"; title = "Longer delay during DDC read operations"; ObjectID = "pF5-Sw-7BR"; */ +"pF5-Sw-7BR.title" = "Retraso más largo durante las operaciones DDC de lectura"; + /* Class = "NSTextFieldCell"; title = "DDC max"; ObjectID = "psF-vX-AFB"; */ "psF-vX-AFB.title" = "DDC máx"; -/* Class = "NSButtonCell"; title = "Show contrast slider in menu"; ObjectID = "qO0-dB-yUs"; */ -"qO0-dB-yUs.title" = "Mostrar slider de contraste en el menú"; +/* Class = "NSTextFieldCell"; title = "Use software dimming after the display reached zero hardware brightness for extended range. Works for DDC controlled displays only."; ObjectID = "PyY-p9-3NP"; */ +"PyY-p9-3NP.title" = "Usar atenuación por software una vez que la pantalla alcanza el brillo 0 para un rango extendido. Funciona sólo para pantallas controladas por DDC."; -/* Class = "NSTextFieldCell"; title = "Show percentage next to slider for more precision."; ObjectID = "qXy-CL-Wf1"; */ -"qXy-CL-Wf1.title" = "Mostrar porcentaje cerca del slider para una mayor precisión."; +/* Class = "NSMenuItem"; title = "Both standard and custom shortcuts"; ObjectID = "QDG-SA-mRX"; */ +"QDG-SA-mRX.title" = "Ambos, atajos estándar y personalizados"; /* Class = "NSButtonCell"; title = "Quit application"; ObjectID = "qlb-wH-qr4"; */ "qlb-wH-qr4.title" = "Cerrar aplicación"; +/* Class = "NSButtonCell"; title = "Show contrast slider in menu"; ObjectID = "qO0-dB-yUs"; */ +"qO0-dB-yUs.title" = "Mostrar slider de contraste en el menú"; + /* Class = "NSTextFieldCell"; title = "Volume control (DDC only):"; ObjectID = "qoh-Gn-f11"; */ "qoh-Gn-f11.title" = "Control del volumen (sólo DDC):"; +/* Class = "NSTextFieldCell"; title = "Show percentage next to slider for more precision."; ObjectID = "qXy-CL-Wf1"; */ +"qXy-CL-Wf1.title" = "Mostrar porcentaje cerca del slider para una mayor precisión."; + /* Class = "NSButtonCell"; title = "Combine hardware and software dimming"; ObjectID = "r76-Zc-x09"; */ "r76-Zc-x09.title" = "Combinar atenuación por hardware y software"; +/* Class = "NSMenuItem"; title = "Normal"; ObjectID = "Riq-uM-bTs"; */ +"Riq-uM-bTs.title" = "Normal"; + /* Class = "NSTextFieldCell"; title = "General menu items style:"; ObjectID = "thh-DG-ecH"; */ "thh-DG-ecH.title" = "Estilo de los elementos del menú:"; +/* Class = "NSTextFieldCell"; title = "@the0neyouseek (Guillaume B.)\n@JoniVR (Joni Van Roost)\n@waydabber (István T.)"; ObjectID = "TKd-J8-Iyk"; */ +"TKd-J8-Iyk.title" = "@the0neyouseek (Guillaume B.)\n@JoniVR (Joni Van Roost)\n@waydabber (István T.)"; + /* Class = "NSTextFieldCell"; title = "Menu Icon:"; ObjectID = "u6s-Pb-BCG"; */ "u6s-Pb-BCG.title" = "Icono del menú:"; +/* Class = "NSButtonCell"; title = "Show advanced settings"; ObjectID = "UBq-Od-SIB"; */ +"UBq-Od-SIB.title" = "Mostrar configuración avanzada"; + /* Class = "NSTextFieldCell"; title = "Works if an audio device is selected with no native volume control."; ObjectID = "uF5-a9-Ngz"; */ "uF5-a9-Ngz.title" = "Funciona si un dispositivo de audio es seleccionado sin control del volumen nativo."; +/* Class = "NSButtonCell"; title = "Enable keyboard control for display"; ObjectID = "UqR-WE-jHl"; */ +"UqR-WE-jHl.title" = "Habilitar control por teclado para las pantallas"; + /* Class = "NSTextFieldCell"; title = "Contrast (DDC):"; ObjectID = "urd-Rh-aiL"; */ "urd-Rh-aiL.title" = "Contraste (DDC):"; @@ -377,29 +319,56 @@ /* Class = "NSTextFieldCell"; title = "DDC read polling mode:"; ObjectID = "vwm-hY-on5"; */ "vwm-hY-on5.title" = "Modo de sondeo de lectura DDC:"; +/* Class = "NSTextFieldCell"; title = "General options:"; ObjectID = "W58-ch-j69"; */ +"W58-ch-j69.title" = "Opciones generales:"; + /* Class = "NSTextFieldCell"; title = "Useful when a display tends to reset its settings during sleep."; ObjectID = "w8B-x6-sq5"; */ "w8B-x6-sq5.title" = "Útil cuando una pantalla tiende a resetear su configuración mientras está en modo stand by."; /* Class = "NSTextFieldCell"; title = "Changes that are caused by the Ambient light sensor or made using Touch Bar, Control Center, System Preferences will be replicated to all displays."; ObjectID = "wjv-tq-iUx"; */ "wjv-tq-iUx.title" = "Los cambios producidos por el sensor de luz ambiental o hechos a través de la Touch Bar, Centro de Control, Preferencias del Sistema serñan replicados a todas las pantallas."; +/* Class = "NSMenuItem"; title = "Change volume for all screens"; ObjectID = "Xih-P5-NyM"; */ +"Xih-P5-NyM.title" = "Cambiar volumen para todas las pantallas"; + +/* Class = "NSTextFieldCell"; title = "Update settings from the display. May not work with some hardware."; ObjectID = "xjq-hs-wWB"; */ +"xjq-hs-wWB.title" = "Actualizar configuración desde la pantalla. Puede no funcionar con algunos hardware."; + /* Class = "NSMenuItem"; title = "Only if at least one slider is present"; ObjectID = "xLa-PN-rsq"; */ "xLa-PN-rsq.title" = "Sólo si hay presente al menos un slider"; /* Class = "NSMenuItem"; title = "Both standard and custom shortcuts"; ObjectID = "xQJ-aJ-VhH"; */ "xQJ-aJ-VhH.title" = "Ambos, atajos estándar y personalizados"; -/* Class = "NSTextFieldCell"; title = "Update settings from the display. May not work with some hardware."; ObjectID = "xjq-hs-wWB"; */ -"xjq-hs-wWB.title" = "Actualizar configuración desde la pantalla. Puede no funcionar con algunos hardware."; +/* Class = "NSTextFieldCell"; title = "Works best with various syncing and 'control all' keyboard settings enabled."; ObjectID = "XU4-Bn-bwH"; */ +"XU4-Bn-bwH.title" = "Funciona mejor cuando están habilitadas varias sincronizaciones y la configuración del teclado para 'controlar todo'."; /* Class = "NSTextFieldCell"; title = "Available"; ObjectID = "yBJ-5d-I7e"; */ "yBJ-5d-I7e.title" = "Disponible"; +/* Class = "NSTextFieldCell"; title = "Full OSD scale will be available for hardware brightness control and after reaching 0 brightness, further software dimming will be used."; ObjectID = "YHZ-VL-QJ3"; */ +"YHZ-VL-QJ3.title" = "La escala completa del OSD estará disponible para el control del brillo por hardware y después de alcanzar el brillo 0, será usada la atenuación por software."; + /* Class = "NSTextFieldCell"; title = "Warning! With this option enabled, you might find yourself in a position when you end up with a blank display. This, combined with disabled keyboard controls can be frustrating."; ObjectID = "yi3-e1-wsL"; */ "yi3-e1-wsL.title" = "¡Atención! Con esta opción habilitada, puedes acabar con la pantalla en blanco. Esto, combinado con los controles por teclado deshabilitados puede ser frustrante."; +/* Class = "NSTextFieldCell"; title = "Identifier:"; ObjectID = "YqZ-LS-YvR"; */ +"YqZ-LS-YvR.title" = "Identificador:"; + +/* Class = "NSMenuItem"; title = "Depends on mouse pointer position"; ObjectID = "Ytd-mg-N5E"; */ +"Ytd-mg-N5E.title" = "Depender de la posición del cursor del ratón"; + +/* Class = "NSButtonCell"; title = "Use hardware DDC control"; ObjectID = "ZdU-gV-V05"; */ +"ZdU-gV-V05.title" = "Usar control DDC por hardware"; + /* Class = "NSMenuItem"; title = "Disable keyboard"; ObjectID = "zHa-xo-XPW"; */ "zHa-xo-XPW.title" = "Deshabilitar teclado"; +/* Class = "NSButtonCell"; title = "Donate"; ObjectID = "ZKk-ve-rS4"; */ +"ZKk-ve-rS4.title" = "Donar"; + +/* Class = "NSButtonCell"; title = "Show percentages"; ObjectID = "ZUu-MR-XwA"; */ +"ZUu-MR-XwA.title" = "Mostrar porcentajes"; + /* Class = "NSTextFieldCell"; title = "Combined dimming switchover point:"; ObjectID = "zv8-pZ-OPy"; */ "zv8-pZ-OPy.title" = "Puntos combinados de atenuación:"; diff --git a/MonitorControl/View Controllers/DisplaysPrefsViewController.swift b/MonitorControl/View Controllers/DisplaysPrefsViewController.swift index 6bfcf26..0742594 100644 --- a/MonitorControl/View Controllers/DisplaysPrefsViewController.swift +++ b/MonitorControl/View Controllers/DisplaysPrefsViewController.swift @@ -68,7 +68,7 @@ class DisplaysPrefsViewController: NSViewController, PreferencePane, NSTableView } func numberOfRows(in _: NSTableView) -> Int { - return self.displays.count + self.displays.count } public static func isImac() -> Bool { diff --git a/MonitorControlHelper/Info.plist b/MonitorControlHelper/Info.plist index 955c2f9..7298759 100644 --- a/MonitorControlHelper/Info.plist +++ b/MonitorControlHelper/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 6941 + 6956 LSApplicationCategoryType public.app-category.utilities LSBackgroundOnly