From ef9bf9558f7c818a950950b96ba145b8018a990b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Tue, 10 Mar 2026 00:43:00 +0100 Subject: [PATCH 1/6] feat(tmux): add xterm-ghostty settings --- tmux/tmux.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index aaa3dc3..955892a 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -1,6 +1,6 @@ -set -g default-terminal "xterm-256color" -set -ga terminal-overrides ",xterm-256color:RGB" -set -ga terminal-features ",xterm-256color:clipboard" +set -g default-terminal "tmux-256color" +set -ga terminal-overrides ",xterm-ghostty:RGB,xterm-256color:RGB" +set -ga terminal-features ",xterm-ghostty:clipboard,xterm-256color:clipboard" set -g allow-passthrough on set -g set-clipboard on From 74c3012139341cebd6c1cc8ef685a8e38c3769df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Tue, 10 Mar 2026 00:44:39 +0100 Subject: [PATCH 2/6] feat(tmux): add sensible defaults --- tmux/tmux.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 955892a..5fcc76c 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -14,6 +14,9 @@ set-option -g prefix C-s bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" set -g base-index 1 +set -g pane-base-index 1 +set -g renumber-windows on +set -g focus-events on set -g status-style 'bg=default fg=default' set -g status-left-length 20 From 31950b6ae332061fd9088572b0809157d5fa2ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Tue, 10 Mar 2026 00:45:28 +0100 Subject: [PATCH 3/6] feat(tmux): remove os specific copy in favor of osc --- tmux/tmux.conf | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 5fcc76c..6b6584f 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -24,14 +24,6 @@ set -g status-left-length 20 set-window-option -g mode-keys vi bind -T copy-mode-vi v send-keys -X begin-selection -# differentiate copy on linux and max -if-shell -b '[ "$(uname -s)" = "Linux" ]' { - bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' -} - -if-shell -b '[ "$(uname -s)" = "Darwin" ]' { - bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy' -} # vim-like pane switching bind ^ last-window From 9b9b5b58a4293b4c00fda69aafc59b04a121b34a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Tue, 10 Mar 2026 00:46:06 +0100 Subject: [PATCH 4/6] chore(tmux): normalize config --- tmux/tmux.conf | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 6b6584f..6726c2d 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -2,7 +2,6 @@ set -g default-terminal "tmux-256color" set -ga terminal-overrides ",xterm-ghostty:RGB,xterm-256color:RGB" set -ga terminal-features ",xterm-ghostty:clipboard,xterm-256color:clipboard" -set -g allow-passthrough on set -g set-clipboard on set -s escape-time 0 @@ -10,7 +9,7 @@ set -s escape-time 0 set -g update-environment "SSH_AUTH_SOCK SSH_CONNECTION SSH_TTY DISPLAY" unbind C-b -set-option -g prefix C-s +set -g prefix C-s bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" set -g base-index 1 @@ -21,7 +20,7 @@ set -g focus-events on set -g status-style 'bg=default fg=default' set -g status-left-length 20 -set-window-option -g mode-keys vi +set -wg mode-keys vi bind -T copy-mode-vi v send-keys -X begin-selection @@ -33,16 +32,16 @@ bind h select-pane -L bind l select-pane -R # sessionizer -bind-key f run-shell "tmux neww ~/.config/tmux/tmux-sessionizer" -bind-key R run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~" -bind-key g run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/.config" -bind-key T run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/temp" +bind f run-shell "tmux neww ~/.config/tmux/tmux-sessionizer" +bind R run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~" +bind g run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/.config" +bind T run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/temp" # clone -bind-key G run-shell "tmux neww ~/.config/tmux/tmux-ggclone" +bind G run-shell "tmux neww ~/.config/tmux/tmux-ggclone" # ssh -bind-key F run-shell "tmux neww ~/.config/tmux/tmux-ssher" +bind F run-shell "tmux neww ~/.config/tmux/tmux-ssher" # project -bind-key N run-shell "tmux neww ~/.config/tmux/tmux-new-project" +bind N run-shell "tmux neww ~/.config/tmux/tmux-new-project" From 42a1672fb021407c3dda8421a700043c7d31def6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Tue, 10 Mar 2026 00:50:12 +0100 Subject: [PATCH 5/6] chore(tmux): reorganize config --- tmux/tmux.conf | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 6726c2d..4cde960 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -1,36 +1,43 @@ +# server options +set -s escape-time 0 + +# terminal set -g default-terminal "tmux-256color" set -ga terminal-overrides ",xterm-ghostty:RGB,xterm-256color:RGB" set -ga terminal-features ",xterm-ghostty:clipboard,xterm-256color:clipboard" - set -g set-clipboard on -set -s escape-time 0 - +# general +set -g prefix C-s +set -g base-index 1 +set -g focus-events on set -g update-environment "SSH_AUTH_SOCK SSH_CONNECTION SSH_TTY DISPLAY" -unbind C-b -set -g prefix C-s - -bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" -set -g base-index 1 -set -g pane-base-index 1 -set -g renumber-windows on -set -g focus-events on - +# status bar set -g status-style 'bg=default fg=default' set -g status-left-length 20 +# window options set -wg mode-keys vi +set -g pane-base-index 1 +set -g renumber-windows on + +# prefix +unbind C-b + +# copy mode bind -T copy-mode-vi v send-keys -X begin-selection - -# vim-like pane switching +# navigation bind ^ last-window bind k select-pane -U bind j select-pane -D bind h select-pane -L bind l select-pane -R +# reload +bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" + # sessionizer bind f run-shell "tmux neww ~/.config/tmux/tmux-sessionizer" bind R run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~" From a47d9442867766377f8c4765624b4dbdffaeb74d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Tue, 10 Mar 2026 00:55:03 +0100 Subject: [PATCH 6/6] chore(tmux): cleanup tmux scripts --- tmux/tmux-ggclone | 4 +--- tmux/tmux-new-project | 10 +++------- tmux/tmux-sessionizer | 14 ++++++-------- tmux/tmux-ssher | 27 +++++++++++++-------------- 4 files changed, 23 insertions(+), 32 deletions(-) diff --git a/tmux/tmux-ggclone b/tmux/tmux-ggclone index 0e2114e..051f03e 100755 --- a/tmux/tmux-ggclone +++ b/tmux/tmux-ggclone @@ -1,7 +1,5 @@ #!/usr/bin/env bash -source "$XDG_CONFIG_HOME/zsh/scripts.zsh" - if [[ $# -eq 1 ]]; then selected=$1 else @@ -12,7 +10,7 @@ if [[ -z $selected ]]; then exit 0 fi -ggman clone $selected +ggman clone "$selected" echo "" read -p "press enter to continue..." diff --git a/tmux/tmux-new-project b/tmux/tmux-new-project index e44dd03..1b1dabc 100755 --- a/tmux/tmux-new-project +++ b/tmux/tmux-new-project @@ -6,8 +6,6 @@ if [[ -z ${NAME:+x} ]]; then exit 1 fi -source "$XDG_CONFIG_HOME/zsh/scripts.zsh" - read -p "name: " project_name if [[ -z $project_name ]]; then @@ -19,7 +17,7 @@ if [[ -d "$GGROOT/no-remote/$project_name" ]]; then fi project="$GGROOT/no-remote/$project_name" -git init $project +git init "$project" echo "# $project_name" >>"$project/README.md" gitignore_template=$( @@ -28,7 +26,7 @@ gitignore_template=$( | fzf --cycle --bind 'tab:toggle-up,btab:toggle-down' ) -if ! [[ -z $gitignore_template ]]; then +if [[ -n $gitignore_template ]]; then gitignore="$GGROOT/github.com/github/gitignore/$gitignore_template.gitignore" echo "$gitignore" echo "$project/.gitignore" @@ -41,10 +39,8 @@ license_template=$( | fzf --cycle --bind 'tab:toggle-up,btab:toggle-down' ) -if ! [[ -z $license_template ]]; then +if [[ -n $license_template ]]; then license="$GGROOT/git.janezic.dev/janezicmatej/license/$license_template.license" export YEAR="$(date '+%Y')" envsubst <"$license" >"$project/LICENSE" fi - -ggcompile diff --git a/tmux/tmux-sessionizer b/tmux/tmux-sessionizer index edab443..a2787d3 100755 --- a/tmux/tmux-sessionizer +++ b/tmux/tmux-sessionizer @@ -18,17 +18,15 @@ if [[ -z $selected ]]; then exit 0 fi -selected_name="$(echo $selected | shasum -a 256 | head -c 4)_$(basename $selected | tr . _ | head -c 10)" +selected_name="$(echo "$selected" | shasum -a 256 | head -c 4)_$(basename "$selected" | tr . _ | head -c 10)" -tmux_running=$(pgrep tmux) - -if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then - tmux new-session -s $selected_name -c $selected +if [[ -z $TMUX ]] && ! tmux list-sessions 2>/dev/null; then + tmux new-session -s "$selected_name" -c "$selected" exit 0 fi -if ! tmux has-session -t=$selected_name 2> /dev/null; then - tmux new-session -ds $selected_name -c $selected +if ! tmux has-session -t="$selected_name" 2>/dev/null; then + tmux new-session -ds "$selected_name" -c "$selected" fi -tmux switch-client -t $selected_name +tmux switch-client -t "$selected_name" diff --git a/tmux/tmux-ssher b/tmux/tmux-ssher index 91ead86..102892a 100755 --- a/tmux/tmux-ssher +++ b/tmux/tmux-ssher @@ -4,22 +4,22 @@ function _preview { file=$1; shift host=$1; shift - j=$(cat $file \ + j=$(cat "$file" \ | jc --ssh-conf \ | jq -r ".[] \ | select(.host == \"$host\") \ | .jumps = (if (.proxyjump | type == \"array\" and length > 0) then (.proxyjump | join(\",\")) else \"null\" end)" \ ) - user=$(jq -r '.user' <<<$j) - port=$(jq -r '.port' <<<$j) - hostname=$(jq -r '.hostname' <<<$j) - jumps=$(jq -r '.jumps' <<<$j) + user=$(jq -r '.user' <<<"$j") + port=$(jq -r '.port' <<<"$j") + hostname=$(jq -r '.hostname' <<<"$j") + jumps=$(jq -r '.jumps' <<<"$j") echo "$(cat </dev/null \ + ping -c 1 -W 1 "$hostname" &>/dev/null \ && echo "Host is reachable!" \ || echo "Host is not reachable!" } @@ -60,18 +60,17 @@ function main() { fi selected_name="ssh_$selected" - tmux_running=$(pgrep tmux) - if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then - tmux new-session -s $selected_name -c $selected ssh "$selected" + if [[ -z $TMUX ]] && ! tmux list-sessions 2>/dev/null; then + tmux new-session -s "$selected_name" ssh "$selected" exit 0 fi - if ! tmux has-session -t=$selected_name 2> /dev/null; then - tmux new-session -ds $selected_name -c $selected ssh "$selected" + if ! tmux has-session -t="$selected_name" 2>/dev/null; then + tmux new-session -ds "$selected_name" ssh "$selected" fi - tmux switch-client -t $selected_name + tmux switch-client -t "$selected_name" } main "$@"