listless

A simple list app for Apple platforms
Log | Files | Refs | README | LICENSE

commit 1a49007c0942dd19810380d0c8c8f7059855628f
parent da90c548a54702239d05184d739f7f8b14d58c8e
Author: Michael Camilleri <[email protected]>
Date:   Thu, 26 Feb 2026 09:51:04 +0900

Fix window coming back from hide

Co-Authored-By: Codex GPT 5.3 <[email protected]>

Diffstat:
MListlessMac/ListlessMacApp.swift | 13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/ListlessMac/ListlessMacApp.swift b/ListlessMac/ListlessMacApp.swift @@ -24,6 +24,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation { openNewWindow() } + func applicationDidUnhide(_ notification: Notification) { + NSApp.keyWindow?.makeFirstResponder(nil) + } + // MARK: - NSMenuItemValidation // AppKit calls this automatically for each item targeting self, both when the // menu opens and when keyboard shortcuts are evaluated. @@ -49,7 +53,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation { // MARK: - Actions @objc private func handleNewTask() { - MenuCoordinator.shared.newTask?() + if NSApp.windows.filter({ $0.isVisible }).isEmpty { + openNewWindow() + DispatchQueue.main.async { + MenuCoordinator.shared.newTask?() + } + } else { + MenuCoordinator.shared.newTask?() + } } @objc func cut(_ sender: Any?) {