diff options
author | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2014-04-14 20:29:32 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2014-04-14 20:29:32 +0200 |
commit | 787a747f6f374434890e73430fae9899d76c38e5 (patch) | |
tree | 60030b80cb7d4fc24a34b69582247f35f01c1300 /bashrc/bin/t | |
parent | 77f576af6fa9670120a9ed957729ec739cae408c (diff) | |
download | dotfiles-787a747f6f374434890e73430fae9899d76c38e5.tar.gz dotfiles-787a747f6f374434890e73430fae9899d76c38e5.tar.xz dotfiles-787a747f6f374434890e73430fae9899d76c38e5.zip |
tmux: config and socket in dofiles directory
Diffstat (limited to '')
-rwxr-xr-x | bashrc/bin/t | 33 |
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 $@ |