Skip to content

Commit 4a91ad2

Browse files
authored
Some minor fixes and changes (MonitorControl#662)
- Fixes clipping English text when gamma control is forced. - Fixes clipping view in Displays with Chinese text. - Set relevant options to disabled when keyboard control is disabled. - Added Command+Q shortcut in menu when it is in standard text mode (not icon mode). - Gearshape icon is used for preferences + stands a little bit apart to help user focus. - Make preferences more spacious + more room for verbose languages - Fixed dutch version clipping issues - Added beta channel update backend
1 parent 0ef61fe commit 4a91ad2

Some content is hidden

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

56 files changed

+456
-411
lines changed

MonitorControl.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
AA5314C426EBF5170041D178 /* PrefKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA5314C326EBF5170041D178 /* PrefKey.swift */; };
3737
AA665A5D26C5892800FEF2C1 /* AboutPrefsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA665A5C26C5892800FEF2C1 /* AboutPrefsViewController.swift */; };
3838
AA70817C27046B9800CC5625 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = AA70817B27046B9800CC5625 /* Sparkle */; };
39+
AA78BDBD2709FE7B00CA8DF7 /* UpdaterDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA78BDBC2709FE7B00CA8DF7 /* UpdaterDelegate.swift */; };
3940
AA99521726FE25AB00612E07 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA99521626FE25AB00612E07 /* AppDelegate.swift */; };
4041
AA99521926FE49A300612E07 /* MenuHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA99521826FE49A300612E07 /* MenuHandler.swift */; };
4142
AA9AE86F26B5BF3D00B6CA65 /* OSD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA9AE86E26B5BF3D00B6CA65 /* OSD.framework */; };
@@ -106,6 +107,7 @@
106107
AA473EB026DFF8DE0063A181 /* Command.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Command.swift; sourceTree = "<group>"; };
107108
AA5314C326EBF5170041D178 /* PrefKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrefKey.swift; sourceTree = "<group>"; };
108109
AA665A5C26C5892800FEF2C1 /* AboutPrefsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutPrefsViewController.swift; sourceTree = "<group>"; };
110+
AA78BDBC2709FE7B00CA8DF7 /* UpdaterDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdaterDelegate.swift; sourceTree = "<group>"; };
109111
AA99521626FE25AB00612E07 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
110112
AA99521826FE49A300612E07 /* MenuHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuHandler.swift; sourceTree = "<group>"; };
111113
AA9AE86E26B5BF3D00B6CA65 /* OSD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OSD.framework; path = ../../../../../System/Library/PrivateFrameworks/OSD.framework; sourceTree = "<group>"; };
@@ -263,6 +265,7 @@
263265
children = (
264266
F01B0685228221B6008E64DB /* Bridging-Header.h */,
265267
AA99521626FE25AB00612E07 /* AppDelegate.swift */,
268+
AA78BDBC2709FE7B00CA8DF7 /* UpdaterDelegate.swift */,
266269
AA99521826FE49A300612E07 /* MenuHandler.swift */,
267270
F01B068F228221B7008E64DB /* SliderHandler.swift */,
268271
6C85EFD922C941B000227EA1 /* DisplayManager.swift */,
@@ -552,6 +555,7 @@
552555
6CBFE27A23DB266000D1BC41 /* Display.swift in Sources */,
553556
AA44E70727038F7F00E06865 /* KeyboardShortcutsManager.swift in Sources */,
554557
F03A8DF21FFBAA6F0034DC27 /* OtherDisplay.swift in Sources */,
558+
AA78BDBD2709FE7B00CA8DF7 /* UpdaterDelegate.swift in Sources */,
555559
AA44E7052703790100E06865 /* KeyboardShortcuts+Extension.swift in Sources */,
556560
AA16139B26BE772E00DCF027 /* Arm64DDC.swift in Sources */,
557561
F0445D3820023E710025AE82 /* MainPrefsViewController.swift in Sources */,

