Skip to content

Disable Tabby in terminal applications#127

Merged
FuJacob merged 2 commits into
mainfrom
disable-tabby-in-terminals
May 21, 2026
Merged

Disable Tabby in terminal applications#127
FuJacob merged 2 commits into
mainfrom
disable-tabby-in-terminals

Conversation

@FuJacob
Copy link
Copy Markdown
Owner

@FuJacob FuJacob commented May 21, 2026

Summary

  • Adds built-in detection of terminal emulator apps (Terminal, iTerm2, Kitty, Alacritty, Ghostty, Warp, WezTerm, Hyper, Rio) via TerminalAppDetector
  • Blocks suggestions automatically when a terminal is focused — terminals have their own completion/history that conflicts with ghost-text autocomplete
  • Hides the per-app "Enable in …" menu bar toggle when the focused app is a terminal (since the built-in block can't be overridden)

Closes #126

Test plan

  • Build succeeds (xcodebuild build)
  • Test build succeeds (xcodebuild build-for-testing)
  • Focus Apple Terminal — menu bar shows "Tabby is not available in terminal apps." and no per-app toggle
  • Focus iTerm2 or other listed terminal — same behavior
  • Focus a non-terminal app (Safari, VS Code) — Tabby works normally, per-app toggle visible
  • User-disabled app check still takes precedence (disable Safari via menu bar, verify it stays disabled)

🤖 Generated with Claude Code

Greptile Summary

This PR adds automatic terminal-app detection to block Tabby suggestions when a terminal emulator is focused, and hides the per-app "Enable in …" toggle for those apps. The implementation is clean and well-tested, following the existing SuggestionAvailabilityEvaluator gating pattern.

  • TerminalAppDetector holds a hard-coded Set of 9 terminal bundle identifiers and is called in both the evaluator and the menu bar view, keeping the two gating layers in sync.
  • The Alacritty entry uses io.alacritty but Alacritty's official Info.plist registers org.alacritty; the detector will never fire for Alacritty, and the corresponding test asserts the same wrong ID so it gives a false green.
  • All other bundle IDs and the integration tests look correct; the ordering in the evaluator (per-app disable → terminal block → permissions) is consistent with the PR's stated precedence rules.

Confidence Score: 4/5

Safe to merge after fixing the Alacritty bundle ID; all other terminals and the evaluator/menu-bar logic are correct.

The Alacritty bundle identifier io.alacritty does not match Alacritty's actual registered ID (org.alacritty), so the terminal block silently does nothing for Alacritty users. The companion test uses the same wrong value and passes, masking the gap. Everything else — other bundle IDs, evaluator ordering, menu bar gating, and the broader test suite — looks correct.

tabby/Support/TerminalAppDetector.swift (wrong Alacritty bundle ID) and tabbyTests/TerminalAppDetectorTests.swift (test mirrors the same incorrect value).

Important Files Changed

Filename Overview
tabby/Support/TerminalAppDetector.swift New detector using a hard-coded Set of bundle identifiers; the Alacritty entry uses the wrong bundle ID (io.alacritty instead of org.alacritty), so Alacritty is never blocked.
tabby/Support/SuggestionAvailabilityEvaluator.swift Terminal check inserted correctly between per-app disable check and permissions checks; ordering and message strings look correct.
tabby/UI/MenuBarView.swift Per-app toggle correctly hidden for terminal apps using the same TerminalAppDetector call; logic is consistent with the evaluator.
tabbyTests/TerminalAppDetectorTests.swift Good coverage of all 9 terminals and integration paths, but test_isTerminal_alacritty asserts the wrong bundle ID and needs to be updated alongside the detector fix.
tabby.xcodeproj/project.pbxproj Correctly registers TerminalAppDetectorTests.swift as a build source; minor indentation inconsistency in the file-reference group entry.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[App Focused] --> B{Globally Enabled?}
    B -- No --> C[Return: Tabby is turned off.]
    B -- Yes --> D{App in disabledAppBundleIdentifiers?}
    D -- Yes --> E[Return: Tabby is disabled in app.]
    D -- No --> F{TerminalAppDetector.isTerminal?}
    F -- Yes --> G[Return: Tabby is not available in terminal apps.]
    F -- No --> H{Input Monitoring granted?}
    H -- No --> I[Return: Permission required.]
    H -- Yes --> J{Screen Recording granted?}
    J -- No --> K[Return: Permission required.]
    J -- Yes --> L{focusSnapshot.capability?}
    L -- .supported --> M[Return nil — suggestions enabled]
    L -- .blocked / .unsupported --> N[Return reason string]

    subgraph MenuBarView
        O[latestExternalApplication set?] --> P{isTerminal?}
        P -- Yes --> Q[Hide per-app toggle]
        P -- No --> R[Show Enable in App toggle]
    end
Loading

Fix All in Codex Fix All in Claude Code

Reviews (3): Last reviewed commit: "Remove bogus IINA bundle ID, add missing..." | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

Comment thread tabby/Support/TerminalAppDetector.swift
Comment thread tabbyTests/TerminalAppDetectorTests.swift
FuJacob and others added 2 commits May 20, 2026 22:58
Terminal emulators have their own completion, history, and shell integrations
that conflict with ghost-text autocomplete. Tabby now automatically stays
out of the way when a terminal is focused.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
IINA is a video player, not a terminal — the bundle ID was a hallucinated
entry. Also adds the missing test_isTerminal_rio assertion so every entry
in the blocklist has test coverage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@FuJacob FuJacob force-pushed the disable-tabby-in-terminals branch from fe7e3cb to e0b57d6 Compare May 21, 2026 06:08
@FuJacob FuJacob merged commit b1dec56 into main May 21, 2026
3 checks passed
"com.apple.Terminal",
"com.googlecode.iterm2",
"net.kovidgoyal.kitty",
"io.alacritty",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Alacritty's actual CFBundleIdentifier is org.alacritty, not io.alacritty. The official Info.plist in the Alacritty repository (confirmed from crash reports and source) shows <string>org.alacritty</string>. With io.alacritty registered here, the detector will never match a real Alacritty install, so Tabby's suggestions will continue to appear inside Alacritty.

Suggested change
"io.alacritty",
"org.alacritty",

Fix in Codex Fix in Claude Code

Comment on lines +20 to +22
func test_isTerminal_alacritty() {
XCTAssertTrue(TerminalAppDetector.isTerminal(bundleIdentifier: "io.alacritty"))
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 The test uses the same incorrect io.alacritty identifier as the detector, so it always passes — but it proves nothing about real Alacritty installs. Update to org.alacritty to match the fix to TerminalAppDetector.

Suggested change
func test_isTerminal_alacritty() {
XCTAssertTrue(TerminalAppDetector.isTerminal(bundleIdentifier: "io.alacritty"))
}
func test_isTerminal_alacritty() {
XCTAssertTrue(TerminalAppDetector.isTerminal(bundleIdentifier: "org.alacritty"))
}

Fix in Codex Fix in Claude Code

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.

Disable Tabby in terminal applications

1 participant