Skip to content

Commit 9b1795d

Browse files
authored
Various fixes and improvements for 4.0.0 (MonitorControl#736)
- Small change of wording under Displays to reflect the fact that software dimming is not always gamma now - Fixed an unneeded box control title leaking into localization files. - Updated Italian Localization - thanks to @picov - Fix: virtual displays are now properly ignored in gamma interference detection. - Fix for too long display names looking bad in menu - Fix for log errors about unneeded missing outlet connection errors - Improved reset for virtual and Apple displays. - Fixed menu showing blank space for display with no controls. - Made brightness availability changeable for built-in and virtual displays. - Updated french localization - thanks to @the0neyouseek
1 parent d34cf38 commit 9b1795d

29 files changed

+139
-179
lines changed

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

MonitorControl/InternetAccessPolicy.plist

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,34 @@
2424
<key>DenyConsequences</key>
2525
<string>SoftwareUpdateDenyConsequences</string>
2626
</dict>
27+
<dict>
28+
<key>IsIncoming</key>
29+
<false/>
30+
<key>Host</key>
31+
<string>github.com</string>
32+
<key>NetworkProtocol</key>
33+
<string>TCP</string>
34+
<key>Port</key>
35+
<string>443</string>
36+
<key>Purpose</key>
37+
<string>SoftwareUpdatePurpose</string>
38+
<key>DenyConsequences</key>
39+
<string>SoftwareUpdateDenyConsequences</string>
40+
</dict>
41+
<dict>
42+
<key>IsIncoming</key>
43+
<false/>
44+
<key>Host</key>
45+
<string>githubusercontent.com</string>
46+
<key>NetworkProtocol</key>
47+
<string>TCP</string>
48+
<key>Port</key>
49+
<string>443</string>
50+
<key>Purpose</key>
51+
<string>SoftwareUpdatePurpose</string>
52+
<key>DenyConsequences</key>
53+
<string>SoftwareUpdateDenyConsequences</string>
54+
</dict>
2755
</array>
2856
</dict>
2957
</plist>

MonitorControl/Model/Display.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ class Display: Equatable {
9191
}
9292

9393
func stepBrightness(isUp: Bool, isSmallIncrement: Bool) {
94+
guard !self.readPrefAsBool(key: .unavailableDDC, for: .brightness) else {
95+
return
96+
}
9497
let value = self.calcNewBrightness(isUp: isUp, isSmallIncrement: isSmallIncrement)
9598
if self.setBrightness(value) {
9699
OSDUtils.showOsd(displayID: self.identifier, command: .brightness, value: value * 64, maxValue: 64)
@@ -271,7 +274,7 @@ class Display: Equatable {
271274

272275
func checkGammaInterference() {
273276
let currentSwBrightness = self.getSwBrightness()
274-
guard !DisplayManager.shared.gammaInterferenceWarningShown, !(prefs.bool(forKey: PrefKey.disableCombinedBrightness.rawValue)), !self.readPrefAsBool(key: .avoidGamma), !self.smoothBrightnessRunning, self.prefExists(key: .SwBrightness), abs(currentSwBrightness - self.readPrefAsFloat(key: .SwBrightness)) > 0.02 else {
277+
guard !DisplayManager.shared.gammaInterferenceWarningShown, !(prefs.bool(forKey: PrefKey.disableCombinedBrightness.rawValue)), !self.readPrefAsBool(key: .avoidGamma), !self.isVirtual, !self.smoothBrightnessRunning, self.prefExists(key: .SwBrightness), abs(currentSwBrightness - self.readPrefAsFloat(key: .SwBrightness)) > 0.02 else {
275278
return
276279
}
277280
DisplayManager.shared.gammaInterferenceCounter += 1

MonitorControl/Support/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
210210
let counter = dispatchedCounter == 0 ? 10 : dispatchedCounter
211211
self.startupActionWriteCounter = dispatchedCounter == 0 ? counter : self.startupActionWriteCounter
212212
guard prefs.integer(forKey: PrefKey.startupAction.rawValue) == StartupAction.write.rawValue, self.startupActionWriteCounter == counter else {
213-
return
213+
return
214214
}
215215
os_log("Sober write action repeat for DDC - %{public}@", type: .info, String(counter))
216216
DisplayManager.shared.restoreOtherDisplays()

MonitorControl/Support/MenuHandler.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,15 @@ class MenuHandler: NSMenu, NSMenuDelegate {
113113
contentWidth = max(addedSliderHandler.view!.frame.width, contentWidth)
114114
contentHeight += addedSliderHandler.view!.frame.height
115115
}
116+
let margin = CGFloat(13)
116117
var blockNameView: NSTextField?
117118
if blockName != "" {
118119
contentHeight += 21
119120
let attrs: [NSAttributedString.Key: Any] = [.foregroundColor: NSColor.textColor, .font: NSFont.boldSystemFont(ofSize: 12)]
120121
blockNameView = NSTextField(labelWithAttributedString: NSAttributedString(string: blockName, attributes: attrs))
122+
blockNameView?.frame.size.width = contentWidth - margin * 2
121123
blockNameView?.alphaValue = 0.5
122124
}
123-
let margin = CGFloat(13)
124125
let itemView = BlockView(frame: NSRect(x: 0, y: 0, width: contentWidth + margin * 2, height: contentHeight + margin * 2))
125126
var sliderPosition = CGFloat(margin * -1 + 1)
126127
for addedSliderHandler in addedSliderHandlers {
@@ -134,7 +135,9 @@ class MenuHandler: NSMenu, NSMenuDelegate {
134135
}
135136
let item = NSMenuItem()
136137
item.view = itemView
137-
monitorSubMenu.insertItem(item, at: 0)
138+
if addedSliderHandlers.count != 0 {
139+
monitorSubMenu.insertItem(item, at: 0)
140+
}
138141
} else {
139142
for addedSliderHandler in addedSliderHandlers {
140143
self.addSliderItem(monitorSubMenu: monitorSubMenu, sliderHandler: addedSliderHandler)
@@ -220,8 +223,8 @@ class MenuHandler: NSMenu, NSMenuDelegate {
220223
preferencesIcon.bezelStyle = .regularSquare
221224
preferencesIcon.isBordered = false
222225
preferencesIcon.setButtonType(.momentaryChange)
223-
preferencesIcon.image = NSImage(systemSymbolName: "gearshape", accessibilityDescription: NSLocalizedString("Preferences...", comment: "Shown in menu"))
224-
preferencesIcon.alternateImage = NSImage(systemSymbolName: "gearshape.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"))
225228
preferencesIcon.alphaValue = 0.3
226229
preferencesIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 3 - 30 - 16 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
227230
preferencesIcon.imageScaling = .scaleProportionallyUpOrDown
@@ -232,8 +235,8 @@ class MenuHandler: NSMenu, NSMenuDelegate {
232235
updateIcon.isBordered = false
233236
updateIcon.setButtonType(.momentaryChange)
234237
var symbolName = prefs.bool(forKey: PrefKey.showTickMarks.rawValue) ? "arrow.left.arrow.right.square" : "arrow.triangle.2.circlepath.circle"
235-
updateIcon.image = NSImage(systemSymbolName: symbolName, accessibilityDescription: NSLocalizedString("Check for updates...", comment: "Shown in menu"))
236-
updateIcon.alternateImage = NSImage(systemSymbolName: symbolName + ".fill", accessibilityDescription: NSLocalizedString("Check for updates...", comment: "Shown in menu"))
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"))
237240

238241
updateIcon.alphaValue = 0.3
239242
updateIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 2 - 10 - 16 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
@@ -263,8 +266,8 @@ class MenuHandler: NSMenu, NSMenuDelegate {
263266
if app.macOS10() {
264267
self.insertItem(NSMenuItem.separator(), at: self.items.count)
265268
}
266-
self.insertItem(withTitle: NSLocalizedString("Preferences...", comment: "Shown in menu"), action: #selector(app.prefsClicked), keyEquivalent: "", at: self.items.count)
267-
let updateItem = NSMenuItem(title: NSLocalizedString("Check for updates...", comment: "Shown in menu"), action: #selector(app.updaterController.checkForUpdates(_:)), keyEquivalent: "")
269+
self.insertItem(withTitle: NSLocalizedString("Preferences", comment: "Shown in menu"), action: #selector(app.prefsClicked), keyEquivalent: "", at: self.items.count)
270+
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)
270273
self.insertItem(withTitle: NSLocalizedString("Quit", comment: "Shown in menu"), action: #selector(app.quitClicked), keyEquivalent: "q", at: self.items.count)

MonitorControl/UI/Base.lproj/Main.storyboard

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -684,16 +684,10 @@
684684
<outlet property="menuItemStyle" destination="6td-Zq-3e7" id="yMt-fU-PZX"/>
685685
<outlet property="multiSliders" destination="78Q-P6-b97" id="uJP-0H-YuL"/>
686686
<outlet property="quitApplication" destination="dy4-nH-cIr" id="aXV-0Q-H4L"/>
687-
<outlet property="rowHideIconSpearator" destination="Cor-61-8R5" id="Gvs-er-qj3"/>
688-
<outlet property="rowIconShow" destination="jyr-gk-BEN" id="Fuj-5x-UI7"/>
689687
<outlet property="rowMenuItemStyle" destination="ZS3-Gy-pfA" id="tVN-WD-eoa"/>
690688
<outlet property="rowMultiSliders" destination="CuW-77-ls4" id="XPi-6a-J58"/>
691-
<outlet property="rowPercentCheck" destination="rhT-kW-PmZ" id="NMJ-KF-PSN"/>
692-
<outlet property="rowPercentText" destination="fDY-kq-bjz" id="BFa-2b-iQZ"/>
693689
<outlet property="rowQuitButton" destination="OpF-3Q-ZZp" id="0vU-Ls-hJj"/>
694690
<outlet property="rowQuitButtonText" destination="HAl-L8-LPI" id="6CN-Wq-CBJ"/>
695-
<outlet property="rowShowContrastCheck" destination="xbz-Tf-py0" id="JRd-Xz-Sz8"/>
696-
<outlet property="rowShowContrastText" destination="KPA-bi-7h3" id="vqt-0f-Qbv"/>
697691
<outlet property="rowSlidersCombineText" destination="MaK-MK-gRQ" id="OPU-QW-LEv"/>
698692
<outlet property="rowTickCheck" destination="Ojm-8A-t1d" id="0Aq-FJ-wGD"/>
699693
<outlet property="rowTickText" destination="JCM-Me-DIg" id="iZR-F3-x4s"/>
@@ -1195,12 +1189,8 @@
11951189
<outlet property="rowKeyboardBrightnessPopUp" destination="dwB-Ku-aql" id="bM0-Ms-24E"/>
11961190
<outlet property="rowKeyboardBrightnessText" destination="pf1-cW-4bf" id="Fxg-Uy-UHE"/>
11971191
<outlet property="rowMultiKeyboardBrightness" destination="I9B-dr-BOu" id="yDW-15-8xH"/>
1198-
<outlet property="rowSeparateCombinedScaleCheck" destination="4hU-dS-J9a" id="6Zr-4J-FsI"/>
1199-
<outlet property="rowSeparateCombinedScaleText" destination="ON8-Vi-iMV" id="lRE-Ad-h8L"/>
12001192
<outlet property="rowUseAudioMouseText" destination="ypS-k5-pR7" id="yr6-jO-zTY"/>
12011193
<outlet property="rowUseAudioNameText" destination="73k-Ho-qxa" id="yHm-CV-4aa"/>
1202-
<outlet property="rowUseFineScaleCheck" destination="jJT-as-drf" id="2fT-4t-kAg"/>
1203-
<outlet property="rowUseFineScaleText" destination="4Ie-T6-Ifw" id="faU-z6-bgQ"/>
12041194
<outlet property="rowUseFocusText" destination="UIH-jA-Cfi" id="NAn-5h-Shx"/>
12051195
<outlet property="separateCombinedScale" destination="f8L-OE-kAQ" id="Pgg-cY-eTx"/>
12061196
<outlet property="useFineScale" destination="M5g-VZ-qiM" id="5ZM-Nh-97j"/>
@@ -1219,7 +1209,7 @@
12191209
<view key="view" translatesAutoresizingMaskIntoConstraints="NO" id="aj0-6l-QE2">
12201210
<rect key="frame" x="0.0" y="0.0" width="730" height="533"/>
12211211
<subviews>
1222-
<box boxType="custom" borderType="none" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="3a3-In-jeQ">
1212+
<box boxType="custom" borderType="none" borderWidth="0.0" title="#bc-ignore!" translatesAutoresizingMaskIntoConstraints="NO" id="3a3-In-jeQ">
12231213
<rect key="frame" x="0.0" y="0.0" width="730" height="30"/>
12241214
<view key="contentView" id="M21-aG-h0Y">
12251215
<rect key="frame" x="0.0" y="0.0" width="730" height="30"/>
@@ -1348,7 +1338,7 @@
13481338
</textFieldCell>
13491339
</textField>
13501340
<textField verticalHuggingPriority="750" id="mIA-Wh-7aB">
1351-
<rect key="frame" x="78" y="492" width="285" height="21"/>
1341+
<rect key="frame" x="78" y="492" width="463" height="21"/>
13521342
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
13531343
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" title="#bc-ignore!" id="ibQ-4u-ClE">
13541344
<font key="font" textStyle="title2" name=".SFNS-Regular"/>
@@ -1842,7 +1832,7 @@
18421832
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="1ct-qM-zrz">
18431833
<rect key="frame" x="483" y="259" width="106" height="14"/>
18441834
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
1845-
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="(Gamma-&gt;DDC)" id="Bid-UL-blc">
1835+
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="(Software-&gt;DDC)" id="Bid-UL-blc">
18461836
<font key="font" metaFont="smallSystem"/>
18471837
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
18481838
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -2068,6 +2058,9 @@
20682058
<buttonCell key="cell" type="bevel" title="https://monitorcontrol.app" bezelStyle="rounded" alignment="left" imageScaling="proportionallyDown" inset="2" id="42n-Zy-AqF">
20692059
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
20702060
<font key="font" metaFont="system"/>
2061+
<attributedString key="userComments">
2062+
<fragment content="#bc-ignore!"/>
2063+
</attributedString>
20712064
</buttonCell>
20722065
<color key="contentTintColor" name="linkColor" catalog="System" colorSpace="catalog"/>
20732066
<connections>

MonitorControl/UI/de.lproj/Localizable.strings

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"Built-in Display" = "Integrierter Monitor";
2424

2525
/* Shown in menu */
26-
"Check for updates..." = "Nach Updates suchen...";
26+
"Check for updates" = "Nach Updates suchen";
2727

2828
/* Shown in menu */
2929
"Contrast" = "Kontrast";
@@ -86,7 +86,7 @@
8686
"Preferences for an incompatible previous app version detected. Default preferences are reloaded." = "Einstellungen für eine inkompatible Vorgängerversion des Programms erkannt. Die Standardeinstellungen werden neu geladen.";
8787

8888
/* Shown in menu */
89-
"Preferences..." = "Einstellungen...";
89+
"Preferences" = "Einstellungen";
9090

9191
/* Shown in menu */
9292
"Quit" = "Beenden";

MonitorControl/UI/de.lproj/Main.strings

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,12 @@
1313
/* Class = "NSTextFieldCell"; title = "DDC min"; ObjectID = "1zE-fg-xEm"; */
1414
"1zE-fg-xEm.title" = "DDC min";
1515

16-
/* Class = "NSBox"; title = "Box"; ObjectID = "3a3-In-jeQ"; */
17-
"3a3-In-jeQ.title" = "Box";
18-
1916
/* Class = "NSMenuItem"; title = "Show separate controls for each display in menu"; ObjectID = "3eO-bN-ZRl"; */
2017
"3eO-bN-ZRl.title" = "Separate Steuerung für jeden Monitor im Menü anzeigen";
2118

2219
/* Class = "NSMenuItem"; title = "Apply last saved values to the display"; ObjectID = "3Jr-bW-YYq"; */
2320
"3Jr-bW-YYq.title" = "Zuletzt gespeicherte Werte auf den Monitor anwenden";
2421

25-
/* Class = "NSButtonCell"; title = "https://monitorcontrol.app"; ObjectID = "42n-Zy-AqF"; */
26-
"42n-Zy-AqF.title" = "https://monitorcontrol.app";
27-
2822
/* Class = "NSMenuItem"; title = "Custom keyboard shortcuts"; ObjectID = "4CG-0I-anB"; */
2923
"4CG-0I-anB.title" = "Benutzerdefinierte Tastaturkürzel";
3024

@@ -73,8 +67,8 @@
7367
/* Class = "NSTextFieldCell"; title = "Brightness:"; ObjectID = "Bhb-6l-uPQ"; */
7468
"Bhb-6l-uPQ.title" = "Helligkeit:";
7569

76-
/* Class = "NSTextFieldCell"; title = "(Gamma->DDC)"; ObjectID = "Bid-UL-blc"; */
77-
"Bid-UL-blc.title" = "(Gamma->DDC)";
70+
/* Class = "NSTextFieldCell"; title = "(Software->DDC)"; ObjectID = "Bid-UL-blc"; */
71+
"Bid-UL-blc.title" = "(Software->DDC)";
7872

7973
/* Class = "NSTextFieldCell"; title = "For hardware (DDC) controlled displays only. Results may vary."; ObjectID = "bIe-6O-xEH"; */
8074
"bIe-6O-xEH.title" = "Nur für hardwaregesteuerte (DDC) Monitore. Die Ergebnisse können variieren.";

MonitorControl/UI/en.lproj/Localizable.strings

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"Built-in Display" = "Built-in Display";
2424

2525
/* Shown in menu */
26-
"Check for updates..." = "Check for updates...";
26+
"Check for updates" = "Check for updates";
2727

2828
/* Shown in menu */
2929
"Contrast" = "Contrast";
@@ -86,7 +86,7 @@
8686
"Preferences for an incompatible previous app version detected. Default preferences are reloaded." = "Preferences for an incompatible previous app version detected. Default preferences are reloaded.";
8787

8888
/* Shown in menu */
89-
"Preferences..." = "Preferences...";
89+
"Preferences" = "Preferences";
9090

9191
/* Shown in menu */
9292
"Quit" = "Quit";

MonitorControl/UI/en.lproj/Main.strings

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,12 @@
1313
/* Class = "NSTextFieldCell"; title = "DDC min"; ObjectID = "1zE-fg-xEm"; */
1414
"1zE-fg-xEm.title" = "DDC min";
1515

16-
/* Class = "NSBox"; title = "Box"; ObjectID = "3a3-In-jeQ"; */
17-
"3a3-In-jeQ.title" = "Box";
18-
1916
/* Class = "NSMenuItem"; title = "Show separate controls for each display in menu"; ObjectID = "3eO-bN-ZRl"; */
2017
"3eO-bN-ZRl.title" = "Show separate controls for each display in menu";
2118

2219
/* Class = "NSMenuItem"; title = "Apply last saved values to the display"; ObjectID = "3Jr-bW-YYq"; */
2320
"3Jr-bW-YYq.title" = "Apply last saved values to the display";
2421

25-
/* Class = "NSButtonCell"; title = "https://monitorcontrol.app"; ObjectID = "42n-Zy-AqF"; */
26-
"42n-Zy-AqF.title" = "https://monitorcontrol.app";
27-
2822
/* Class = "NSMenuItem"; title = "Custom keyboard shortcuts"; ObjectID = "4CG-0I-anB"; */
2923
"4CG-0I-anB.title" = "Custom keyboard shortcuts";
3024

@@ -73,8 +67,8 @@
7367
/* Class = "NSTextFieldCell"; title = "Brightness:"; ObjectID = "Bhb-6l-uPQ"; */
7468
"Bhb-6l-uPQ.title" = "Brightness:";
7569

76-
/* Class = "NSTextFieldCell"; title = "(Gamma->DDC)"; ObjectID = "Bid-UL-blc"; */
77-
"Bid-UL-blc.title" = "(Gamma->DDC)";
70+
/* Class = "NSTextFieldCell"; title = "(Software->DDC)"; ObjectID = "Bid-UL-blc"; */
71+
"Bid-UL-blc.title" = "(Software->DDC)";
7872

7973
/* Class = "NSTextFieldCell"; title = "For hardware (DDC) controlled displays only. Results may vary."; ObjectID = "bIe-6O-xEH"; */
8074
"bIe-6O-xEH.title" = "For hardware (DDC) controlled displays only. Results may vary.";

0 commit comments

Comments
 (0)