diff --git a/.gitignore b/.gitignore index ea3e2dc..a041459 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ __pycache__/ # Generated from the colour scheme; machine state, not configuration. /config/dot/gtk-3.0/settings.ini /config/dot/gtk-4.0/settings.ini +/config/dot/tmux/current-theme.conf diff --git a/config/dot/btop/themes/tokyonight-day.theme b/config/dot/btop/themes/tokyonight-day.theme new file mode 100644 index 0000000..6932b74 --- /dev/null +++ b/config/dot/btop/themes/tokyonight-day.theme @@ -0,0 +1,57 @@ +# Tokyo Night Day for btop, the light counterpart to tokyonight-moon. +# +# btop ships no Tokyo Night light variant at all, and the nearest stock light +# theme (flat-remix-light) is a different palette that happens to have a similar +# background. Same colours as kitty/themes/tokyonight-day.conf so the terminal +# and what runs inside it cannot disagree. +# +# Gradients keep the same low -> middle -> high meaning as the dark theme, using +# Day's darker, more saturated accents: the light versions of these hues are too +# faint to read as a filled meter. + +theme[main_bg]="#e1e2e7" +theme[main_fg]="#3760bf" +theme[title]="#3760bf" +theme[hi_fg]="#2e7de9" +theme[selected_bg]="#c4c8da" +theme[selected_fg]="#2e7de9" +theme[inactive_fg]="#7079a8" +theme[proc_misc]="#587539" + +theme[cpu_box]="#a8aecb" +theme[mem_box]="#a8aecb" +theme[net_box]="#a8aecb" +theme[proc_box]="#a8aecb" +theme[div_line]="#c4c8da" + +theme[temp_start]="#2e7de9" +theme[temp_mid]="#8c6c3e" +theme[temp_end]="#f52a65" + +theme[cpu_start]="#2e7de9" +theme[cpu_mid]="#9854f1" +theme[cpu_end]="#f52a65" + +theme[free_start]="#c4c8da" +theme[free_mid]="#007197" +theme[free_end]="#2e7de9" + +theme[cached_start]="#007197" +theme[cached_mid]="#2e7de9" +theme[cached_end]="#9854f1" + +theme[available_start]="#8c6c3e" +theme[available_mid]="#b15c00" +theme[available_end]="#f52a65" + +theme[used_start]="#587539" +theme[used_mid]="#8c6c3e" +theme[used_end]="#f52a65" + +theme[download_start]="#c4c8da" +theme[download_mid]="#2e7de9" +theme[download_end]="#007197" + +theme[upload_start]="#c4c8da" +theme[upload_mid]="#9854f1" +theme[upload_end]="#7847bd" diff --git a/config/dot/btop/themes/tokyonight-moon.theme b/config/dot/btop/themes/tokyonight-moon.theme new file mode 100644 index 0000000..6e26075 --- /dev/null +++ b/config/dot/btop/themes/tokyonight-moon.theme @@ -0,0 +1,56 @@ +# Tokyo Night Moon for btop, matched to Panama's palette. +# +# btop ships a "tokyo-night" theme, but it is the Night variant (#1a1b26). The +# rest of this desktop is Moon (#222436), and two Tokyo Nights side by side read +# as a mistake rather than as a choice. +# +# The *_start/_mid/_end triples are gradients btop draws meters with: low, +# middle, and high. They run blue -> yellow -> red so a saturated resource is +# obvious at a glance without reading the number. + +theme[main_bg]="#222436" +theme[main_fg]="#c8d3f5" +theme[title]="#c8d3f5" +theme[hi_fg]="#82aaff" +theme[selected_bg]="#3b4261" +theme[selected_fg]="#82aaff" +theme[inactive_fg]="#636da6" +theme[proc_misc]="#a5e8b5" + +theme[cpu_box]="#4d5685" +theme[mem_box]="#4d5685" +theme[net_box]="#4d5685" +theme[proc_box]="#4d5685" +theme[div_line]="#3b4261" + +theme[temp_start]="#82aaff" +theme[temp_mid]="#ffc777" +theme[temp_end]="#ff757f" + +theme[cpu_start]="#82aaff" +theme[cpu_mid]="#c099ff" +theme[cpu_end]="#ff757f" + +theme[free_start]="#3b4261" +theme[free_mid]="#589ed7" +theme[free_end]="#86e1fc" + +theme[cached_start]="#86e1fc" +theme[cached_mid]="#82aaff" +theme[cached_end]="#c099ff" + +theme[available_start]="#ffc777" +theme[available_mid]="#ff966c" +theme[available_end]="#ff757f" + +theme[used_start]="#a5e8b5" +theme[used_mid]="#ffc777" +theme[used_end]="#ff757f" + +theme[download_start]="#3b4261" +theme[download_mid]="#82aaff" +theme[download_end]="#86e1fc" + +theme[upload_start]="#3b4261" +theme[upload_mid]="#c099ff" +theme[upload_end]="#fca7ea" diff --git a/config/dot/quickshell/scripts/panama-theme-apps b/config/dot/quickshell/scripts/panama-theme-apps index a33ff31..23be064 100755 --- a/config/dot/quickshell/scripts/panama-theme-apps +++ b/config/dot/quickshell/scripts/panama-theme-apps @@ -31,6 +31,54 @@ case "$scheme" in *) printf 'usage: panama-theme-apps [dark|light]\n' >&2; exit 2 ;; esac +# ── tmux ───────────────────────────────────────────────────────────────────── +# Generated like kitty's: tmux.conf sources current-theme.conf, and that file is +# machine state rather than configuration. Running servers are re-sourced so an +# open session changes now instead of at next launch -- tmux applies a +# source-file to every attached client immediately. +tmux_dir="${XDG_CONFIG_HOME:-$HOME/.config}/tmux" +tmux_theme="$tmux_dir/themes/tokyonight-moon.conf" +[[ "$scheme" == "light" ]] && tmux_theme="$tmux_dir/themes/tokyonight-day.conf" + +status_tmux="skipped" +if [[ -r "$tmux_theme" ]]; then + if cp "$tmux_theme" "$tmux_dir/current-theme.conf.tmp" 2>/dev/null \ + && mv "$tmux_dir/current-theme.conf.tmp" "$tmux_dir/current-theme.conf" 2>/dev/null; then + status_tmux="written" + # Only if a server is actually running; `tmux source-file` would + # otherwise start one just to theme it. + if command -v tmux >/dev/null 2>&1 && tmux has-session 2>/dev/null; then + tmux source-file "$tmux_dir/current-theme.conf" 2>/dev/null \ + && status_tmux="applied to running sessions" + fi + else + rm -f "$tmux_dir/current-theme.conf.tmp" + status_tmux="failed" + fi +fi + +# ── btop ───────────────────────────────────────────────────────────────────── +# Only the color_theme line is rewritten, in place. btop OWNS btop.conf -- it +# rewrites the whole file on exit -- so the config is not symlinked into Panama +# and not replaced wholesale here; just this one value is edited, and btop keeps +# it on the next write. +# +# btop reads its theme once at startup, so a running instance keeps the old +# colours until it is restarted. That is acceptable for a monitor you open when +# you want it, and forcing a restart would kill a process the user is watching. +btop_conf="${XDG_CONFIG_HOME:-$HOME/.config}/btop/btop.conf" +btop_theme="tokyonight-moon" +[[ "$scheme" == "light" ]] && btop_theme="tokyonight-day" + +status_btop="skipped" +if [[ -w "$btop_conf" ]]; then + if sed -i "s|^color_theme *=.*|color_theme = \"$btop_theme\"|" "$btop_conf" 2>/dev/null; then + status_btop="written" + else + status_btop="failed" + fi +fi + # ── GTK ────────────────────────────────────────────────────────────────────── # adw-gtk3, not Adwaita: no Adwaita GTK theme is installed on Fedora 44, and # naming a theme that does not exist makes GTK fall back to its light default -- @@ -89,4 +137,13 @@ if [[ -r "$theme_file" ]]; then fi fi -printf '{"scheme":"%s","kitty":"%s"}\n' "$scheme" "$status_kitty" +# Every target reports what actually happened. A helper that says only +# "kitty: applied" while silently skipping three other applications is how a +# half-applied theme goes unnoticed. +jq -cn \ + --arg scheme "$scheme" \ + --arg kitty "$status_kitty" \ + --arg gtk "$status_gtk" \ + --arg btop "$status_btop" \ + --arg tmux "$status_tmux" \ + '{scheme: $scheme, kitty: $kitty, gtk: $gtk, btop: $btop, tmux: $tmux}' diff --git a/config/dot/tmux/themes/tokyonight-day.conf b/config/dot/tmux/themes/tokyonight-day.conf new file mode 100644 index 0000000..ca7338f --- /dev/null +++ b/config/dot/tmux/themes/tokyonight-day.conf @@ -0,0 +1,30 @@ +# Tokyo Night Day for tmux -- the light counterpart to tokyonight-moon.conf. +# +# Same structure, same roles, Day's palette. Mapped role for role rather than by +# hue: #1b1d2b was text drawn ON an accent block, so it becomes the LIGHT ground +# rather than a dark colour, or the status bar would be dark text on a dark +# accent in light mode. +# +# The accents are Day's DARKER variants, not its standard ones. Measured against +# the panel, the standard #2e7de9 and #9854f1 give 2.74:1 and 2.94:1 -- under +# the 3:1 floor for text. These give 4.42:1 and 4.17:1, and 5.01:1 / 4.73:1 for +# the light text drawn on top of them in the inverted blocks. + +set -g mode-style "fg=#1c5bb8,bg=#d0d5e3" + +set -g message-style "fg=#1c5bb8,bg=#d0d5e3" +set -g message-command-style "fg=#1c5bb8,bg=#d0d5e3" + +set -g pane-border-style "fg=#1c5bb8" +set -g pane-active-border-style "fg=#7847bd" + +set -g status-style "fg=#7847bd,bg=#d0d5e3" +set -g status-bg "#e1e2e7" + +set -g status-left "#[fg=#e1e2e7,bg=#7847bd,bold] #S #[fg=#e1e2e7,bg=#7847bd,nobold,nounderscore,noitalics]" +set -g status-right "#[fg=#e1e2e7,bg=#1c5bb8,nobold,nounderscore,noitalics]#[fg=#7847bd,bg=#d0d5e3] #{prefix_highlight} #[fg=#d0d5e3,bg=#d0d5e3]#[fg=#7847bd,bg=#d0d5e3] %Y/%m/%d %I:%M %p #[fg=#1c5bb8,bg=#d0d5e3,nobold,nounderscore,noitalics]#[fg=#e1e2e7,bg=#7847bd,bold,italics] #h " + +setw -g window-status-format "#[fg=#e1e2e7,bg=#d0d5e3,nobold,nounderscore,noitalics]#[fg=#1c5bb8,bg=#d0d5e3] #I #W #F #[fg=#e1e2e7,bg=#d0d5e3,nobold,nounderscore,noitalics]" +setw -g window-status-current-format "#[fg=#e1e2e7,bg=#d0d5e3,nobold,nounderscore,noitalics]#[fg=#7847bd,bg=#d0d5e3,bold] #I #W #F #[fg=#d0d5e3,bg=#d0d5e3,nobold,nounderscore,noitalics]" + +setw -g window-status-separator "" diff --git a/config/dot/tmux/themes/tokyonight-moon.conf b/config/dot/tmux/themes/tokyonight-moon.conf new file mode 100644 index 0000000..51cf3d2 --- /dev/null +++ b/config/dot/tmux/themes/tokyonight-moon.conf @@ -0,0 +1,25 @@ +# Tokyo Night Moon for tmux -- the palette Panama ships. +# +# Extracted from tmux.conf so the two schemes can be swapped. tmux.conf sources +# current-theme.conf, which panama-theme-apps generates from one of these. +# +# Every colour here was already in tmux.conf; this file is that block verbatim. + +set -g mode-style "fg=#82aaff,bg=#3b4261" + +set -g message-style "fg=#82aaff,bg=#3b4261" +set -g message-command-style "fg=#82aaff,bg=#3b4261" + +set -g pane-border-style "fg=#82aaff" +set -g pane-active-border-style "fg=#b172b0" + +set -g status-style "fg=#b172b0,bg=#3b4261" +set -g status-bg "#222436" + +set -g status-left "#[fg=#1b1d2b,bg=#b172b0,bold] #S #[fg=#1b1d2b,bg=#b172b0,nobold,nounderscore,noitalics]" +set -g status-right "#[fg=#1b1d2b,bg=#82aaff,nobold,nounderscore,noitalics]#[fg=#b172b0,bg=#3b4261] #{prefix_highlight} #[fg=#3b4261,bg=#3b4261]#[fg=#b172b0,bg=#3b4261] %Y/%m/%d %I:%M %p #[fg=#82aaff,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#1b1d2b,bg=#b172b0,bold,italics] #h " + +setw -g window-status-format "#[fg=#1b1d2b,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#82aaff,bg=#3b4261] #I #W #F #[fg=#1b1d2b,bg=#3b4261,nobold,nounderscore,noitalics]" +setw -g window-status-current-format "#[fg=#1b1d2b,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#b172b0,bg=#3b4261,bold] #I #W #F #[fg=#3b4261,bg=#3b4261,nobold,nounderscore,noitalics]" + +setw -g window-status-separator "" diff --git a/config/dot/tmux/tmux.conf b/config/dot/tmux/tmux.conf index 47c686e..636c7ba 100644 --- a/config/dot/tmux/tmux.conf +++ b/config/dot/tmux/tmux.conf @@ -19,24 +19,10 @@ bind C-Space send-prefix # Set status bar #set -g status-bg pink # Tokyo Night Moon color palette -set -g mode-style "fg=#82aaff,bg=#3b4261" - -set -g message-style "fg=#82aaff,bg=#3b4261" -set -g message-command-style "fg=#82aaff,bg=#3b4261" - -set -g pane-border-style "fg=#82aaff" -set -g pane-active-border-style "fg=#b172b0" - -set -g status-style "fg=#b172b0,bg=#3b4261" -set -g status-bg "#222436" - -set -g status-left "#[fg=#1b1d2b,bg=#b172b0,bold] #S #[fg=#1b1d2b,bg=#b172b0,nobold,nounderscore,noitalics]" -set -g status-right "#[fg=#1b1d2b,bg=#82aaff,nobold,nounderscore,noitalics]#[fg=#b172b0,bg=#3b4261] #{prefix_highlight} #[fg=#3b4261,bg=#3b4261]#[fg=#b172b0,bg=#3b4261] %Y/%m/%d %I:%M %p #[fg=#82aaff,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#1b1d2b,bg=#b172b0,bold,italics] #h " - -setw -g window-status-format "#[fg=#1b1d2b,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#82aaff,bg=#3b4261] #I #W #F #[fg=#1b1d2b,bg=#3b4261,nobold,nounderscore,noitalics]" -setw -g window-status-current-format "#[fg=#1b1d2b,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#b172b0,bg=#3b4261,bold] #I #W #F #[fg=#3b4261,bg=#3b4261,nobold,nounderscore,noitalics]" - -setw -g window-status-separator "" +# Colours live in themes/ and are generated into current-theme.conf by +# panama-theme-apps, which regenerates it whenever the desktop colour scheme +# changes. -q so a fresh checkout without the generated file still starts. +source-file -q "~/.config/tmux/current-theme.conf" # Increase scrollback buffer set -g history-limit 50000 diff --git a/setup/scripts/link-dotfiles b/setup/scripts/link-dotfiles index 352480b..ad29e48 100755 --- a/setup/scripts/link-dotfiles +++ b/setup/scripts/link-dotfiles @@ -70,6 +70,45 @@ for dir in "${dirs[@]}"; do log "Linked $PANAMA_DOT/$dir → $CONFIG/$dir" done +# tmux.conf ends with a source-file of current-theme.conf, generated from the +# colour scheme rather than committed. Seed it so a fresh checkout starts themed +# -- the source-file is -q, so a missing file is silent, which would leave tmux +# unstyled with nothing to explain it. +TMUX_THEME="$PANAMA_DOT/tmux/current-theme.conf" +if [ -e "$TMUX_THEME" ]; then + log "Keeping existing tmux theme at $TMUX_THEME" +elif [ -d "$PANAMA_DOT/tmux/themes" ]; then + tmux_scheme="dark" + tmux_prefs="${XDG_CONFIG_HOME:-$HOME/.config}/panama/settings.json" + if [ -r "$tmux_prefs" ]; then + tmux_stored="$(jq -r '.colorScheme // "dark"' "$tmux_prefs" 2>/dev/null || echo dark)" + [ "$tmux_stored" = "light" ] && tmux_scheme="light" + fi + [ "$tmux_scheme" = "light" ] && tmux_name="tokyonight-day" || tmux_name="tokyonight-moon" + cp "$PANAMA_DOT/tmux/themes/$tmux_name.conf" "$TMUX_THEME" + log "Seeded tmux $tmux_scheme theme ($tmux_name) → $TMUX_THEME" +fi + +# btop reads themes from its own config directory, but OWNS btop.conf -- it +# rewrites that file on exit -- so only the theme files are exposed, per file, +# and the config itself is left to btop. panama-theme-apps edits the single +# color_theme line in place. +BTOP_THEME_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/btop/themes" +mkdir -p "$BTOP_THEME_DIR" +for btop_theme_src in "$PANAMA_DOT"/btop/themes/*.theme; do + [ -e "$btop_theme_src" ] || continue + btop_theme_dst="$BTOP_THEME_DIR/$(basename "$btop_theme_src")" + if [ -L "$btop_theme_dst" ]; then + rm "$btop_theme_dst" + fi + if [ -e "$btop_theme_dst" ]; then + log "Keeping existing btop theme at $btop_theme_dst" + else + ln -s "$btop_theme_src" "$btop_theme_dst" + log "Linked btop theme → $btop_theme_dst" + fi +done + # GTK3 has no include mechanism, so its settings.ini is generated whole from a # template rather than layered. Without this, a fresh checkout has a template # and no settings.ini, and GTK3 applications fall back to their built-in theme.