diff --git a/.tmux.conf.home b/.tmux.conf.home new file mode 100644 index 0000000..e4b7993 --- /dev/null +++ b/.tmux.conf.home @@ -0,0 +1,120 @@ +New Usage +######################################### +# Basic Settings and Prefix +######################################### + +set-option -g prefix C-a # Set Ctrl-a as the prefix key +unbind C-b # Unbind the default Ctrl-b prefix +set -sg escape-time 1 # Shorten command delay for faster responsiveness + +######################################### +# Terminal and Display +######################################### + +set-option -g default-terminal "tmux-256color" # Force tmux to use 256 colors if supported by the terminal + +######################################### +# History and Indexing +######################################### + +set-option -g history-limit 10000 # Set the scrollback history limit to 10,000 lines +set-option -g base-index 1 # Start window indexing at 1 (instead of 0) +set-option -g pane-base-index 1 # Start pane indexing at 1 (instead of 0) + +######################################### +# Key Bindings +######################################### + +# Reload tmux configuration +bind r source-file ~/.tmux.conf \; display "Reloaded!" + +# Window Management +bind Tab next-window # Cycle to the next window +bind , command-prompt "rename-window '%%'" # Open a prompt to rename the current window + +# Pane Management +bind | split-window -h # Split the current window horizontally +bind - split-window -v # Split the current window vertically + +# Pane Selection (Vi-style movement) +bind h select-pane -L # Select the pane to the left +bind j select-pane -D # Select the pane below +bind k select-pane -U # Select the pane above +bind l select-pane -R # Select the pane to the right + +# Pane Resizing +bind -r H resize-pane -L 2 # Resize the current pane 2 cells to the left (repeatable with -r) +bind -r J resize-pane -D 2 # Resize the current pane 2 cells down (repeatable with -r) +bind -r K resize-pane -U 2 # Resize the current pane 2 cells up (repeatable with -r) +bind -r L resize-pane -R 2 # Resize the current pane 2 cells to the right (repeatable with -r) + +######################################### +# Visual Notifications +######################################### + +set-option -g monitor-activity on # Enable monitoring of activity in other windows +set-option -g visual-activity on # Enable visual notification of activity in other windows + +######################################### +# Status Bar +######################################### + +set-option -g status on # Turn the status bar on +set-option -g status-interval 5 # Set the status bar update frequency to 5 seconds +set-option -g status-justify centre # Justify the window list to the left + +# Left side of the status bar +set-option -g status-left-length 70 # Set the maximum length of the left side of the status bar +set-option -g status-left "#h ◆" # Display the hostname on the left, followed by some visual separators + +# Right side of the status bar +set-option -g status-right-length 60 # Set the maximum length of the right side of the status bar +set-option -g status-right "S:#S W:#I P:#P | %b %d %H:%M" # Display session name, window index, pane index, and the date/time on the right + +# Status bar style +set-option -g status-style bg=#000000,fg=grey # Set the background to default (transparent), foreground color, and brightness + +######################################### +# Pane Appearance +######################################### + +set-option -g pane-border-style bg=colour0,fg=colour8 # Style for inactive pane borders +set-option -g pane-active-border-style bg=colour0,fg=colour2 # Style for the active pane border + +######################################### +# Message Appearance +######################################### + +set-option -g message-style bg=default,fg=colour13 # Style for messages displayed in the tmux command line + +######################################### +# Window Appearance +######################################### + +set-window-option -g window-style bg=default # Default background color for windows +set-window-option -g window-active-style bg=default # Background color for the active window + +######################################### +# Window List Appearance +######################################### + +#set-window-option -g window-status-style fg=blue # Or your preferred inactive style +#set-window-option -g window-status-format "#[fg=blue] #I:#W#[fg=blue]#{?window_activity_flag,#[fg=yellow bg=default]!,}" +#set-window-option -g window-status-current-style fg=green,bright +#set-window-option -g window-status-current-format "#[fg=green,bright]● #I:#W ●#[fg=green]" + +# Stolen from https://github.com/mhartington/dotfiles/blob/main/config/tmux/tmux-status.conf + +# Not active window +set-window-option -g window-status-format "#{?window_activity_flag,#[bg=#ffff00 fg=#000000 bold],#[fg=#228b22 bg=default]}#I:#W" + +# Active window +set-window-option -g window-status-current-format "#[bg=default fg=#7cfc00]● #I:#W" + +######################################### +# Window Titles +######################################### + +set-option -g set-titles on # Enable automatic window titles +set-option -g set-titles-string '#H:#S.#I.#P #W #T' # Format string for window titles (hostname:session.window_index.pane_index window_number window_name) + diff --git a/README.md b/README.md index 67d81bb..6e919c1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ --- -filecreated: -fileupdated: 2025-04-16 -filetags: [readme] +CREATED : 2026-03-03 +UPDATED : +AUTHOR : chawley --- # tmux-menu.sh diff --git a/tmux-menu.template.sh b/tmux-menu.template.sh index 491ed9f..b49fcf2 100755 --- a/tmux-menu.template.sh +++ b/tmux-menu.template.sh @@ -1,36 +1,30 @@ #!/usr/bin/env bash #=============================================================================== # -# FILE: tmux-menu.sh -# -# USAGE: ./tmux-menu.sh -# -# DESCRIPTION: A hack script I wrote to help me manage pre-defined -# tmux-sessions -# -# OPTIONS: -# REQUIREMENTS: tmux -# NOTES: the cool down arrows in line 43? -v (see: digraphs) -# AUTHOR: C Hawley -# ORGANIZATION: -# CREATED: 2015-09 -# REVISION: Mon 16 Oct 2017 05:28:00 PM EDT +# CREATED : 2015-09-09 +# UPDATED : 2026-03-03 +# USAGE : +# DESC : A hack script I wrote to help me manage pre-defined +# tmux-sessions +# NOTES : +# AUTHOR : chawley +# #=============================================================================== -# check for command line argument -# Tips from: -# http://stackoverflow.com/questions/7832080/test-if-a-variable-is-set-in-bash-when-using-set-o-nounset if [ -z "${1:-}" ]; then session="undefined" else session=$1 fi +# Change this to your tmux config file if it's not in the home directory or named differently +TMUX_COMMAND="tmux -f .tmux.conf " + echo "" echo "" -echo "##################################" +echo "----------------------------------" echo "TMUX Hack Session Launcher" -echo "##################################" +echo "----------------------------------" echo "Launching Session: $session" # NO TMUX NESTING ALLOWED @@ -48,12 +42,12 @@ tcheck=$(tmux list-sessions | grep -c "${session}") # check if session is activ # sample session definition # -# case $session in -# analytics) # <- session name -# if [[ $tcheck == 0 ]]; then # <- check if it's already running -# tmux new-session -d -s analytics # <- if not, create it -# tmux rename-window 'localhost' # <- rename the first window (local) -# # ↓↓ define additional windows ↓↓ +# case $session in +# analytics) # <- session name +# if [[ $tcheck == 0 ]]; then # <- check if it's already running +# tmux new-session -d -s analytics # <- if not, create it +# tmux rename-window 'localhost' # <- rename the first window (local) +# # ↓↓ --- define additional windows --- ↓↓ # tmux new-window -t:1 -n 'lasis01' 'exec ssh lasis01' # tmux new-window -t:2 -n 'lasis01dev' 'exec ssh lasis01dev' # tmux new-window -t:3 -n 'ldssbox01' 'exec ssh ldssbox01' @@ -64,21 +58,20 @@ tcheck=$(tmux list-sessions | grep -c "${session}") # check if session is activ # tmux attach-session -t analytics # <- if window active, switch to it # ;; - case $session in mine) if [[ $tcheck == 0 ]]; then - tmux new-session -d -s mine - tmux rename-window 'local(aristotle)' - tmux new-window -t 1 -n 'root@vps' 'exec ssh root@vps.example.org' - tmux new-window -t:2 -n 'chawley@phaedrus' 'exec ssh chawley@phaedrus' - tmux new-window -t:3 -n 'chawley@homer' 'exec ssh chawley@homer.simpsons.net' + $TMUX_COMMAND new-session -d -s mine + $TMUX_COMMAND rename-window 'local(aristotle)' + $TMUX_COMMAND new-window -t 1 -n 'root@vps' 'exec ssh root@vps.example.org' + $TMUX_COMMAND new-window -t:2 -n 'chawley@phaedrus' 'exec ssh chawley@phaedrus' + $TMUX_COMMAND new-window -t:3 -n 'chawley@homer' 'exec ssh chawley@homer.simpsons.net' fi tmux attach-session -t mine ;; - # add more sessions here inside a case stanza. Start with a session name and end with ';;' - + # add more sessions here inside a case stanza. Start with a session name and end with ';;' + *) echo "### ERROR No Such Session ###" echo "Usage: tm " diff --git a/tmux.conf.work b/tmux.conf.work new file mode 100644 index 0000000..160f518 --- /dev/null +++ b/tmux.conf.work @@ -0,0 +1,118 @@ +######################################### +# Basic Settings and Prefix +######################################### + +set-option -g prefix C-a # Set Ctrl-a as the prefix key +unbind C-b # Unbind the default Ctrl-b prefix +set -sg escape-time 1 # Shorten command delay for faster responsiveness + +######################################### +# Terminal and Display +######################################### + +set-option -g default-terminal "tmux-256color" # Force tmux to use 256 colors if supported by the terminal + +######################################### +# History and Indexing +######################################### + +set-option -g history-limit 10000 # Set the scrollback history limit to 10,000 lines +set-option -g base-index 1 # Start window indexing at 1 (instead of 0) +set-option -g pane-base-index 1 # Start pane indexing at 1 (instead of 0) + +######################################### +# Key Bindings +######################################### + +# Reload tmux configuration +bind r source-file ~/.tmux.conf \; display "Reloaded!" + +# Window Management +bind Tab next-window # Cycle to the next window +bind , command-prompt "rename-window '%%'" # Open a prompt to rename the current window + +# Pane Management +bind | split-window -h # Split the current window horizontally +bind - split-window -v # Split the current window vertically + +# Pane Selection (Vi-style movement) +bind h select-pane -L # Select the pane to the left +bind j select-pane -D # Select the pane below +bind k select-pane -U # Select the pane above +bind l select-pane -R # Select the pane to the right + +# Pane Resizing +bind -r H resize-pane -L 2 # Resize the current pane 2 cells to the left (repeatable with -r) +bind -r J resize-pane -D 2 # Resize the current pane 2 cells down (repeatable with -r) +bind -r K resize-pane -U 2 # Resize the current pane 2 cells up (repeatable with -r) +bind -r L resize-pane -R 2 # Resize the current pane 2 cells to the right (repeatable with -r) + +######################################### +# Visual Notifications +######################################### + +set-option -g monitor-activity on # Enable monitoring of activity in other windows +set-option -g visual-activity on # Enable visual notification of activity in other windows + +######################################### +# Status Bar +######################################### + +set-option -g status on # Turn the status bar on +set-option -g status-interval 5 # Set the status bar update frequency to 5 seconds +set-option -g status-justify centre # Justify the window list to the left + +# Left side of the status bar +set-option -g status-left-length 70 # Set the maximum length of the left side of the status bar +set-option -g status-left "#h ◆" # Display the hostname on the left, followed by some visual separators + +# Right side of the status bar +set-option -g status-right-length 60 # Set the maximum length of the right side of the status bar +set-option -g status-right "S:#S W:#I P:#P | %b %d %H:%M" # Display session name, window index, pane index, and the date/time on the right + +# Status bar style +set-option -g status-style bg=#000000,fg=colour8,bright # Set the background to default (transparent), foreground color, and brightness + +######################################### +# Pane Appearance +######################################### + +set-option -g pane-border-style bg=colour0,fg=colour8 # Style for inactive pane borders +set-option -g pane-active-border-style bg=colour0,fg=colour2 # Style for the active pane border + +######################################### +# Message Appearance +######################################### + +set-option -g message-style bg=default,fg=colour13 # Style for messages displayed in the tmux command line + +######################################### +# Window Appearance +######################################### + +set-option -g window-style bg=default # Default background color for windows +set-option -g window-active-style bg=default # Background color for the active window + +######################################### +# Window List Appearance +######################################### + +#set-option -g window-status-current-format "#[fg=colour2,bg=colour0]● #I:#W ●#[fg=colour2,bg=colour0]" +#set-option -g window-status-style fg=colour8,bg=default # Or your preferred inactive style +#set-option -g window-status-current-style fg=colour2,bg=default,bright +#set-option -g window-status-format "#[fg=colour8,bg=default] #I:#W#[fg=colour8,bg=default]#{?window_activity_flag,#[fg=colour11]! ,}" + +# Stolen from https://github.com/mhartington/dotfiles/blob/main/config/tmux/tmux-status.conf + +# Not active window +set-window-option -g window-status-format "#{?window_activity_flag,#[bg=#8802ad fg=#000000 bold],#[fg=#5e708c bg=default]}#I:#W" + +# Active window +set-window-option -g window-status-current-format "#[bg=default fg=#059df5]● #I:#W" + +######################################### +# Window Titles +######################################### + +set-option -g set-titles on # Enable automatic window titles +set-option -g set-titles-string '#H:#S.#I.#P #W #T' # Format string for window titles (hostname:session.window_index.pane_index window_number window_name)