aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-01-16 18:01:59 +0530
committerRoopesh Chander <roop@roopc.net>2019-01-16 18:01:59 +0530
commita2871e63a7eb460095001167ad050f3b4e11415e (patch)
tree5ed5e8883c365e23058ca7565a3b551a6715e358 /WireGuard
parentmacOS: Networks should show allowedIPs and disappear when inactive (diff)
downloadwireguard-apple-a2871e63a7eb460095001167ad050f3b4e11415e.tar.xz
wireguard-apple-a2871e63a7eb460095001167ad050f3b4e11415e.zip
macOS: Support window management keyboard shortcuts
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard')
-rw-r--r--WireGuard/WireGuard/UI/macOS/Application.swift9
1 files changed, 6 insertions, 3 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/Application.swift b/WireGuard/WireGuard/UI/macOS/Application.swift
index fba0ac6..644bbab 100644
--- a/WireGuard/WireGuard/UI/macOS/Application.swift
+++ b/WireGuard/WireGuard/UI/macOS/Application.swift
@@ -5,13 +5,16 @@ import Cocoa
class Application: NSApplication {
- private let editorCommands = [
+ private let characterKeyCommands = [
"x": #selector(NSText.cut(_:)),
"c": #selector(NSText.copy(_:)),
"v": #selector(NSText.paste(_:)),
"z": #selector(UndoActionRespondable.undo(_:)),
"a": #selector(NSResponder.selectAll(_:)),
- "Z": #selector(UndoActionRespondable.redo(_:))
+ "Z": #selector(UndoActionRespondable.redo(_:)),
+ "w": #selector(NSWindow.performClose(_:)),
+ "m": #selector(NSWindow.performMiniaturize(_:)),
+ "q": #selector(NSApplication.terminate(_:))
]
private var appDelegate: AppDelegate? //swiftlint:disable:this weak_delegate
@@ -33,7 +36,7 @@ class Application: NSApplication {
if event.type == .keyDown,
(modifierFlags == NSEvent.ModifierFlags.command.rawValue || modifierFlags == NSEvent.ModifierFlags.command.rawValue | NSEvent.ModifierFlags.shift.rawValue),
- let selector = editorCommands[event.charactersIgnoringModifiers ?? ""] {
+ let selector = characterKeyCommands[event.charactersIgnoringModifiers ?? ""] {
sendAction(selector, to: nil, from: self)
} else {
super.sendEvent(event)