mirror of
https://github.com/nickustinov/itsypad-macos.git
synced 2026-04-26 04:15:50 +03:00
[PR #57] [CLOSED] Fix window focus when opening files from CLI #65
Labels
No labels
bug
documentation
enhancement
help wanted
localization
pending release
pull-request
question
wip
wishlist
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/itsypad-macos#65
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/nickustinov/itsypad-macos/pull/57
Author: @nickustinov
Created: 2/25/2026
Status: ❌ Closed
Base:
main← Head:fix/cli-launch-focus📝 Commits (1)
5068f15Fix window focus when opening files from CLI📊 Changes
3 files changed (+11 additions, -3 deletions)
View changed files
📝
CHANGELOG.md(+5 -0)📝
Sources/App/AppDelegate.swift(+4 -1)📝
project.yml(+2 -2)📄 Description
Fixes #52
When opening files via
open -a Itsypad file.txt, the window would load the file but stay behind by one window layer instead of coming to the foreground.Root cause:
NSApp.activate(ignoringOtherApps: true)was called immediately before the file opening operation completed, causing a race condition where the window system hadn't fully processed the window changes before activation was requested.Solution: Defer the activation call to the next run loop iteration using
DispatchQueue.main.async. This ensures the window is fully initialized with the file content before requesting focus, allowing macOS to properly bring the window to the foreground.Testing: Run
open -a Itsypad somefile.txtfrom Terminal and verify that Itsypad window comes to the front and becomes active.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.