MonitorControl/Enums/PrefKey.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ enum PrefKey: String {
77
// Sparkle automatic checks
88
case SUEnableAutomaticChecks
99

10+
// Receive beta updates?
11+
case isBetaChannel // This is not added to Preferences yet as it will be needed in the future only.
12+
1013
// Hide OSD for display
1114
case hideOsd
1215

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>6307</string>
22+
<string>6390</string>
2323
<key>LSApplicationCategoryType</key>
2424
<string>public.app-category.utilities</string>
2525
<key>LSMinimumSystemVersion</key>

MonitorControl/Support/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
1919
var sleepID: Int = 0 // sleep event ID
2020
var safeMode = false
2121
var jobRunning = false
22-
let updaterController = SPUStandardUpdaterController(startingUpdater: false, updaterDelegate: nil, userDriverDelegate: nil)
22+
let updaterController = SPUStandardUpdaterController(startingUpdater: false, updaterDelegate: UpdaterDelegate(), userDriverDelegate: nil)
2323

2424
var preferencePaneStyle: Preferences.Style {
2525
if !DEBUG_MACOS10, #available(macOS 11.0, *) {

MonitorControl/Support/MenuHandler.swift

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class MenuHandler: NSMenu, NSMenuDelegate {
9191
if numOfDisplays > 1, !prefs.bool(forKey: PrefKey.slidersRelevant.rawValue), !DEBUG_MACOS10, #available(macOS 11.0, *) {
9292
class BlockView: NSView {
9393
override func draw(_: NSRect) {
94-
let radius = CGFloat(11)
94+
let radius = prefs.bool(forKey: PrefKey.showTickMarks.rawValue) ? CGFloat(4) : CGFloat(11)
9595
let outerMargin = CGFloat(15)
9696
let blockRect = self.frame.insetBy(dx: outerMargin, dy: outerMargin / 2 + 2).offsetBy(dx: 0, dy: outerMargin / 2 * -1 + 7)
9797
for i in 1 ... 5 {
@@ -211,7 +211,7 @@ class MenuHandler: NSMenu, NSMenuDelegate {
211211
func addDefaultMenuOptions() {
212212
if !DEBUG_MACOS10, #available(macOS 11.0, *), prefs.integer(forKey: PrefKey.menuItemStyle.rawValue) == MenuItemStyle.icon.rawValue {
213213
let iconSize = CGFloat(22)
214-
let viewWidth = max(120, self.size.width)
214+
let viewWidth = max(130, self.size.width)
215215
var compensateForBlock: CGFloat = 0
216216
if viewWidth > 230 { // if there are display blocks, we need to compensate a bit for the negative inset of the blocks
217217
compensateForBlock = 4
@@ -223,8 +223,8 @@ class MenuHandler: NSMenu, NSMenuDelegate {
223223
preferencesIcon.bezelStyle = .regularSquare
224224
preferencesIcon.isBordered = false
225225
preferencesIcon.setButtonType(.momentaryChange)
226-
preferencesIcon.image = NSImage(systemSymbolName: "ellipsis.circle", accessibilityDescription: NSLocalizedString("Preferences...", comment: "Shown in menu"))
227-
preferencesIcon.alternateImage = NSImage(systemSymbolName: "ellipsis.circle.fill", accessibilityDescription: NSLocalizedString("Preferences...", comment: "Shown in menu"))
226+
preferencesIcon.image = NSImage(systemSymbolName: "gearshape", accessibilityDescription: NSLocalizedString("Preferences...", comment: "Shown in menu"))
227+
preferencesIcon.alternateImage = NSImage(systemSymbolName: "gearshape.fill", accessibilityDescription: NSLocalizedString("Preferences...", comment: "Shown in menu"))
228228
preferencesIcon.alphaValue = 0.3
229229
preferencesIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize - 16 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
230230
preferencesIcon.imageScaling = .scaleProportionallyUpOrDown
@@ -234,10 +234,12 @@ class MenuHandler: NSMenu, NSMenuDelegate {
234234
updateIcon.bezelStyle = .regularSquare
235235
updateIcon.isBordered = false
236236
updateIcon.setButtonType(.momentaryChange)
237-
updateIcon.image = NSImage(systemSymbolName: "arrow.triangle.2.circlepath.circle", accessibilityDescription: NSLocalizedString("Check for updates...", comment: "Shown in menu"))
238-
updateIcon.alternateImage = NSImage(systemSymbolName: "arrow.triangle.2.circlepath.circle.fill", accessibilityDescription: NSLocalizedString("Check for updates...", comment: "Shown in menu"))
237+
var symbolName = prefs.bool(forKey: PrefKey.showTickMarks.rawValue) ? "arrow.left.arrow.right.square" : "arrow.triangle.2.circlepath.circle"
238+
updateIcon.image = NSImage(systemSymbolName: symbolName, accessibilityDescription: NSLocalizedString("Check for updates...", comment: "Shown in menu"))
239+
updateIcon.alternateImage = NSImage(systemSymbolName: symbolName + ".fill", accessibilityDescription: NSLocalizedString("Check for updates...", comment: "Shown in menu"))
240+
239241
updateIcon.alphaValue = 0.3
240-
updateIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 2 - 10 - 16 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
242+
updateIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 2 - 20 - 16 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
241243
updateIcon.imageScaling = .scaleProportionallyUpOrDown
242244
updateIcon.action = #selector(app.updaterController.checkForUpdates(_:))
243245
updateIcon.target = app.updaterController
@@ -246,10 +248,11 @@ class MenuHandler: NSMenu, NSMenuDelegate {
246248
quitIcon.bezelStyle = .regularSquare
247249
quitIcon.isBordered = false
248250
quitIcon.setButtonType(.momentaryChange)
249-
quitIcon.image = NSImage(systemSymbolName: "xmark.circle", accessibilityDescription: NSLocalizedString("Quit", comment: "Shown in menu"))
250-
quitIcon.alternateImage = NSImage(systemSymbolName: "xmark.circle.fill", accessibilityDescription: NSLocalizedString("Quit", comment: "Shown in menu"))
251+
symbolName = prefs.bool(forKey: PrefKey.showTickMarks.rawValue) ? "multiply.square" : "xmark.circle"
252+
quitIcon.image = NSImage(systemSymbolName: symbolName, accessibilityDescription: NSLocalizedString("Quit", comment: "Shown in menu"))
253+
quitIcon.alternateImage = NSImage(systemSymbolName: symbolName + ".fill", accessibilityDescription: NSLocalizedString("Quit", comment: "Shown in menu"))
251254
quitIcon.alphaValue = 0.3
252-
quitIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 3 - 20 - 16 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
255+
quitIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 3 - 30 - 16 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
253256
quitIcon.imageScaling = .scaleProportionallyUpOrDown
254257
quitIcon.action = #selector(app.quitClicked)
255258

@@ -267,7 +270,7 @@ class MenuHandler: NSMenu, NSMenuDelegate {
267270
let updateItem = NSMenuItem(title: NSLocalizedString("Check for updates...", comment: "Shown in menu"), action: #selector(app.updaterController.checkForUpdates(_:)), keyEquivalent: "")
268271
updateItem.target = app.updaterController
269272
self.insertItem(updateItem, at: self.items.count)
270-
self.insertItem(withTitle: NSLocalizedString("Quit", comment: "Shown in menu"), action: #selector(app.quitClicked), keyEquivalent: "", at: self.items.count)
273+
self.insertItem(withTitle: NSLocalizedString("Quit", comment: "Shown in menu"), action: #selector(app.quitClicked), keyEquivalent: "q", at: self.items.count)
271274
}
272275
}
273276
}

MonitorControl/Support/SliderHandler.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SliderHandler {
2929
let offsetY: CGFloat = -1.5
3030

3131
let tickMarkKnobExtraInset: CGFloat = 4
32-
let tickMarkKnobExtraRadiusMultiplier: CGFloat = 0.5
32+
let tickMarkKnobExtraRadiusMultiplier: CGFloat = 0.25
3333

3434
var numOfTickmarks: Int = 0
3535
var isHighlightDisplayItems: Bool = false
@@ -102,7 +102,7 @@ class SliderHandler {
102102
for i in 1 ... self.numOfTickmarks - 2 {
103103
let currentMarkLocation = CGFloat((Float(1) / Float(self.numOfTickmarks - 1)) * Float(i))
104104
let tickMarkBounds = NSRect(x: aRect.origin.x + aRect.height + self.tickMarkKnobExtraInset - knobRect.height + self.tickMarkKnobExtraInset * 2 + CGFloat(Float((aRect.width - self.tickMarkKnobExtraInset * 5) * currentMarkLocation)), y: aRect.origin.y + aRect.height * (1 / 3), width: 4, height: aRect.height / 3)
105-
let tickmark = NSBezierPath(roundedRect: tickMarkBounds, xRadius: 2, yRadius: 2)
105+
let tickmark = NSBezierPath(roundedRect: tickMarkBounds, xRadius: 1, yRadius: 1)
106106
self.tickMarkColor.setFill()
107107
tickmark.fill()
108108
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright © MonitorControl. @JoniVR, @theOneyouseek, @waydabber and others
2+
3+
import Foundation
4+
import Sparkle
5+
6+
class UpdaterDelegate: NSObject, SPUUpdaterDelegate {
7+
func allowedChannels(for _: SPUUpdater) -> Set<String> {
8+
return prefs.bool(forKey: PrefKey.isBetaChannel.rawValue) ? Set(["beta"]) : Set([])
9+
}
10+
}

0 commit comments

Comments
 (0)