Last active
June 10, 2026 09:20
-
-
Save marconae/52f2d9d2742b944aa592b214434ae804 to your computer and use it in GitHub Desktop.
tmux setup for Agentic Engineering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # (1) Place tmux.conf into | |
| # (2) Place tmux-stats.sh into ~/.local/bin/tmux-stats and chmod +x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| export LC_ALL=C # ensures awk printf uses "." as decimal separator regardless of locale | |
| if [[ "$(uname)" == "Darwin" ]]; then | |
| # CPU: total = 100 - idle%; $(NF-1) is the idle% field in "CPU usage: X% user, Y% sys, Z% idle" | |
| cpu=$(top -l1 -s0 | awk '/^CPU usage/{v=$(NF-1); gsub(/%/,"",v); printf "%.0f", 100-v}') | |
| # Memory: active + wired + compressor pages (each line ends with a trailing dot) | |
| mem_total=$(sysctl -n hw.memsize | awk '{printf "%.1f", $1/1073741824}') | |
| mem_used=$(vm_stat | awk ' | |
| /Pages active/ {gsub(/\./,"",$3); a=$3} | |
| /Pages wired down/ {gsub(/\./,"",$4); w=$4} | |
| /Pages occupied by compressor/ {gsub(/\./,"",$5); c=$5} | |
| END {printf "%.1f", (a+w+c)*4096/1073741824}') | |
| mem_pct=$(awk "BEGIN{printf \"%.0f\", $mem_used*100/$mem_total}") | |
| disk=$(df -h / | awk 'NR==2{print $5}') | |
| else | |
| # CPU: single /proc/stat snapshot (instant, no sleep needed) | |
| cpu=$(awk '/^cpu /{idle=$5; total=$2+$3+$4+$5+$6+$7+$8; printf "%.0f", (1-idle/total)*100}' /proc/stat) | |
| # Memory: free -m gives MiB; convert to GB for display | |
| read -r mem_total mem_used mem_pct < <(free -m | awk 'NR==2{printf "%.1f %.1f %.0f", $2/1024, $3/1024, $3*100/$2}') | |
| disk=$(df -h / | awk 'NR==2{print $5}') | |
| fi | |
| echo "CPU ${cpu}% | Mem ${mem_used}/${mem_total}GB ${mem_pct}% | Disk ${disk}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Mouse Scrolling | |
| set -g mouse on | |
| # Prevent accidental entry into visual-selection (select) mode on mouse drag. | |
| # Default tmux uses copy-mode -M which immediately begins selection; without -M | |
| # the drag enters copy mode but leaves selection for an explicit 'v' press. | |
| bind -n MouseDrag1Pane if-shell -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" { send-keys -M } { copy-mode } | |
| # open new windows in the current path | |
| bind c new-window -c "#{pane_current_path}" | |
| # reload config file | |
| bind r source-file ~/.tmux.conf | |
| unbind p | |
| bind p previous-window | |
| # shorten command delay | |
| set -sg escape-time 1 | |
| # don't rename windows automatically | |
| set -g allow-rename off | |
| # Use Alt-arrow keys without prefix key to switch panes | |
| bind -n M-Left select-pane -L | |
| bind -n M-Right select-pane -R | |
| bind -n M-Up select-pane -U | |
| bind -n M-Down select-pane -D | |
| # enable vi mode keys | |
| set-window-option -g mode-keys vi | |
| # set default terminal mode to 256 colors | |
| set -g default-terminal "tmux-256color" | |
| set -ga terminal-overrides ",xterm-256color:Tc" | |
| # allow focus events to get through to applications running in tmux | |
| set -g focus-events on | |
| # Use zsh for new windows (detects path cross-platform) | |
| run-shell 'tmux set-option -g default-shell "$(command -v zsh)"' | |
| # Design | |
| # loud or quiet? | |
| set -g visual-activity on | |
| set -g visual-bell on | |
| set -g visual-silence off | |
| setw -g monitor-activity off | |
| set -g bell-action none | |
| # modes | |
| setw -g clock-mode-colour yellow | |
| setw -g mode-style 'fg=black bg=yellow bold' | |
| # panes | |
| set -g pane-border-style 'fg=red' | |
| set -g pane-active-border-style 'fg=yellow' | |
| # statusbar | |
| set -g status-position bottom | |
| set -g status-justify left | |
| set -g status-style 'fg=red' | |
| set -g status-left '#[fg=darkgreen bg=terminal]#[fg=white bg=darkgreen] #H #[fg=darkgreen bg=terminal] ' | |
| set -g status-left-length 40 | |
| set -g status-interval 5 | |
| set -g status-right-length 60 | |
| set -g status-right-style 'fg=black bg=yellow' | |
| set -g status-right '#[fg=yellow bg=terminal]#[fg=black bg=yellow] #(~/.local/bin/tmux-stats) #[fg=yellow bg=terminal]' | |
| setw -g window-status-current-style 'fg=black bg=colour39 bold' | |
| setw -g window-status-current-format '#[fg=colour39 bg=terminal]#[fg=black bg=colour39] #I #W #F #[fg=colour39 bg=terminal]' | |
| setw -g window-status-style 'fg=colour39' | |
| setw -g window-status-separator '' | |
| setw -g window-status-format ' #I #[fg=colour153]#W #[fg=colour39]#F ' | |
| setw -g window-status-bell-style 'fg=yellow bg=red bold' | |
| # messages | |
| set -g message-style 'fg=yellow bg=terminal bold' | |
| # Host-specific overrides (colour scheme, etc.) | |
| if-shell '[ -f ~/.tmux.conf.local ]' 'source-file ~/.tmux.conf.local' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment