Skip to content

Commit 1ec4444

Browse files
authored
Close preference pane using cmd+w (MonitorControl#645)
1 parent 438d601 commit 1ec4444

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

MonitorControl/Extensions/Preferences+Extension.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Copyright © MonitorControl. @JoniVR, @theOneyouseek, @waydabber and others
22

3+
import Cocoa
4+
35
import Preferences
46

57
extension Preferences.PaneIdentifier {
@@ -9,3 +11,13 @@ extension Preferences.PaneIdentifier {
911
static let displays = Self("Displays")
1012
static let about = Self("About")
1113
}
14+
15+
public extension PreferencesWindowController {
16+
override func keyDown(with event: NSEvent) {
17+
if event.modifierFlags.intersection(.deviceIndependentFlagsMask) == .command, let key = event.charactersIgnoringModifiers {
18+
if key == "w" {
19+
self.close()
20+
}
21+
}
22+
}
23+
}

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

MonitorControlHelper/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>6293</string>
22+
<string>6295</string>
2323
<key>LSApplicationCategoryType</key>
2424
<string>public.app-category.utilities</string>
2525
<key>LSBackgroundOnly</key>

0 commit comments

Comments
 (0)