Repository navigation
fix(tmux): turn on focus-events when creating a session - #58
Open
jongracecox wants to merge 1 commit into
Open
jongracecox wants to merge 1 commit into
jongracecox wants to merge 1 commit into
Conversation
tmux's server-wide focus-events option is off by default, so Claude Code gets no focus in/out events and shows a "tmux focus-events off" hint in every session fujimoto launches. Set it right after new-session: Claude Code reads the option once at startup and caches it, so it has to be on before claude finishes loading. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Every Claude session fujimoto launches showed
tmux focus-events off · add 'set -g focus-events on' to ~/.tmux.conf and reattach. tmux's server-widefocus-eventsoption is off by default, so fujimoto now turns it on itself, the same way it already handlesextended-keys._ensure_focus_events()intmux.py: readsshow-options -sv focus-eventsand runsset-option -s focus-events ononly if it isn't already on. Logged astmux.focus_events previous=… changed=….create_sessionandcreate_session_with_commandimmediately afternew-session. Claude Code probestmux show -gv focus-eventsonce at startup and caches the result, so setting it later in the create sequence would race that probe.Reach to attached clients
tmux has no hook for changes to this option. It sends the outer terminal the focus-reporting enable sequence only in
tty_update_features, which runs when a client attaches (checked in the tmux 3.6a source,tty.c/options.c). So the setting reaches new attaches only. That's fine for fujimoto, which always attaches after creating the session. A client that was already attached to some other session picks it up the next time it reattaches.Tests
TestEnsureFocusEvents: sets the option when it's off, skips setting it when it's already on, sets it when the option can't be read, writes the debug log line, and checks the call order for both create paths.uv run pytest: 1151 passed.CLAUDE.md is updated: the tmux.py module notes, plus a Gotchas entry next to the extended-keys one.
🤖 Generated with Claude Code