Skip to content

Commit 0ebb40c

Browse files
committed
Changed Preferences to Settings, fixed visible gamma enforcer
1 parent 1fce77e commit 0ebb40c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+660
-659
lines changed

MonitorControl.xcodeproj/project.pbxproj

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
6CC260F6256AD8F900613714 /* Preferences+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CC260F5256AD8F900613714 /* Preferences+Extension.swift */; };
1818
6CD35F53264FFFC6001F1344 /* SimplyCoreAudio in Frameworks */ = {isa = PBXBuildFile; productRef = 6CD35F52264FFFC6001F1344 /* SimplyCoreAudio */; };
1919
6CD35F5626500008001F1344 /* MediaKeyTap in Frameworks */ = {isa = PBXBuildFile; productRef = 6CD35F5526500008001F1344 /* MediaKeyTap */; };
20-
6CD35F5C2650003F001F1344 /* Preferences in Frameworks */ = {isa = PBXBuildFile; productRef = 6CD35F5B2650003F001F1344 /* Preferences */; };
2120
6CDA0FCF26485A8300F52125 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6CDA0FCD26485A8300F52125 /* Main.storyboard */; };
2221
8C1741852707B91100E88D53 /* InternetAccessPolicy.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8C1741842707B91100E88D53 /* InternetAccessPolicy.plist */; };
2322
8C1741882707B91F00E88D53 /* InternetAccessPolicy.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8C17418A2707B91F00E88D53 /* InternetAccessPolicy.strings */; };
@@ -49,6 +48,7 @@
4948
AAB2F642273ED0C7004AB5A4 /* .github in Resources */ = {isa = PBXBuildFile; fileRef = AAB2F641273ED0C7004AB5A4 /* .github */; };
5049
AAB2F644273ED0E9004AB5A4 /* License.txt in Resources */ = {isa = PBXBuildFile; fileRef = AAB2F643273ED0E9004AB5A4 /* License.txt */; };
5150
AACE5E2327050C63006C2A48 /* NSNotification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AACE5E2227050C63006C2A48 /* NSNotification+Extension.swift */; };
51+
AAD7DD342CAFF3D90062822F /* Settings in Frameworks */ = {isa = PBXBuildFile; productRef = AAD7DD332CAFF3D90062822F /* Settings */; };
5252
AADB625A26BC196900DFFAA5 /* DisplayServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AADB625926BC196900DFFAA5 /* DisplayServices.framework */; };
5353
F01B0699228221B7008E64DB /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F01B0680228221B6008E64DB /* Localizable.strings */; };
5454
F01B069F228221B7008E64DB /* SliderHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F01B068F228221B7008E64DB /* SliderHandler.swift */; };
@@ -194,7 +194,7 @@
194194
6CD35F53264FFFC6001F1344 /* SimplyCoreAudio in Frameworks */,
195195
6CD35F5626500008001F1344 /* MediaKeyTap in Frameworks */,
196196
AA9AE86F26B5BF3D00B6CA65 /* OSD.framework in Frameworks */,
197-
6CD35F5C2650003F001F1344 /* Preferences in Frameworks */,
197+
AAD7DD342CAFF3D90062822F /* Settings in Frameworks */,
198198
AADB625A26BC196900DFFAA5 /* DisplayServices.framework in Frameworks */,
199199
);
200200
runOnlyForDeploymentPostprocessing = 0;
@@ -394,9 +394,9 @@
394394
packageProductDependencies = (
395395
6CD35F52264FFFC6001F1344 /* SimplyCoreAudio */,
396396
6CD35F5526500008001F1344 /* MediaKeyTap */,
397-
6CD35F5B2650003F001F1344 /* Preferences */,
398397
AA44E702270377C200E06865 /* KeyboardShortcuts */,
399398
AA70817B27046B9800CC5625 /* Sparkle */,
399+
AAD7DD332CAFF3D90062822F /* Settings */,
400400
);
401401
productName = MonitorControl.OSX;
402402
productReference = 56754EAB1D9A4016007BCDC5 /* MonitorControl.app */;
@@ -474,7 +474,7 @@
474474
packageReferences = (
475475
6CD35F51264FFFC6001F1344 /* XCRemoteSwiftPackageReference "SimplyCoreAudio" */,
476476
6CD35F5426500008001F1344 /* XCRemoteSwiftPackageReference "MediaKeyTap" */,
477-
6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Preferences" */,
477+
6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Settings" */,
478478
AA44E701270377C200E06865 /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */,
479479
AA70817A27046B9800CC5625 /* XCRemoteSwiftPackageReference "Sparkle" */,
480480
);
@@ -1043,12 +1043,12 @@
10431043
kind = branch;
10441044
};
10451045
};
1046-
6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Preferences" */ = {
1046+
6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Settings" */ = {
10471047
isa = XCRemoteSwiftPackageReference;
1048-
repositoryURL = "https://github.com/sindresorhus/Preferences";
1048+
repositoryURL = "https://github.com/sindresorhus/Settings";
10491049
requirement = {
1050-
kind = upToNextMajorVersion;
1051-
minimumVersion = 2.3.0;
1050+
branch = main;
1051+
kind = branch;
10521052
};
10531053
};
10541054
AA44E701270377C200E06865 /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */ = {
@@ -1080,11 +1080,6 @@
10801080
package = 6CD35F5426500008001F1344 /* XCRemoteSwiftPackageReference "MediaKeyTap" */;
10811081
productName = MediaKeyTap;
10821082
};
1083-
6CD35F5B2650003F001F1344 /* Preferences */ = {
1084-
isa = XCSwiftPackageProductDependency;
1085-
package = 6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Preferences" */;
1086-
productName = Preferences;
1087-
};
10881083
AA44E702270377C200E06865 /* KeyboardShortcuts */ = {
10891084
isa = XCSwiftPackageProductDependency;
10901085
package = AA44E701270377C200E06865 /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */;
@@ -1095,6 +1090,11 @@
10951090
package = AA70817A27046B9800CC5625 /* XCRemoteSwiftPackageReference "Sparkle" */;
10961091
productName = Sparkle;
10971092
};
1093+
AAD7DD332CAFF3D90062822F /* Settings */ = {
1094+
isa = XCSwiftPackageProductDependency;
1095+
package = 6CD35F5A2650003F001F1344 /* XCRemoteSwiftPackageReference "Settings" */;
1096+
productName = Settings;
1097+
};
10981098
/* End XCSwiftPackageProductDependency section */
10991099
};
11001100
rootObject = 56754EA31D9A4016007BCDC5 /* Project object */;

