Skip to content

Open the window on macOS by running gioapp.Main on the main thread - #123

Merged
quanticstudios merged 1 commit into
quanticstudios:mainfrom
Gustavobelfort:fix/macos-app-main
Oct 17, 2026
Merged

quanticstudios merged 1 commit into
quanticstudios:mainfrom
Gustavobelfort:fix/macos-app-main

Conversation

@Gustavobelfort

Copy link
Copy Markdown
Contributor

Problem

On macOS, pitwall never opens a window. Fixes #122.

AppKit has to run [NSApp run] on the main thread, and Gio starts it from gioapp.Main(). cmd/pitwall never calls it, so newWindow waits forever for the app to finish launching.

Result

The GUI commands (pitwall, -s, --host) now go through onMain. On darwin it runs the command in a goroutine and calls gioapp.Main() on the main goroutine, the same way cmd/pwdemo-* do. It exits the process when the window closes. Other platforms behave as before. The existing error handling moved unchanged into exit().

Verification

OS and version Architecture Go version Build command and result Test commands and results
macOS 26.5.1 arm64 go1.27.1 GOFLAGS=-tags=novulkan go build ./cmd/pitwall: ok; go vet ./...: ok; gofmt -l: clean go test ./internal/agent ./internal/pane ./internal/model ./internal/layout ./internal/input: all ok. Manual: the patched binary opens the window (display: AppKit, window focused: true in gui.log); the unpatched build does not.

go test ./cmd/pitwall (not in CONTRIBUTING's macOS list) fails the same 8 tests on unpatched main and on this branch (TestDialOrStart*, TestAgentTalk, TestRemoteReconnects, TestRunStaysOffHome, TestHookRefusalLostToReset), so this change doesn't cause them.

Platforms not tested: Linux, Windows. The non-darwin path calls the same function synchronously, as before.

  • I listed the OS, architecture, and build/test results for each environment I tested.
  • The change addresses one problem.
  • Behavior changes have a regression test. (Needs an AppKit main thread; covered manually.)
  • Documentation and third-party notices match the change.
  • Logs, screenshots and fixtures contain no private data or credentials.

🤖 Generated with Claude Code

AppKit needs the main thread for [NSApp run], which gioapp.Main starts.
cmd/pitwall never called it, so on macOS Gio's newWindow waited forever
for the app to launch and no window appeared. Run the GUI commands in a
goroutine and call gioapp.Main on main, as cmd/pwdemo-* already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@quanticstudios
quanticstudios enabled auto-merge (squash) October 17, 2026 02:29
@quanticstudios
quanticstudios merged commit e0d858b into quanticstudios:main Oct 17, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS: GUI never opens a window (app.Main is never called)

2 participants