commit 61fa3210cdcd05f106f3645f51c5fa3da0b3c0c8 parent 79b76ae67b083dad74afefabacd83ad4e13b8c4c Author: mtmn <miro@haravara.org> Date: Sat, 25 Apr 2026 20:32:27 +0200 dotfiles: fix t() shell function Diffstat:
| M | modules/mixins/dotfiles/config/shell/rc/functions | | | 16 | +++++++++++----- |
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/modules/mixins/dotfiles/config/shell/rc/functions b/modules/mixins/dotfiles/config/shell/rc/functions @@ -131,12 +131,18 @@ t() { session="$1" fi - if [ -n "$TMUX" ]; then - tmux switch-client -t "${session}" - elif tmux has-session -t "${session}" 2>/dev/null; then - tmux attach -t "${session}" + if tmux has-session -t "${session}" 2>/dev/null; then + if [ -n "$TMUX" ]; then + tmux switch-client -t "${session}" + else + tmux attach -t "${session}" + fi else - tmux new -s "${session}" + if [ -n "$TMUX" ]; then + tmux new-session -d -s "${session}" && tmux switch-client -t "${session}" + else + tmux new -s "${session}" + fi fi }