aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/tmux.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2014-10-04 00:32:24 +1300
committerTom Ryder <tom@sanctum.geek.nz>2014-10-04 00:32:24 +1300
commit1bfbd31316d4ae681f8a5fb7330a4bfe74d698ce (patch)
tree4a2bd8ded13f2d540a256b281bc04d85f264b576 /bash/bashrc.d/tmux.bash
parentfind(1) commands hard to get right (diff)
downloaddotfiles-1bfbd31316d4ae681f8a5fb7330a4bfe74d698ce.tar.gz
dotfiles-1bfbd31316d4ae681f8a5fb7330a4bfe74d698ce.zip
Restructure tmux argument determination
Diffstat (limited to 'bash/bashrc.d/tmux.bash')
-rw-r--r--bash/bashrc.d/tmux.bash16
1 files changed, 8 insertions, 8 deletions
diff --git a/bash/bashrc.d/tmux.bash b/bash/bashrc.d/tmux.bash
index 241af526..d7b6184b 100644
--- a/bash/bashrc.d/tmux.bash
+++ b/bash/bashrc.d/tmux.bash
@@ -7,17 +7,17 @@ fi
tmux() {
local -a tcmd
- # If sessions exist, default the arguments to the attach-session command
+ # If given any arguments, just use them as they are
if ! (($#)) ; then
- if command tmux has-session 2>/dev/null ; then
- tcmd=(attach-session -d)
- else
- tcmd=(new-session -s "${TMUX_SESSION:-default}")
- fi
+ tcmd=("$@")
+
+ # If a session exists, just attach to it
+ elif command tmux has-session 2>/dev/null ; then
+ tcmd=(attach-session -d)
- # Otherwise, just call tmux directly with the given arguments
+ # Create a new session with an appropriate name
else
- tcmd=("$@")
+ tcmd=(new-session -s "${TMUX_SESSION:-default}")
fi
# Run tmux command with concluded arguments