Skip to content

Claude Code Launcher: Revert -i flag, add Ghostty new-tab option#26129

Merged
raycastbot merged 5 commits intoraycast:mainfrom
artisticmedic:fix/ghostty-new-window
Mar 8, 2026
Merged

Claude Code Launcher: Revert -i flag, add Ghostty new-tab option#26129
raycastbot merged 5 commits intoraycast:mainfrom
artisticmedic:fix/ghostty-new-window

Conversation

@artisticmedic
Copy link
Contributor

@artisticmedic artisticmedic commented Mar 8, 2026

Description

The -i (interactive shell) flag added in #25976 caused unintended behavior including session restore and duplicate tabs when launching Ghostty. This reverts the -i flag to restore the original window behavior.

Additionally, adds a new "Ghostty: Open Behavior" preference that lets users choose between opening Claude Code in a new Ghostty window (default) or a new tab in the existing Ghostty window via AppleScript GUI scripting.

Checklist

The -i (interactive shell) flag added in raycast#25976 caused unintended
behavior including session restore and duplicate tabs when launching
Ghostty. This reverts the -i flag to restore the original window
behavior.

Additionally, adds a new "Ghostty: Open Behavior" preference that
lets users choose between opening Claude Code in a new Ghostty window
(default) or a new tab in the existing Ghostty window via AppleScript
GUI scripting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: claude-code-launcher Issues related to the claude-code-launcher extension platform: macOS OP is contributor The OP of the PR is a contributor of the extension labels Mar 8, 2026
@raycastbot
Copy link
Collaborator

raycastbot commented Mar 8, 2026

Thank you for your contribution! 🎉

🔔 @stephendolan @ridemountainpig you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="fix/ghostty-new-window"
FORK_URL="https://github.com/artisticmedic/raycast-extensions.git"
EXTENSION_NAME="claude-code-launcher"
REPO_NAME="raycast-extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 8, 2026

Greptile Summary

This PR reverts the -i (interactive shell) flag from the Ghostty adapter that was introduced in #25976, and adds a new ghosttyOpenBehavior preference allowing users to open Claude Code in a new Ghostty tab via AppleScript GUI scripting instead of a new window. The tab path correctly uses GUI scripting with System Events to simulate Cmd+T and paste the command from the clipboard.

Key changes:

  • Removes -i flag from open command args to fix unintended session restore and duplicate tab behavior
  • Adds ghosttyOpenBehavior dropdown preference ("window" default / "tab") in package.json
  • New openInTab() private method in GhosttyAdapter uses AppleScript + System Events GUI scripting (requires macOS Accessibility permissions) to open a tab in the frontmost Ghostty window
  • TerminalOpenOptions interface added to types.ts; TerminalAdapter.open() updated to accept optional options

Note: closeMainWindow() is called based solely on the ghosttyOpenBehavior preference without verifying that Ghostty is the currently selected terminal, which can unexpectedly close the Raycast window when a non-Ghostty terminal is active with a stale "tab" preference.

Confidence Score: 2/5

  • Not safe to merge without addressing the unguarded closeMainWindow() call.
  • The core logic for both the new-window and new-tab paths is sound. The AppleScript approach for tab creation is a reasonable workaround given Ghostty's lack of native IPC. However, closeMainWindow() is triggered based solely on the ghosttyOpenBehavior preference value without checking that Ghostty is actually the active terminal. This can silently close the Raycast window when a user with a stale "tab" preference switches to a different terminal.
  • extensions/claude-code-launcher/src/open-claude-code.tsx (add terminal type guard before closeMainWindow() call)

Last reviewed commit: 3a90cd5

artisticmedic and others added 3 commits March 8, 2026 02:16
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Addresses Greptile review: closeMainWindow() was triggered based
solely on the ghosttyOpenBehavior preference without checking that
Ghostty is the active terminal, which could unexpectedly close the
Raycast window when using a different terminal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pernielsentikaer pernielsentikaer self-assigned this Mar 8, 2026
Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

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

Looks good to me, approved 🔥

@raycastbot raycastbot merged commit ae29062 into raycast:main Mar 8, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

Published to the Raycast Store:
https://raycast.com/stephendolan/claude-code-launcher

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension: claude-code-launcher Issues related to the claude-code-launcher extension extension fix / improvement Label for PRs with extension's fix improvements OP is contributor The OP of the PR is a contributor of the extension platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants