From 1ec444460c73c397dab979b6c739d1f0bca03438 Mon Sep 17 00:00:00 2001 From: Joni Van Roost Date: Fri, 1 Oct 2021 20:28:22 +0200 Subject: [PATCH] Close preference pane using cmd+w (#645) --- .../Extensions/Preferences+Extension.swift | 12 ++++++++++++ MonitorControl/Info.plist | 2 +- MonitorControlHelper/Info.plist | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/MonitorControl/Extensions/Preferences+Extension.swift b/MonitorControl/Extensions/Preferences+Extension.swift index 292ca83..ef1331b 100644 --- a/MonitorControl/Extensions/Preferences+Extension.swift +++ b/MonitorControl/Extensions/Preferences+Extension.swift @@ -1,5 +1,7 @@ // Copyright © MonitorControl. @JoniVR, @theOneyouseek, @waydabber and others +import Cocoa + import Preferences extension Preferences.PaneIdentifier { @@ -9,3 +11,13 @@ extension Preferences.PaneIdentifier { static let displays = Self("Displays") static let about = Self("About") } + +public extension PreferencesWindowController { + override func keyDown(with event: NSEvent) { + if event.modifierFlags.intersection(.deviceIndependentFlagsMask) == .command, let key = event.charactersIgnoringModifiers { + if key == "w" { + self.close() + } + } + } +} diff --git a/MonitorControl/Info.plist b/MonitorControl/Info.plist index 3170008..38811e6 100644 --- a/MonitorControl/Info.plist +++ b/MonitorControl/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 6293 + 6295 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/MonitorControlHelper/Info.plist b/MonitorControlHelper/Info.plist index 0f1277b..554db54 100644 --- a/MonitorControlHelper/Info.plist +++ b/MonitorControlHelper/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 6293 + 6295 LSApplicationCategoryType public.app-category.utilities LSBackgroundOnly