summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2023-03-09 20:52:13 -0600
committerToby Vincent <tobyv13@gmail.com>2023-03-09 20:52:13 -0600
commitaf83a45be390476b912c074e89c535f7159a9134 (patch)
tree1d6fc350f06e389d1496493325da4b4c86c8f36f
parentdbaadba4e453197929b29c039216ef8f712f7732 (diff)
fix(tmux): improve session naming
-rw-r--r--alacritty/.config/alacritty/shell.yml2
-rw-r--r--tmux/.config/tmux/ssh.conf2
-rw-r--r--tmux/.config/tmux/tmux.conf2
-rwxr-xr-xtmux/.local/bin/tmux-ssh4
4 files changed, 5 insertions, 5 deletions
diff --git a/alacritty/.config/alacritty/shell.yml b/alacritty/.config/alacritty/shell.yml
index a1ae03e..363c6c9 100644
--- a/alacritty/.config/alacritty/shell.yml
+++ b/alacritty/.config/alacritty/shell.yml
@@ -3,4 +3,4 @@ shell:
args:
- -l
- -c
- - tmux new -As $USER
+ - tmux new -A
diff --git a/tmux/.config/tmux/ssh.conf b/tmux/.config/tmux/ssh.conf
index 4bee96b..b5a5054 100644
--- a/tmux/.config/tmux/ssh.conf
+++ b/tmux/.config/tmux/ssh.conf
@@ -4,7 +4,5 @@ set-option -g remain-on-exit on
set-option -g prefix C-b
set-option -g status off
-bind-key -n C-a send-prefix
-
set-hook -g pane-died "detach -E 'tmux -L ssh kill-pane; tmux attach'"
diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf
index 1bcef1f..28fa23c 100644
--- a/tmux/.config/tmux/tmux.conf
+++ b/tmux/.config/tmux/tmux.conf
@@ -46,6 +46,8 @@ if "test ! -d $XDG_CONFIG_HOME/tmux/plugins/tpm" \
run '$XDG_CONFIG_HOME/tmux/plugins/tpm/tpm'
+set-hook -g session-created 'if -F "#{m/r:^[0-9]+$,#{session_name}}" "rename-session \"#{b:session_path}\""'
+
%if #{m:*ssh,#{socket_path}}
source "$XDG_CONFIG_HOME/tmux/ssh.conf"
%endif
diff --git a/tmux/.local/bin/tmux-ssh b/tmux/.local/bin/tmux-ssh
index b1875e2..6aa5911 100755
--- a/tmux/.local/bin/tmux-ssh
+++ b/tmux/.local/bin/tmux-ssh
@@ -28,10 +28,10 @@ if [ -z "$1" ]; then
fi
if [ "$1" = "localhost" ] || [ "$1" = "$HOST" ]; then
- tmux detach -E 'tmux attach'
+ tmux detach -E 'tmux new -A'
else
if ! tmux -L ssh has-session -t "$1"; then
- tmux -L ssh new-session -ds "$1" ssh -t "$1" zsh -l -c tmux new -As "$USER"
+ tmux -L ssh new-session -ds "$1" ssh -t "$1" "zsh -l -c 'tmux new -A'"
fi
if [ -z "$TMUX" ]; then