Skip to content

feat(macos): open Kaku with cwd from external apps#135

Merged
tw93 merged 2 commits intotw93:mainfrom
nguyenphutrong:feature/fix-vscode-open-cwd-tab
Mar 3, 2026
Merged

feat(macos): open Kaku with cwd from external apps#135
tw93 merged 2 commits intotw93:mainfrom
nguyenphutrong:feature/fix-vscode-open-cwd-tab

Conversation

@nguyenphutrong
Copy link
Contributor

@nguyenphutrong nguyenphutrong commented Mar 3, 2026

This PR makes macOS open requests launch Kaku in the requested cwd instead of always falling back to the default ~/ tab.

  • queue open-path requests during cold start until the GUI connection is ready
  • handle file paths and file URLs from external apps like Finder and VS Code as cwd targets
  • prefer opening the requested cwd in an existing tab when possible
  • defer the default startup spawn to avoid creating an extra ~/ tab before the cwd request arrives

- queue macOS open-path events during cold start
- prefer opening external open-path in existing tab
- defer default gui-startup spawn to avoid duplicate ~/ tab
@nguyenphutrong nguyenphutrong changed the title fix(macos): avoid extra ~/ tab on vscode open feat(macos): open Kaku with cwd from external apps Mar 3, 2026
Copy link
Owner

@tw93 tw93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
@nguyenphutrong Thanks for this contribution! I've merged your PR with a small optimization.

Your Rust-side handling with schedule_open_untitled_spawn() is well designed. The sequence-based cancellation and should_suppress_open_untitled_spawn() guard provide robust protection against duplicate tabs.

I removed the 0.8s delay in kaku.lua since the Rust-side 350ms defer mechanism is sufficient. This avoids slowing down normal startup for users who launch Kaku directly.

Thanks again for fixing this VS Code integration issue!

@tw93 tw93 merged commit 805f0b5 into tw93:main Mar 3, 2026
3 checks passed
tw93 added a commit that referenced this pull request Mar 3, 2026
The Rust-side schedule_open_untitled_spawn already handles the VS Code
open-path race with a 350ms defer and sequence-based cancellation.
The 0.8s Lua delay was redundant and slowed down normal startup.

Refs #135
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.

2 participants