diff --git a/MonitorControl.xcodeproj/project.pbxproj b/MonitorControl.xcodeproj/project.pbxproj index 637602c..0583586 100644 --- a/MonitorControl.xcodeproj/project.pbxproj +++ b/MonitorControl.xcodeproj/project.pbxproj @@ -17,7 +17,6 @@ 6CC260F6256AD8F900613714 /* Preferences+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CC260F5256AD8F900613714 /* Preferences+Extension.swift */; }; 6CD35F53264FFFC6001F1344 /* SimplyCoreAudio in Frameworks */ = {isa = PBXBuildFile; productRef = 6CD35F52264FFFC6001F1344 /* SimplyCoreAudio */; }; 6CD35F5626500008001F1344 /* MediaKeyTap in Frameworks */ = {isa = PBXBuildFile; productRef = 6CD35F5526500008001F1344 /* MediaKeyTap */; }; - 6CD35F5C2650003F001F1344 /* Preferences in Frameworks */ = {isa = PBXBuildFile; productRef = 6CD35F5B2650003F001F1344 /* Preferences */; }; 6CDA0FCF26485A8300F52125 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6CDA0FCD26485A8300F52125 /* Main.storyboard */; }; 8C1741852707B91100E88D53 /* InternetAccessPolicy.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8C1741842707B91100E88D53 /* InternetAccessPolicy.plist */; }; 8C1741882707B91F00E88D53 /* InternetAccessPolicy.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8C17418A2707B91F00E88D53 /* InternetAccessPolicy.strings */; }; @@ -49,6 +48,7 @@ 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 */; }; + AAD7DD342CAFF3D90062822F /* Settings in Frameworks */ = {isa = PBXBuildFile; productRef = AAD7DD332CAFF3D90062822F /* Settings */; }; AADB625A26BC196900DFFAA5 /* DisplayServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AADB625926BC196900DFFAA5 /* DisplayServices.framework */; }; F01B0699228221B7008E64DB /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F01B0680228221B6008E64DB /* Localizable.strings */; }; F01B069F228221B7008E64DB /* SliderHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F01B068F228221B7008E64DB /* SliderHandler.swift */; }; @@ -194,7 +194,7 @@ 6CD35F53264FFFC6001F1344 /* SimplyCoreAudio in Frameworks */, 6CD35F5626500008001F1344 /* MediaKeyTap in Frameworks */, AA9AE86F26B5BF3D00B6CA65 /* OSD.framework in Frameworks */, - 6CD35F5C2650003F001F1344 /* Preferences in Frameworks */, + AAD7DD342CAFF3D90062822F /* Settings in Frameworks */, AADB625A26BC196900DFFAA5 /* DisplayServices.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -394,9 +394,9 @@ packageProductDependencies = ( 6CD35F52264FFFC6001F1344 /* SimplyCoreAudio */, 6CD35F5526500008001F1344 /* MediaKeyTap */, - 6CD35F5B2650003F001F1344 /* Preferences */, AA44E702270377C200E06865 /* KeyboardShortcuts */, AA70817B27046B9800CC5625 /* Sparkle */, + AAD7DD332CAFF3D90062822F /* Settings */, ); productName = MonitorControl.OSX; productReference = 56754EAB1D9A4016007BCDC5 /* MonitorControl.app */; @@ -474,7 +474,7 @@ packageReferences = ( 6CD35F51264FFFC6001F1344 /* XCRemoteSwiftPackageReference "SimplyCoreAudio" */, 6CD35F5426500008001F1344 /* XCRemoteSwiftPackageReference "MediaKeyTap" */, - 6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Preferences" */, + 6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Settings" */, AA44E701270377C200E06865 /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */, AA70817A27046B9800CC5625 /* XCRemoteSwiftPackageReference "Sparkle" */, ); @@ -1043,12 +1043,12 @@ kind = branch; }; }; - 6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Preferences" */ = { + 6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Settings" */ = { isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/sindresorhus/Preferences"; + repositoryURL = "https://github.com/sindresorhus/Settings"; requirement = { - kind = upToNextMajorVersion; - minimumVersion = 2.3.0; + branch = main; + kind = branch; }; }; AA44E701270377C200E06865 /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */ = { @@ -1080,11 +1080,6 @@ package = 6CD35F5426500008001F1344 /* XCRemoteSwiftPackageReference "MediaKeyTap" */; productName = MediaKeyTap; }; - 6CD35F5B2650003F001F1344 /* Preferences */ = { - isa = XCSwiftPackageProductDependency; - package = 6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Preferences" */; - productName = Preferences; - }; AA44E702270377C200E06865 /* KeyboardShortcuts */ = { isa = XCSwiftPackageProductDependency; package = AA44E701270377C200E06865 /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */; @@ -1095,6 +1090,11 @@ package = AA70817A27046B9800CC5625 /* XCRemoteSwiftPackageReference "Sparkle" */; productName = Sparkle; }; + AAD7DD332CAFF3D90062822F /* Settings */ = { + isa = XCSwiftPackageProductDependency; + package = 6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Settings" */; + productName = Settings; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 56754EA31D9A4016007BCDC5 /* Project object */; diff --git a/MonitorControl.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/MonitorControl.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 25e8bf6..e90afb0 100644 --- a/MonitorControl.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/MonitorControl.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "84fa266e40e059306e085f65a46dd4d8e4eac94006fae6e400cd4f6b8302705b", + "originHash" : "df195b12c1f6bd471af1cacb709842cb7eb355cce32fee1413f0f7d7aa5c4eb2", "pins" : [ { "identity" : "keyboardshortcuts", @@ -20,12 +20,12 @@ } }, { - "identity" : "preferences", + "identity" : "settings", "kind" : "remoteSourceControl", - "location" : "https://github.com/sindresorhus/Preferences", + "location" : "https://github.com/sindresorhus/Settings", "state" : { - "revision" : "2651cd144615009242c994b087508fef99e9275c", - "version" : "2.6.0" + "branch" : "main", + "revision" : "879ea83a7bbc6dbebf62bed8c547f090146372a6" } }, { diff --git a/MonitorControl/Enums/PrefKey.swift b/MonitorControl/Enums/PrefKey.swift index 81b0cee..3b08aff 100644 --- a/MonitorControl/Enums/PrefKey.swift +++ b/MonitorControl/Enums/PrefKey.swift @@ -7,7 +7,7 @@ enum PrefKey: String { case SUEnableAutomaticChecks // Receive beta updates? - case isBetaChannel // This is not added to Preferences yet as it will be needed in the future only. + case isBetaChannel // This is not added to Settings yet as it will be needed in the future only. // Build number case buildNumber @@ -60,7 +60,7 @@ enum PrefKey: String { // Instead of assuming default values, enable read or write upon startup (according to readDDCInsteadOfRestoreValues) case startupAction - // Show advanced options under Displays tab in Preferences + // Show advanced options under Displays tab in Settings case showAdvancedSettings // Allow zero software brightness diff --git a/MonitorControl/Extensions/Preferences+Extension.swift b/MonitorControl/Extensions/Preferences+Extension.swift index ef1331b..2e4e4f0 100644 --- a/MonitorControl/Extensions/Preferences+Extension.swift +++ b/MonitorControl/Extensions/Preferences+Extension.swift @@ -2,9 +2,9 @@ import Cocoa -import Preferences +import Settings -extension Preferences.PaneIdentifier { +extension Settings.PaneIdentifier { static let main = Self("Main") static let menusliders = Self("Menu & Sliders") static let keyboard = Self("Keyboard") @@ -12,7 +12,7 @@ extension Preferences.PaneIdentifier { static let about = Self("About") } -public extension PreferencesWindowController { +public extension SettingsWindowController { override func keyDown(with event: NSEvent) { if event.modifierFlags.intersection(.deviceIndependentFlagsMask) == .command, let key = event.charactersIgnoringModifiers { if key == "w" { diff --git a/MonitorControl/Info.plist b/MonitorControl/Info.plist index f43bb0e..6648c50 100644 --- a/MonitorControl/Info.plist +++ b/MonitorControl/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 7105 + 7122 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/MonitorControl/Support/AppDelegate.swift b/MonitorControl/Support/AppDelegate.swift index 905672f..297e0dd 100644 --- a/MonitorControl/Support/AppDelegate.swift +++ b/MonitorControl/Support/AppDelegate.swift @@ -5,8 +5,8 @@ import Cocoa import Foundation import MediaKeyTap import os.log -import Preferences import ServiceManagement +import Settings import SimplyCoreAudio import Sparkle @@ -24,23 +24,23 @@ class AppDelegate: NSObject, NSApplicationDelegate { var audioPlayer: AVAudioPlayer? let updaterController = SPUStandardUpdaterController(startingUpdater: false, updaterDelegate: UpdaterDelegate(), userDriverDelegate: nil) - var preferencePaneStyle: Preferences.Style { + var settingsPaneStyle: Settings.Style { if !DEBUG_MACOS10, #available(macOS 11.0, *) { - return Preferences.Style.toolbarItems + return Settings.Style.toolbarItems } else { - return Preferences.Style.segmentedControl + return Settings.Style.segmentedControl } } - lazy var preferencesWindowController: PreferencesWindowController = .init( - preferencePanes: [ + lazy var settingsWindowController: SettingsWindowController = .init( + panes: [ mainPrefsVc!, menuslidersPrefsVc!, keyboardPrefsVc!, displaysPrefsVc!, aboutPrefsVc!, ], - style: self.preferencePaneStyle, + style: self.settingsPaneStyle, animated: true ) @@ -71,8 +71,8 @@ class AppDelegate: NSObject, NSApplicationDelegate { } @objc func prefsClicked(_: AnyObject) { - os_log("Preferences clicked", type: .info) - self.preferencesWindowController.show() + os_log("Settings clicked", type: .info) + self.settingsWindowController.show() } func applicationShouldHandleReopen(_: NSApplication, hasVisibleWindows _: Bool) -> Bool { @@ -93,7 +93,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { if !self.safeMode { let alert = NSAlert() alert.messageText = NSLocalizedString("Incompatible previous version", comment: "Shown in the alert dialog") - alert.informativeText = NSLocalizedString("Preferences for an incompatible previous app version detected. Default preferences are reloaded.", comment: "Shown in the alert dialog") + alert.informativeText = NSLocalizedString("Settings for an incompatible previous app version detected. Default settings are reloaded.", comment: "Shown in the alert dialog") alert.runModal() } prefs.removePersistentDomain(forName: bundleID) @@ -103,7 +103,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { func setDefaultPrefs() { if !prefs.bool(forKey: PrefKey.appAlreadyLaunched.rawValue) { - // Only preferences that are not false, 0 or "" by default are set here. Assumes pre-wiped database. + // Only settings that are not false, 0 or "" by default are set here. Assumes pre-wiped database. prefs.set(true, forKey: PrefKey.appAlreadyLaunched.rawValue) prefs.set(true, forKey: PrefKey.SUEnableAutomaticChecks.rawValue) } @@ -262,8 +262,8 @@ class AppDelegate: NSObject, NSApplicationDelegate { self.updateMediaKeyTap() } - func preferenceReset() { - os_log("Resetting all preferences.") + func settingsReset() { + os_log("Resetting all settings.") if !prefs.bool(forKey: PrefKey.disableCombinedBrightness.rawValue) { DisplayManager.shared.resetSwBrightnessForAllDisplays(async: false) } @@ -295,7 +295,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { SMLoginItemSetEnabled(identifier, enabled) } - func getSystemPreferences() -> [String: AnyObject]? { + func getSystemSettings() -> [String: AnyObject]? { var propertyListFormat = PropertyListSerialization.PropertyListFormat.xml let plistPath = NSString(string: "~/Library/Preferences/.GlobalPreferences.plist").expandingTildeInPath guard let plistXML = FileManager.default.contents(atPath: plistPath) else { @@ -318,7 +318,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { } func playVolumeChangedSound() { - guard let preferences = app.getSystemPreferences(), let hasSoundEnabled = preferences["com.apple.sound.beep.feedback"] as? Int, hasSoundEnabled == 1 else { + guard let settings = app.getSystemSettings(), let hasSoundEnabled = settings["com.apple.sound.beep.feedback"] as? Int, hasSoundEnabled == 1 else { return } do { @@ -342,7 +342,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { self.safeMode = true let alert = NSAlert() alert.messageText = NSLocalizedString("Safe Mode Activated", comment: "Shown in the alert dialog") - alert.informativeText = NSLocalizedString("Shift was pressed during launch. MonitorControl started in safe mode. Default preferences are reloaded, DDC read is blocked.", comment: "Shown in the alert dialog") + alert.informativeText = NSLocalizedString("Shift was pressed during launch. MonitorControl started in safe mode. Default settings are reloaded, DDC read is blocked.", comment: "Shown in the alert dialog") alert.runModal() } } diff --git a/MonitorControl/Support/DisplayManager.swift b/MonitorControl/Support/DisplayManager.swift index f659bd7..7ace448 100644 --- a/MonitorControl/Support/DisplayManager.swift +++ b/MonitorControl/Support/DisplayManager.swift @@ -18,6 +18,7 @@ class DisplayManager { self.gammaActivityEnforcer.title = "Monitor Control Gamma Activity Enforcer" self.gammaActivityEnforcer.isMovableByWindowBackground = false self.gammaActivityEnforcer.backgroundColor = DEBUG_GAMMA_ENFORCER ? .red : .black + self.gammaActivityEnforcer.alphaValue = 1 * (DEBUG_GAMMA_ENFORCER ? 0.5 : 0.01) self.gammaActivityEnforcer.ignoresMouseEvents = true self.gammaActivityEnforcer.level = .screenSaver self.gammaActivityEnforcer.orderFrontRegardless() diff --git a/MonitorControl/Support/MediaKeyTapManager.swift b/MonitorControl/Support/MediaKeyTapManager.swift index 7567f8a..f484a6e 100644 --- a/MonitorControl/Support/MediaKeyTapManager.swift +++ b/MonitorControl/Support/MediaKeyTapManager.swift @@ -208,7 +208,7 @@ class MediaKeyTapManager: MediaKeyTapDelegate { if !self.readPrivileges(prompt: true), !firstAsk { let alert = NSAlert() alert.messageText = NSLocalizedString("Shortcuts not available", comment: "Shown in the alert dialog") - alert.informativeText = NSLocalizedString("You need to enable MonitorControl in System Preferences > Security and Privacy > Accessibility for the keyboard shortcuts to work", comment: "Shown in the alert dialog") + alert.informativeText = NSLocalizedString("You need to enable MonitorControl in System Settings > Security and Privacy > Accessibility for the keyboard shortcuts to work", comment: "Shown in the alert dialog") alert.runModal() } } diff --git a/MonitorControl/Support/MenuHandler.swift b/MonitorControl/Support/MenuHandler.swift index bd0cd51..fcd79aa 100644 --- a/MonitorControl/Support/MenuHandler.swift +++ b/MonitorControl/Support/MenuHandler.swift @@ -223,16 +223,16 @@ class MenuHandler: NSMenu, NSMenuDelegate { let menuItemView = NSView(frame: NSRect(x: 0, y: 0, width: viewWidth, height: iconSize + 10)) - let preferencesIcon = NSButton() - preferencesIcon.bezelStyle = .regularSquare - preferencesIcon.isBordered = false - preferencesIcon.setButtonType(.momentaryChange) - preferencesIcon.image = NSImage(systemSymbolName: "gearshape", accessibilityDescription: NSLocalizedString("Preferences…", comment: "Shown in menu")) - preferencesIcon.alternateImage = NSImage(systemSymbolName: "gearshape.fill", accessibilityDescription: NSLocalizedString("Preferences…", comment: "Shown in menu")) - preferencesIcon.alphaValue = 0.3 - preferencesIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 3 - 20 - 17 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize) - preferencesIcon.imageScaling = .scaleProportionallyUpOrDown - preferencesIcon.action = #selector(app.prefsClicked) + let settingsIcon = NSButton() + settingsIcon.bezelStyle = .regularSquare + settingsIcon.isBordered = false + settingsIcon.setButtonType(.momentaryChange) + settingsIcon.image = NSImage(systemSymbolName: "gearshape", accessibilityDescription: NSLocalizedString("Settings…", comment: "Shown in menu")) + settingsIcon.alternateImage = NSImage(systemSymbolName: "gearshape.fill", accessibilityDescription: NSLocalizedString("Settings…", comment: "Shown in menu")) + settingsIcon.alphaValue = 0.3 + settingsIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 3 - 20 - 17 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize) + settingsIcon.imageScaling = .scaleProportionallyUpOrDown + settingsIcon.action = #selector(app.prefsClicked) let updateIcon = NSButton() updateIcon.bezelStyle = .regularSquare @@ -260,7 +260,7 @@ class MenuHandler: NSMenu, NSMenuDelegate { quitIcon.imageScaling = .scaleProportionallyUpOrDown quitIcon.action = #selector(app.quitClicked) - menuItemView.addSubview(preferencesIcon) + menuItemView.addSubview(settingsIcon) menuItemView.addSubview(updateIcon) menuItemView.addSubview(quitIcon) let item = NSMenuItem() @@ -270,7 +270,7 @@ class MenuHandler: NSMenu, NSMenuDelegate { if app.macOS10() { self.insertItem(NSMenuItem.separator(), at: self.items.count) } - self.insertItem(withTitle: NSLocalizedString("Preferences…", comment: "Shown in menu"), action: #selector(app.prefsClicked), keyEquivalent: ",", at: self.items.count) + self.insertItem(withTitle: NSLocalizedString("Settings…", comment: "Shown in menu"), action: #selector(app.prefsClicked), keyEquivalent: ",", at: self.items.count) let updateItem = NSMenuItem(title: NSLocalizedString("Check for updates…", comment: "Shown in menu"), action: #selector(app.updaterController.checkForUpdates(_:)), keyEquivalent: "") updateItem.target = app.updaterController self.insertItem(updateItem, at: self.items.count) diff --git a/MonitorControl/UI/Base.lproj/Main.storyboard b/MonitorControl/UI/Base.lproj/Main.storyboard index ebe7121..2f76365 100644 --- a/MonitorControl/UI/Base.lproj/Main.storyboard +++ b/MonitorControl/UI/Base.lproj/Main.storyboard @@ -118,7 +118,7 @@ - Changes that are caused by the Ambient light sensor or made using Touch Bar, Control Center, System Preferences will be replicated to all displays. + Changes that are caused by the Ambient light sensor or made using Touch Bar, Control Center, System Settings will be replicated to all displays. @@ -274,7 +274,7 @@