-
-
Notifications
You must be signed in to change notification settings - Fork 844
Show Claude icon in terminal header while Claude Code is active #3046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+159
−62
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bef3b3c
Initial plan
Copilot b24ac2e
Plan terminal Claude icon update
Copilot a07d08d
Add Claude icon for active terminal sessions
Copilot b92080c
Tidy Claude command normalization
Copilot d15dad6
remove lobehub -- crazy amount of dependencies. just use the icon di…
sawka 00c361f
fix some warnings
sawka 3f30447
use normalize command more
sawka 7608afc
Merge remote-tracking branch 'origin/main' into copilot/add-header-ic…
sawka e2b5ec1
more defensive coding for these handlers
sawka a909188
swap order for env stripping
sawka 0a88565
just do prefix match for claude, and update tests
sawka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import { isClaudeCodeCommand } from "./osc-handlers"; | ||
|
|
||
| describe("isClaudeCodeCommand", () => { | ||
| it("matches direct Claude Code invocations", () => { | ||
| expect(isClaudeCodeCommand("claude")).toBe(true); | ||
| expect(isClaudeCodeCommand("claude --dangerously-skip-permissions")).toBe(true); | ||
| }); | ||
|
|
||
| it("matches Claude Code invocations wrapped with env assignments", () => { | ||
| expect(isClaudeCodeCommand('ANTHROPIC_API_KEY="test" claude')).toBe(true); | ||
| expect(isClaudeCodeCommand("env FOO=bar claude --print")).toBe(true); | ||
| }); | ||
|
|
||
| it("ignores other commands", () => { | ||
| expect(isClaudeCodeCommand("claudes")).toBe(false); | ||
| expect(isClaudeCodeCommand("echo claude")).toBe(false); | ||
| expect(isClaudeCodeCommand("ls ~/claude")).toBe(false); | ||
| expect(isClaudeCodeCommand("cat /logs/claude")).toBe(false); | ||
| expect(isClaudeCodeCommand("")).toBe(false); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
In xterm.js, forparser.registerOscHandler(code, handler), what is the exact behavior difference between returningtrueandfalsefrom the handler callback?💡 Result:
In xterm.js, for parser.registerOscHandler(code, handler), the handler is a callback that receives the OSC payload string and returns a boolean (or Promise). Returning true indicates the OSC sequence was successfully handled by this handler. The parser stops processing and does not invoke any further (earlier registered) handlers for this OSC code. Returning false (or any falsy value except undefined) indicates the sequence was not handled by this handler. The parser continues to the next handler in the list (handlers are tried from most recently added to earliest). Handlers are invoked in LIFO order (last in, first out). This allows later-registered handlers to intercept and handle the sequence exclusively by returning true, or pass it through by returning false to reach built-in or earlier handlers. This behavior is consistent across parser hooks (OSC, CSI, DCS, ESC).
Citations:
🏁 Script executed:
Repository: wavetermdev/waveterm
Length of output: 4310
🏁 Script executed:
Repository: wavetermdev/waveterm
Length of output: 1640
🏁 Script executed:
Repository: wavetermdev/waveterm
Length of output: 46
🏁 Script executed:
Repository: wavetermdev/waveterm
Length of output: 3486
🏁 Script executed:
Repository: wavetermdev/waveterm
Length of output: 50377
Return
truein catch blocks to maintain OSC handler ownership on errors.Lines 181, 189, and 197 return
falseon exceptions, which contradicts the ownership behavior: the handlers themselves returntruewhen not ready, signaling they own these OSC codes. Returningfalseon error allows other handlers to process sequences this handler already attempted, risking malformed data propagation.Suggested fix
this.terminal.parser.registerOscHandler(7, (data: string) => { try { return handleOsc7Command(data, this.blockId, this.loaded); } catch (e) { console.error("[termwrap] osc 7 handler error", this.blockId, e); - return false; + return true; } }); this.terminal.parser.registerOscHandler(52, (data: string) => { try { return handleOsc52Command(data, this.blockId, this.loaded, this); } catch (e) { console.error("[termwrap] osc 52 handler error", this.blockId, e); - return false; + return true; } }); this.terminal.parser.registerOscHandler(16162, (data: string) => { try { return handleOsc16162Command(data, this.blockId, this.loaded, this); } catch (e) { console.error("[termwrap] osc 16162 handler error", this.blockId, e); - return false; + return true; } });📝 Committable suggestion
🤖 Prompt for AI Agents