aboutsummaryrefslogtreecommitdiff
path: root/Hotline
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-05-26 17:30:41 -0700
committerDustin Mierau <dustin@mierau.me>2024-05-26 17:30:41 -0700
commitbb292ec9ade3ed323108ff805b4a6c53115122ba (patch)
treed46ca0e40a9c1d9019c3c078e8fa8fe48b5f0d54 /Hotline
parent63cc41b93eec7505c3a93a1537fb62ae9a723237 (diff)
Hold option when double clicking server in Servers window to open window for that server without autoconnecting. Found a better way to check for currently pressed key modifiers.
Diffstat (limited to 'Hotline')
-rw-r--r--Hotline/macOS/HotlinePanelView.swift3
-rw-r--r--Hotline/macOS/ServerView.swift6
-rw-r--r--Hotline/macOS/TrackerView.swift3
3 files changed, 7 insertions, 5 deletions
diff --git a/Hotline/macOS/HotlinePanelView.swift b/Hotline/macOS/HotlinePanelView.swift
index 9915e49..374e379 100644
--- a/Hotline/macOS/HotlinePanelView.swift
+++ b/Hotline/macOS/HotlinePanelView.swift
@@ -16,8 +16,7 @@ struct HotlinePanelView: View {
HStack(spacing: 16) {
Button {
- if let event = NSApp.currentEvent,
- event.modifierFlags.contains(.option) {
+ if NSEvent.modifierFlags.contains(.option) {
openWindow(id: "server")
}
else {
diff --git a/Hotline/macOS/ServerView.swift b/Hotline/macOS/ServerView.swift
index e342f73..89f353b 100644
--- a/Hotline/macOS/ServerView.swift
+++ b/Hotline/macOS/ServerView.swift
@@ -224,7 +224,11 @@ struct ServerView: View {
connectAddress = server.address
connectLogin = server.login
connectPassword = server.password
- connectToServer()
+
+ // Connect to server automatically unless the option key is held down.
+ if !NSEvent.modifierFlags.contains(.option) {
+ connectToServer()
+ }
}
.focusedSceneValue(\.activeHotlineModel, model)
.focusedSceneValue(\.activeServerState, state)
diff --git a/Hotline/macOS/TrackerView.swift b/Hotline/macOS/TrackerView.swift
index 5ab4c65..ad0b08c 100644
--- a/Hotline/macOS/TrackerView.swift
+++ b/Hotline/macOS/TrackerView.swift
@@ -122,8 +122,7 @@ struct TrackerView: View {
}
if clickedItem.type == .tracker {
- if let event = NSApp.currentEvent,
- event.modifierFlags.contains(.option) {
+ if NSEvent.modifierFlags.contains(.option) {
trackerSheetBookmark = clickedItem
}
else {