summaryrefslogtreecommitdiffstats
path: root/bashrc/bin/t
diff options
context:
space:
mode:
Diffstat (limited to 'bashrc/bin/t')
-rwxr-xr-xbashrc/bin/t33
1 files changed, 29 insertions, 4 deletions
diff --git a/bashrc/bin/t b/bashrc/bin/t
index 019eda9..3919af4 100755
--- a/bashrc/bin/t
+++ b/bashrc/bin/t
@@ -1,12 +1,37 @@
#!/usr/bin/env bash
+real_tmux() {
+ if [ -f "${HOME}/.dotfiles/tmux/tmux.conf" ]; then
+ \tmux -f "${HOME}/.dotfiles/tmux/tmux.conf" -S "${HOME}/.dotfiles/tmux/socket" "$@"
+ else
+ \tmux "$@"
+ fi
+}
+
+exec_real_tmux() {
+ if [ -f "${HOME}/.dotfiles/tmux/tmux.conf" ]; then
+ exec \tmux -f "${HOME}/.dotfiles/tmux/tmux.conf" -S "${HOME}/.dotfiles/tmux/socket" "$@"
+ else
+ exec \tmux "$@"
+ fi
+}
+
+
if [[ "x$1" == x ]] ; then
- \tmux list-sessions ||
+ real_tmux list-sessions ||
{
- \tmux new-session -d
+ real_tmux new-session -d
}
- exec \tmux attach-session -d
+ exec_real_tmux attach-session -d
+fi
+
+if [ -z "$2" -a "$1" != "att" -a "$1" != "ls" ]; then
+ if teal_tmux has-session -t "$1"; then
+ exec exec_real_tmux attach-session -t "$1"
+ else
+ exec exec_real_tmux new-session -s "$1"
+ fi
fi
-exec \tmux $@
+exec_real_tmux $@