summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2016-12-07 11:59:37 +0000
committerUrbain Vaes <urbain@vaes.uk>2016-12-07 11:59:37 +0000
commitf094f6001ac803922a3200e7ba3553abb2a4d2f1 (patch)
treef23740f89f5b48423be78c2ce138ed4e9c9f0ece /bin
parent155c61738d77c976cbb2b5381fe8154f4894afb9 (diff)
[bin/tmux_attach] Add support for tmuxinator
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bin/tmux_attach12
1 files changed, 9 insertions, 3 deletions
diff --git a/bin/bin/tmux_attach b/bin/bin/tmux_attach
index 151c1f8..593f53c 100755
--- a/bin/bin/tmux_attach
+++ b/bin/bin/tmux_attach
@@ -1,9 +1,15 @@
#!/usr/bin/env bash
SESSIONS=$(tmux list-sessions | cut -d':' -f1)
+TMUXINATOR=$(tmuxinator list | tail -1 | sed 's/ /\n/g')
+UNION=$(cat <(echo "$SESSIONS") <(echo "$TMUXINATOR") | sort | uniq | sed "/^$/d")
-SESSION=$(echo "$SESSIONS" | dmenu -i -p "Session:" | tr -d '[[:space:]]')
-
+SESSION=$(echo "$UNION" | dmenu -i -p "Session:" | tr -d '[[:space:]]')
[[ -n $SESSION ]] || exit
-urxvt -e zsh -c "source ~/.zshrc && tmux new-session -A -s $SESSION"
+
+grep -Fxq "$SESSION" <(echo "$TMUXINATOR") \
+ && COMMAND="tmuxinator start $SESSION" \
+ || COMMAND="tmux new-session -A -s $SESSION"
+
+urxvt -e zsh -c "source ~/.zshrc && $COMMAND"