From f67ce8545c04a57f06b715f92490c1d60e8e4752 Mon Sep 17 00:00:00 2001 From: "Thomas G. Lopes" Date: Wed, 11 Mar 2026 19:05:12 +0000 Subject: [PATCH] better tmux support --- AGENTS.md | 2 + matugen/files/config.toml | 5 ++ matugen/files/scripts/sync-tmux-mac.sh | 13 ++++ matugen/files/templates/tmux-colors.conf | 94 ++++++++++++++++++++++++ pi/files.linux/agent/settings.json | 7 +- tmux/files/tmux.conf | 64 +++++++++++++--- 6 files changed, 170 insertions(+), 15 deletions(-) create mode 100755 matugen/files/scripts/sync-tmux-mac.sh create mode 100644 matugen/files/templates/tmux-colors.conf diff --git a/AGENTS.md b/AGENTS.md index d0570ec..a253597 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -76,6 +76,8 @@ sigil unlink ~/.config/wezterm/wezterm.lua When editing dotfiles, it is preferred to add/edit the files in this project directly, instead of going to the source. this way we can then use sigil apply --prune, and everything will be synced, even when there are new files. +**Important:** Whenever you add new files to the repo (e.g., create new scripts or configs), you must run `sigil apply` afterwards to create the symlinks. New files in `files/` directories are not automatically linked until `sigil apply` is run. + ## IMPORTANT: Update AGENTS.md files when Sigil changes Whenever Sigil is modified (new features, behavior changes, new commands), you MUST update the AGENTS.md documentation in BOTH locations: diff --git a/matugen/files/config.toml b/matugen/files/config.toml index d492460..92e2f1b 100644 --- a/matugen/files/config.toml +++ b/matugen/files/config.toml @@ -41,6 +41,11 @@ output_path = '~/.config/rofi/colors/matugen.rasi' input_path = '~/.config/matugen/templates/niri-colors.kdl' output_path = '~/.config/niri/colors.kdl' +[templates.tmux] +input_path = '~/.config/matugen/templates/tmux-colors.conf' +output_path = '~/.config/tmux/colors.conf' +post_hook = 'tmux source-file ~/.config/tmux/tmux.conf 2>/dev/null || true && nohup ~/.config/matugen/scripts/sync-tmux-mac.sh >/dev/null 2>&1 &' + [templates.zellij] input_path = '~/.config/matugen/templates/zellij-colors.kdl' output_path = '~/.config/zellij/themes/matugen.kdl' diff --git a/matugen/files/scripts/sync-tmux-mac.sh b/matugen/files/scripts/sync-tmux-mac.sh new file mode 100755 index 0000000..2bb242d --- /dev/null +++ b/matugen/files/scripts/sync-tmux-mac.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env sh +set -eu + +log_file="$HOME/.cache/matugen-sync-tmux.log" + +mkdir -p "$HOME/.cache" + +{ + ssh mac-attio "mkdir -p ~/.config/tmux" + scp "$HOME/.config/tmux/colors.conf" \ + mac-attio:~/.config/tmux/ + ssh mac-attio "tmux source-file ~/.config/tmux/tmux.conf 2>/dev/null || true" +} >>"$log_file" 2>&1 diff --git a/matugen/files/templates/tmux-colors.conf b/matugen/files/templates/tmux-colors.conf new file mode 100644 index 0000000..0d3226a --- /dev/null +++ b/matugen/files/templates/tmux-colors.conf @@ -0,0 +1,94 @@ +# Tmux theme colors (generated by matugen) +# Do not edit manually - run `matugen` to regenerate + +# ============================================= +# Theme Colors +# ============================================= + +# Primary colors +PRIMARY={{colors.primary.default.hex}} +ON_PRIMARY={{colors.on_primary.default.hex}} +PRIMARY_CONTAINER={{colors.primary_container.default.hex}} +ON_PRIMARY_CONTAINER={{colors.on_primary_container.default.hex}} + +# Secondary colors +SECONDARY={{colors.secondary.default.hex}} +ON_SECONDARY={{colors.on_secondary.default.hex}} +SECONDARY_CONTAINER={{colors.secondary_container.default.hex}} +ON_SECONDARY_CONTAINER={{colors.on_secondary_container.default.hex}} + +# Tertiary colors +TERTIARY={{colors.tertiary.default.hex}} +ON_TERTIARY={{colors.on_tertiary.default.hex}} +TERTIARY_CONTAINER={{colors.tertiary_container.default.hex}} +ON_TERTIARY_CONTAINER={{colors.on_tertiary_container.default.hex}} + +# Surface colors +SURFACE={{colors.surface.default.hex}} +SURFACE_DIM={{colors.surface_dim.default.hex}} +SURFACE_BRIGHT={{colors.surface_bright.default.hex}} +SURFACE_CONTAINER={{colors.surface_container.default.hex}} +SURFACE_CONTAINER_LOW={{colors.surface_container_low.default.hex}} +SURFACE_CONTAINER_HIGH={{colors.surface_container_high.default.hex}} +SURFACE_VARIANT={{colors.surface_variant.default.hex}} + +# Text colors +ON_SURFACE={{colors.on_surface.default.hex}} +ON_SURFACE_VARIANT={{colors.on_surface_variant.default.hex}} + +# Utility colors +OUTLINE={{colors.outline.default.hex}} +OUTLINE_VARIANT={{colors.outline_variant.default.hex}} +ERROR={{colors.error.default.hex}} +ON_ERROR={{colors.on_error.default.hex}} +ERROR_CONTAINER={{colors.error_container.default.hex}} +ON_ERROR_CONTAINER={{colors.on_error_container.default.hex}} +INVERSE_SURFACE={{colors.inverse_surface.default.hex}} +INVERSE_ON_SURFACE={{colors.inverse_on_surface.default.hex}} +INVERSE_PRIMARY={{colors.inverse_primary.default.hex}} +SCRIM={{colors.scrim.default.hex}} +SHADOW={{colors.shadow.default.hex}} + +# ============================================= +# Tmux Styling using theme colors +# ============================================= + +# Status bar styling +set -g status-style "bg={{colors.surface.default.hex}},fg={{colors.on_surface.default.hex}}" +set -g status-left "#[fg={{colors.on_primary.default.hex}},bg={{colors.primary.default.hex}},bold] #S #[default] " + +# Smart status-right: changes based on mode +set -g status-right "#[fg={{colors.on_surface_variant.default.hex}}]%Y-%m-%d #[fg={{colors.on_surface.default.hex}}]%H:%M #[default]" + +# Window status format +set -g window-status-format "#[fg={{colors.on_surface_variant.default.hex}}] #I:#W " +set -g window-status-current-format "#[fg={{colors.on_primary_container.default.hex}},bg={{colors.primary_container.default.hex}},bold] #I:#W #[default]" +set -g window-status-separator "" +set -g status-justify left + +# Pane borders +set -g pane-border-style "fg={{colors.outline_variant.default.hex}}" +set -g pane-active-border-style "fg={{colors.primary.default.hex}}" + +# Message styling (for confirm dialogs like kill-pane) +set -g message-style "fg={{colors.on_primary.default.hex}},bg={{colors.primary_container.default.hex}},bold" +set -g message-command-style "fg={{colors.on_secondary.default.hex}},bg={{colors.secondary_container.default.hex}}" + +# Mode styling (copy mode, etc.) +set -g mode-style "fg={{colors.on_tertiary.default.hex}},bg={{colors.tertiary_container.default.hex}}" + +# Clock mode +set -g clock-mode-color "{{colors.primary.default.hex}}" + +# Selection highlighting +set -g copy-mode-match-style "fg={{colors.on_tertiary.default.hex}},bg={{colors.tertiary_container.default.hex}}" +set -g copy-mode-current-match-style "fg={{colors.on_primary.default.hex}},bg={{colors.primary_container.default.hex}},bold" + +# Popup styling +set -g popup-style "bg={{colors.surface_container.default.hex}},fg={{colors.on_surface.default.hex}}" +set -g popup-border-style "fg={{colors.outline.default.hex}}" + +# Menu styling +set -g menu-style "bg={{colors.surface_container.default.hex}},fg={{colors.on_surface.default.hex}}" +set -g menu-selected-style "bg={{colors.primary_container.default.hex}},fg={{colors.on_primary_container.default.hex}}" +set -g menu-border-style "fg={{colors.outline.default.hex}}" diff --git a/pi/files.linux/agent/settings.json b/pi/files.linux/agent/settings.json index a8d40de..6091c5a 100644 --- a/pi/files.linux/agent/settings.json +++ b/pi/files.linux/agent/settings.json @@ -2,9 +2,10 @@ "lastChangelogVersion": "0.57.1", "defaultProvider": "opencode-go", "defaultModel": "kimi-k2.5", - "defaultThinkingLevel": "low", + "defaultThinkingLevel": "medium", "theme": "matugen", "lsp": { "hookMode": "edit_write" - } -} + }, + "hideThinkingBlock": true +} \ No newline at end of file diff --git a/tmux/files/tmux.conf b/tmux/files/tmux.conf index a57e48a..d51333b 100644 --- a/tmux/files/tmux.conf +++ b/tmux/files/tmux.conf @@ -92,11 +92,14 @@ bind -n M-Down select-pane -D bind -n M-Up select-pane -U bind -n M-Right select-pane -R -# Resize panes with prefix + hjkl -bind -r H resize-pane -L 5 -bind -r J resize-pane -D 5 -bind -r K resize-pane -U 5 -bind -r L resize-pane -R 5 +# Resize panes - Ctrl+R then arrows (no prefix needed) +bind -n C-r switch-client -T resize-pane \; display-message -d 5000 "RESIZE MODE: arrows to resize, ESC/Enter to exit" +bind -T resize-pane Left resize-pane -L 5 \; switch-client -T resize-pane +bind -T resize-pane Right resize-pane -R 5 \; switch-client -T resize-pane +bind -T resize-pane Up resize-pane -U 5 \; switch-client -T resize-pane +bind -T resize-pane Down resize-pane -D 5 \; switch-client -T resize-pane +bind -T resize-pane Escape switch-client -T root +bind -T resize-pane Enter switch-client -T root # ----------------------------------------- # Moving Panes (Zellij-like) @@ -112,6 +115,15 @@ bind j command-prompt -p "join pane from window #:" "join-pane -s '%%'" bind > swap-pane -D bind < swap-pane -U +# Move panes around - Ctrl+E then arrows (no prefix needed, stays in mode) +bind -n C-e switch-client -T move-pane \; display-message -d 5000 "MOVE MODE: arrows to move pane, ESC/Enter to exit" +bind -T move-pane Left swap-pane -s '{left-of}' \; switch-client -T move-pane +bind -T move-pane Right swap-pane -s '{right-of}' \; switch-client -T move-pane +bind -T move-pane Up swap-pane -s '{up-of}' \; switch-client -T move-pane +bind -T move-pane Down swap-pane -s '{down-of}' \; switch-client -T move-pane +bind -T move-pane Escape switch-client -T root +bind -T move-pane Enter switch-client -T root + # Mark pane + swap with marked pane (advanced) bind m select-pane -m # Mark current pane bind M swap-pane # Swap with marked pane @@ -133,10 +145,18 @@ bind BSpace previous-layout # Quick layout shortcuts bind Enter select-layout tiled -bind M-1 select-layout even-horizontal -bind M-2 select-layout even-vertical -bind M-3 select-layout main-horizontal -bind M-4 select-layout main-vertical + +# Easy horizontal/vertical layouts +bind = select-layout even-horizontal +bind + select-layout even-vertical + +# Toggle between horizontal and vertical +bind t run-shell "tmux list-windows -F '#{window_layout}' | head -1 | grep -q 'even-horizontal' && tmux select-layout even-vertical || tmux select-layout even-horizontal" + +# Other layouts - Ctrl+L then h/v (no prefix) +bind -n C-l switch-client -T layout \; display-message -d 5000 "LAYOUT MODE: h=horizontal v=vertical ESC/Enter=back" +bind -T layout h select-layout main-horizontal \; switch-client -T root +bind -T layout v select-layout main-vertical \; switch-client -T root # Note: Pane resize with H/J/K/L is defined in the resize section above @@ -181,8 +201,8 @@ bind , command-prompt -I "#W" "rename-window '%%'" # Update status bar every second set -g status-interval 1 -# Position at bottom -set -g status-position bottom +# Position at top (for dual status bar with tabs on top, cheatsheet on bottom) +# Note: status-position bottom puts tabs at bottom-1, cheatsheet at very bottom # Status bar sizing set -g status-left-length 40 @@ -192,12 +212,32 @@ set -g status-right-length 100 # The theme file sets: status-style, status-left, status-right, # window-status-format, window-status-current-format, pane borders, etc. +# ----------------------------------------- +# Single Status Bar at Bottom +# ----------------------------------------- +set -g status 1 +set -g status-position bottom +set -g status-interval 1 +set -g status-left-length 40 +set -g status-right-length 150 + +# Help toggle (Ctrl+H) - uses run-shell to toggle help display +bind -n C-h run-shell ' + if [ "$(tmux show -gqv @help_visible)" = "1" ]; then + tmux set -g @help_visible 0 + tmux source ~/.config/tmux/colors.conf + else + tmux set -g @help_visible 1 + tmux set -g status-right "#[bg=#014b71,fg=#cbe6ff,bold] ALT=nav ^E=move ^R=resize ^L=layout |/-=split ^S=prefix #[default]" + fi +' + # ----------------------------------------- # Other Useful Bindings # ----------------------------------------- # Prefix + r to reload config -bind r source-file ~/.tmux.conf \; display "Config reloaded!" +bind r source-file ~/.config/tmux/tmux.conf \; display "Config reloaded!" # Prefix + x to kill current pane (with confirmation) bind x confirm-before -p "kill-pane #P? (y/n)" kill-pane