Skip to content

fix(appearance): re-run compositor on auto theme switch#212

Merged
fabioluciano merged 1 commit intofabioluciano:mainfrom
totallyGreg:fix/appearance-compositor-on-theme-switch
Mar 30, 2026
Merged

fix(appearance): re-run compositor on auto theme switch#212
fabioluciano merged 1 commit intofabioluciano:mainfrom
totallyGreg:fix/appearance-compositor-on-theme-switch

Conversation

@totallyGreg
Copy link
Copy Markdown
Contributor

Problem

When macOS appearance changed automatically (auto/schedule mode), the statusbar session block, window list, and surrounding chrome stayed in the previous theme's colors. Only the plugin segments (rendered dynamically via #(powerkit-render right)) updated correctly.

Root Cause

compose_layout() and configure_status_bar() bake theme hex color values into status-format[0] and status-style as static strings at init time. When _appearance_switch_theme() fired on a macOS appearance change, it only:

  • Updated @powerkit_theme_variant
  • Cleared the rendered_right__* segment cache
  • Called refresh-client -S

The compositor was never re-run, so the hardcoded colors in status-format[0] (e.g. bg=#073642) remained from the previous theme.

Fix

Re-run tmux-powerkit.tmux in the background after a theme switch, which triggers compose_layout() and configure_status_bar() to regenerate all static tmux options with the correct theme colors.

Also removes the now-redundant cache_clear_prefix "rendered_right__" calls from both appearance.sh and appearance_toggle.sh. The render cache key includes the theme variant, so switching variants automatically routes to the correct cache entry — the old variant's cache file becomes an unreferenced orphan and is never served.

Changes

  • src/plugins/appearance.sh: replace cache_clear_prefix + refresh-client -S with background re-run of tmux-powerkit.tmux
  • src/helpers/appearance_toggle.sh: remove redundant cache_clear_prefix "rendered_right__" (toggle already called tmux-powerkit.tmux)

When macOS appearance changed, only @powerkit_theme_variant was updated
and the rendered segment cache was cleared. But status-format[0] and
status-style are static strings generated at init time with hardcoded
hex color values — they were never regenerated, so the session bar,
windows, and surrounding chrome stayed in the previous theme.

Re-run tmux-powerkit.tmux on theme switch so compose_layout() and
configure_status_bar() regenerate all static tmux options with the
correct theme colors. Also drop the now-redundant cache_clear_prefix
call from both appearance.sh and appearance_toggle.sh — the render
cache key includes the theme variant, so switching variants naturally
routes to the correct (or absent) cache entry without manual clearing.
@fabioluciano fabioluciano merged commit dd5cc14 into fabioluciano:main Mar 30, 2026
2 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 30, 2026
## [5.28.1](v5.28.0...v5.28.1) (2026-03-30)

### Bug Fixes

* **appearance:** re-run compositor on auto theme switch ([#212](#212)) ([dd5cc14](dd5cc14))
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