Skip to content

Sync the theme into tmux with one source-file instead of a client per variable - #15040

Merged
dhh merged 3 commits into
quattrofrom
theme-set-tmux-batch
Oct 12, 2026
Merged

dhh merged 3 commits into
quattrofrom
theme-set-tmux-batch

Conversation

@dhh

@dhh dhh commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

What

omarchy-theme-set-tmux started one tmux client per variable per session: gum_env.lua sets ~116 variables, so with three sessions a theme switch forked ~580 tmux clients, plus four omarchy-theme-color runs for the mode, foreground, background and cursor.

It now queues every set-environment / set-option as a tmux command line, quoted in-process, and hands them to the server in a single tmux source-file -. The palette is read once with omarchy-theme-color --all.

source-file reports a failing line (say, a session closed meanwhile) and carries on with the rest, so a vanished session still only skips its own lines, as before. Values are single-quoted, so tmux takes $, ~, #{} and ; literally; a single quote in a value is closed and rejoined.

Measurements

Scratch tmux server (TMUX_TMPDIR in a temp dir), three sessions, a real 116-variable gum_env.lua:

  • before: 0.69–0.72s
  • after: 0.075–0.08s

tmux show-environment -g, show-environment -t <session> and show-options -g dumps are identical before and after.

Verification

  • New test/shell.d/theme-set-tmux-test.sh runs the command against a throwaway tmux server: variables land globally and in every session, a value with ', $HOME, ~, #{...} and ; arrives literally, window styles and cursor colour are set, and the whole sync uses at most a handful of tmux clients.
  • test/cli's tmux stub now reads the sourced script; ./test/cli passes.
  • ./test/shell: the 7 failing files (agent accounts, config, shortcuts, input device, unowned paths) fail for environment reasons unrelated to tmux.

🤖 Generated with Claude Code

… variable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the latest test change introduces no blocking issue.

Summary

Theme sync now sends settings through one tmux source-file call and reads the palette once.

  • Theme switches send environment and color settings to tmux in one batch.

Reviews (3) · Last reviewed commit: "Start the tmux theme test's panes under ..." · Reviewed by Greptile

Comment thread test/shell.d/theme-set-tmux-test.sh Resolved
dhh and others added 2 commits October 11, 2026 16:21
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhh
dhh merged commit 21b8766 into quattro Oct 12, 2026
1 check passed
@dhh
dhh deleted the theme-set-tmux-batch branch October 12, 2026 13:38
omarchybot added a commit to anandude/omarchy that referenced this pull request Oct 13, 2026
quattro now batches every tmux setting into one source-file (omacom#15040). The skip and clear paths move onto that queue: the stamp and its record are queued together, the pane reset is still written before the style unsets reach tmux, and the attached clients are read once rather than per check. The test/cli asserts now match the quoted lines the queue sends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
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