MonitorControl.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MonitorControl/Enums/PrefKey.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ enum PrefKey: String {
77
case SUEnableAutomaticChecks
88

99
// Receive beta updates?
10-
case isBetaChannel // This is not added to Preferences yet as it will be needed in the future only.
10+
case isBetaChannel // This is not added to Settings yet as it will be needed in the future only.
1111

1212
// Build number
1313
case buildNumber
@@ -60,7 +60,7 @@ enum PrefKey: String {
6060
// Instead of assuming default values, enable read or write upon startup (according to readDDCInsteadOfRestoreValues)
6161
case startupAction
6262

63-
// Show advanced options under Displays tab in Preferences
63+
// Show advanced options under Displays tab in Settings
6464
case showAdvancedSettings
6565

6666
// Allow zero software brightness

MonitorControl/Extensions/Preferences+Extension.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
import Cocoa
44

5-
import Preferences
5+
import Settings
66

7-
extension Preferences.PaneIdentifier {
7+
extension Settings.PaneIdentifier {
88
static let main = Self("Main")
99
static let menusliders = Self("Menu & Sliders")
1010
static let keyboard = Self("Keyboard")
1111
static let displays = Self("Displays")
1212
static let about = Self("About")
1313
}
1414

15-
public extension PreferencesWindowController {
15+
public extension SettingsWindowController {
1616
override func keyDown(with event: NSEvent) {
1717
if event.modifierFlags.intersection(.deviceIndependentFlagsMask) == .command, let key = event.charactersIgnoringModifiers {
1818
if key == "w" {

MonitorControl/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleShortVersionString</key>
2020
<string>$(MARKETING_VERSION)</string>
2121
<key>CFBundleVersion</key>
22-
<string>7105</string>
22+
<string>7122</string>
2323
<key>LSApplicationCategoryType</key>
2424
<string>public.app-category.utilities</string>
2525
<key>LSMinimumSystemVersion</key>

MonitorControl/Support/AppDelegate.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import Cocoa
55
import Foundation
66
import MediaKeyTap
77
import os.log
8-
import Preferences
98
import ServiceManagement
9+
import Settings
1010
import SimplyCoreAudio
1111
import Sparkle
1212

@@ -24,23 +24,23 @@ class AppDelegate: NSObject, NSApplicationDelegate {
2424
var audioPlayer: AVAudioPlayer?
2525
let updaterController = SPUStandardUpdaterController(startingUpdater: false, updaterDelegate: UpdaterDelegate(), userDriverDelegate: nil)
2626

27-
var preferencePaneStyle: Preferences.Style {
27+
var settingsPaneStyle: Settings.Style {
2828
if !DEBUG_MACOS10, #available(macOS 11.0, *) {
29-
return Preferences.Style.toolbarItems
29+
return Settings.Style.toolbarItems
3030
} else {
31-
return Preferences.Style.segmentedControl
31+
return Settings.Style.segmentedControl
3232
}
3333
}
3434

35-
lazy var preferencesWindowController: PreferencesWindowController = .init(
36-
preferencePanes: [
35+
lazy var settingsWindowController: SettingsWindowController = .init(
36+
panes: [
3737
mainPrefsVc!,
3838
menuslidersPrefsVc!,
3939
keyboardPrefsVc!,
4040
displaysPrefsVc!,
4141
aboutPrefsVc!,
4242
],
43-
style: self.preferencePaneStyle,
43+
style: self.settingsPaneStyle,
4444
animated: true
4545
)
4646

@@ -71,8 +71,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
7171
}
7272

7373
@objc func prefsClicked(_: AnyObject) {
74-
os_log("Preferences clicked", type: .info)
75-
self.preferencesWindowController.show()
74+
os_log("Settings clicked", type: .info)
75+
self.settingsWindowController.show()
7676
}
7777

7878
func applicationShouldHandleReopen(_: NSApplication, hasVisibleWindows _: Bool) -> Bool {
@@ -93,7 +93,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
9393
if !self.safeMode {
9494
let alert = NSAlert()
9595
alert.messageText = NSLocalizedString("Incompatible previous version", comment: "Shown in the alert dialog")
96-
alert.informativeText = NSLocalizedString("Preferences for an incompatible previous app version detected. Default preferences are reloaded.", comment: "Shown in the alert dialog")
96+
alert.informativeText = NSLocalizedString("Settings for an incompatible previous app version detected. Default settings are reloaded.", comment: "Shown in the alert dialog")
9797
alert.runModal()
9898
}
9999
prefs.removePersistentDomain(forName: bundleID)
@@ -103,7 +103,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
103103

104104
func setDefaultPrefs() {
105105
if !prefs.bool(forKey: PrefKey.appAlreadyLaunched.rawValue) {
106-
// Only preferences that are not false, 0 or "" by default are set here. Assumes pre-wiped database.
106+
// Only settings that are not false, 0 or "" by default are set here. Assumes pre-wiped database.
107107
prefs.set(true, forKey: PrefKey.appAlreadyLaunched.rawValue)
108108
prefs.set(true, forKey: PrefKey.SUEnableAutomaticChecks.rawValue)
109109
}
@@ -262,8 +262,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
262262
self.updateMediaKeyTap()
263263
}
264264

265-
func preferenceReset() {
266-
os_log("Resetting all preferences.")
265+
func settingsReset() {
266+
os_log("Resetting all settings.")
267267
if !prefs.bool(forKey: PrefKey.disableCombinedBrightness.rawValue) {
268268
DisplayManager.shared.resetSwBrightnessForAllDisplays(async: false)
269269
}
@@ -295,7 +295,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
295295
SMLoginItemSetEnabled(identifier, enabled)
296296
}
297297

298-
func getSystemPreferences() -> [String: AnyObject]? {
298+
func getSystemSettings() -> [String: AnyObject]? {
299299
var propertyListFormat = PropertyListSerialization.PropertyListFormat.xml
300300
let plistPath = NSString(string: "~/Library/Preferences/.GlobalPreferences.plist").expandingTildeInPath
301301
guard let plistXML = FileManager.default.contents(atPath: plistPath) else {
@@ -318,7 +318,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
318318
}
319319

320320
func playVolumeChangedSound() {
321-
guard let preferences = app.getSystemPreferences(), let hasSoundEnabled = preferences["com.apple.sound.beep.feedback"] as? Int, hasSoundEnabled == 1 else {
321+
guard let settings = app.getSystemSettings(), let hasSoundEnabled = settings["com.apple.sound.beep.feedback"] as? Int, hasSoundEnabled == 1 else {
322322
return
323323
}
324324
do {
@@ -342,7 +342,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
342342
self.safeMode = true
343343
let alert = NSAlert()
344344
alert.messageText = NSLocalizedString("Safe Mode Activated", comment: "Shown in the alert dialog")
345-
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")
345+
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")
346346
alert.runModal()
347347
}
348348
}

MonitorControl/Support/DisplayManager.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class DisplayManager {
1818
self.gammaActivityEnforcer.title = "Monitor Control Gamma Activity Enforcer"
1919
self.gammaActivityEnforcer.isMovableByWindowBackground = false
2020
self.gammaActivityEnforcer.backgroundColor = DEBUG_GAMMA_ENFORCER ? .red : .black
21+
self.gammaActivityEnforcer.alphaValue = 1 * (DEBUG_GAMMA_ENFORCER ? 0.5 : 0.01)
2122
self.gammaActivityEnforcer.ignoresMouseEvents = true
2223
self.gammaActivityEnforcer.level = .screenSaver
2324
self.gammaActivityEnforcer.orderFrontRegardless()

MonitorControl/Support/MediaKeyTapManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class MediaKeyTapManager: MediaKeyTapDelegate {
208208
if !self.readPrivileges(prompt: true), !firstAsk {
209209
let alert = NSAlert()
210210
alert.messageText = NSLocalizedString("Shortcuts not available", comment: "Shown in the alert dialog")
211-
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")
211+
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")
212212
alert.runModal()
213213
}
214214
}

MonitorControl/Support/MenuHandler.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,16 @@ class MenuHandler: NSMenu, NSMenuDelegate {
223223

224224
let menuItemView = NSView(frame: NSRect(x: 0, y: 0, width: viewWidth, height: iconSize + 10))
225225

226-
let preferencesIcon = NSButton()
227-
preferencesIcon.bezelStyle = .regularSquare
228-
preferencesIcon.isBordered = false
229-
preferencesIcon.setButtonType(.momentaryChange)
230-
preferencesIcon.image = NSImage(systemSymbolName: "gearshape", accessibilityDescription: NSLocalizedString("Preferences", comment: "Shown in menu"))
231-
preferencesIcon.alternateImage = NSImage(systemSymbolName: "gearshape.fill", accessibilityDescription: NSLocalizedString("Preferences", comment: "Shown in menu"))
232-
preferencesIcon.alphaValue = 0.3
233-
preferencesIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 3 - 20 - 17 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
234-
preferencesIcon.imageScaling = .scaleProportionallyUpOrDown
235-
preferencesIcon.action = #selector(app.prefsClicked)
226+
let settingsIcon = NSButton()
227+
settingsIcon.bezelStyle = .regularSquare
228+
settingsIcon.isBordered = false
229+
settingsIcon.setButtonType(.momentaryChange)
230+
settingsIcon.image = NSImage(systemSymbolName: "gearshape", accessibilityDescription: NSLocalizedString("Settings", comment: "Shown in menu"))
231+
settingsIcon.alternateImage = NSImage(systemSymbolName: "gearshape.fill", accessibilityDescription: NSLocalizedString("Settings", comment: "Shown in menu"))
232+
settingsIcon.alphaValue = 0.3
233+
settingsIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 3 - 20 - 17 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
234+
settingsIcon.imageScaling = .scaleProportionallyUpOrDown
235+
settingsIcon.action = #selector(app.prefsClicked)
236236

237237
let updateIcon = NSButton()
238238
updateIcon.bezelStyle = .regularSquare
@@ -260,7 +260,7 @@ class MenuHandler: NSMenu, NSMenuDelegate {
260260
quitIcon.imageScaling = .scaleProportionallyUpOrDown
261261
quitIcon.action = #selector(app.quitClicked)
262262

263-
menuItemView.addSubview(preferencesIcon)
263+
menuItemView.addSubview(settingsIcon)
264264
menuItemView.addSubview(updateIcon)
265265
menuItemView.addSubview(quitIcon)
266266
let item = NSMenuItem()
@@ -270,7 +270,7 @@ class MenuHandler: NSMenu, NSMenuDelegate {
270270
if app.macOS10() {
271271
self.insertItem(NSMenuItem.separator(), at: self.items.count)
272272
}
273-
self.insertItem(withTitle: NSLocalizedString("Preferences", comment: "Shown in menu"), action: #selector(app.prefsClicked), keyEquivalent: ",", at: self.items.count)
273+
self.insertItem(withTitle: NSLocalizedString("Settings", comment: "Shown in menu"), action: #selector(app.prefsClicked), keyEquivalent: ",", at: self.items.count)
274274
let updateItem = NSMenuItem(title: NSLocalizedString("Check for updates…", comment: "Shown in menu"), action: #selector(app.updaterController.checkForUpdates(_:)), keyEquivalent: "")
275275
updateItem.target = app.updaterController
276276
self.insertItem(updateItem, at: self.items.count)

0 commit comments

Comments
 (0)