Re-query the terminal theme on focus so the tmux bar survives sleep
Ghostty pushes the light/dark change over mode 2031, and the hooks that
act on it work for a manual toggle. But every scheduled switch this week
happened while the lid was closed, and after waking the bar was still in
the previous palette while #{client_theme} and ghostty itself had moved
on. Rather than trust the push, ask again (DSR 996) whenever the window
regains focus; ghostty answers with its current theme and tmux treats the
reply like a pushed change, so the existing hooks do the rest.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
e08861b1c6
commit
533bc203a8
1 changed files with 13 additions and 2 deletions
7
tmux
7
tmux
|
|
@ -55,6 +55,13 @@ set-hook -g client-dark-theme 'source-file ~/.tmux-dark.conf'
|
|||
# client attaches. Sourcing is idempotent, so the overlap is harmless.
|
||||
set-hook -g client-attached 'if -F "#{==:#{client_theme},light}" "source-file ~/.tmux-light.conf" "source-file ~/.tmux-dark.conf"'
|
||||
|
||||
# The push from ghostty is lost when the appearance switches while the lid is
|
||||
# closed, so the bar wakes up in yesterday's colours. Re-ask the terminal
|
||||
# (DSR 996) whenever the window regains focus; ghostty answers with the
|
||||
# current theme and tmux treats the reply exactly like a pushed change, so
|
||||
# the two hooks above do the rest.
|
||||
set-hook -g client-focus-in 'run-shell -b "printf \"\\033[?996n\" > #{client_tty}"'
|
||||
|
||||
# Default before any client has attached and reported a theme. This also
|
||||
# runs on manual reload (`r` below), so check the invoking client's theme
|
||||
# rather than always falling back to dark and clobbering a light session.
|
||||
|
|
|
|||
Loading…
Reference in a new issue