From 49c4394a48464e996749914ddd60e4eb9ebb58bd Mon Sep 17 00:00:00 2001 From: Emmanuil Andreev Date: Mon, 26 Jan 2026 15:55:11 +0500 Subject: [PATCH] Added default hotkey for settings window. --- LaunchNext/LaunchpadApp.swift | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/LaunchNext/LaunchpadApp.swift b/LaunchNext/LaunchpadApp.swift index 1b6f9d6..87b5694 100644 --- a/LaunchNext/LaunchpadApp.swift +++ b/LaunchNext/LaunchpadApp.swift @@ -19,7 +19,19 @@ class BorderlessWindow: NSWindow { @main struct LaunchpadApp: App { @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate - var body: some Scene { Settings {} } + var body: some Scene { + Settings{ + EmptyView() + } + .commands { + CommandGroup(replacing: .appSettings) { + Button("Settings") { + AppDelegate.shared?.openSettings() + } + .keyboardShortcut(",", modifiers: .command) + } + } + } } class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSGestureRecognizerDelegate { @@ -74,7 +86,19 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSGestureR if appStore.isFullscreenMode { updateWindowMode(isFullscreen: true) } } - + + private var isLaunchpadWindowVisibleNow: Bool { + guard windowIsVisible, !isAnimatingWindow, let w = window else { return false } + if !w.isVisible { return false } + if !w.occlusionState.contains(.visible) { return false } + return true + } + + func openSettings() { + guard isLaunchpadWindowVisibleNow else { return } + self.appStore.isSetting = true + } + // MARK: - Global Hotkey func updateGlobalHotKey(configuration: AppStore.HotKeyConfiguration?) {