diff --git a/home/user/.bashrc b/home/user/.bashrc index 328e1ce..982c77c 100644 --- a/home/user/.bashrc +++ b/home/user/.bashrc @@ -7,7 +7,11 @@ if \ [[ ! "$TERM" =~ tmux ]] && \ command -v tmux &>/dev/null then - exec tmux + if systemctl -q --user is-active tmux; then + exec tmux -N -L "$USER" new + else + exec tmux + fi fi if [ -f "$HOME/.config/bash/sourcer" ]; then diff --git a/home/user/.config/systemd/user/tmux.service b/home/user/.config/systemd/user/tmux.service index ddbec63..9a0d101 100644 --- a/home/user/.config/systemd/user/tmux.service +++ b/home/user/.config/systemd/user/tmux.service @@ -5,7 +5,7 @@ After=default.target [Service] Type=simple -ExecStart=/usr/bin/tmux -D +ExecStart=/usr/bin/tmux -D -L %u ExecStop=/usr/bin/tmux kill-server Restart=on-failure diff --git a/home/user/.config/zsh/.zshrc b/home/user/.config/zsh/.zshrc index c885c3f..e2ad7ba 100644 --- a/home/user/.config/zsh/.zshrc +++ b/home/user/.config/zsh/.zshrc @@ -7,7 +7,11 @@ if \ [[ ! "$TERM" =~ tmux ]] && \ command -v tmux &>/dev/null then - exec tmux + if systemctl -q --user is-active tmux; then + exec tmux -N -L "$USER" new + else + exec tmux + fi fi if [ -f "$ZDOTDIR/sourcer" ]; then