From da00938d697afa983ced14b51d87567ee096b35c Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Wed, 7 Dec 2016 11:59:37 +0000 Subject: [bin/tmux_attach] Add support for tmuxinator --- bin/bin/tmux_attach | 12 +++++++++--- i3/.config/i3/config | 3 +-- 2 files changed, 10 insertions(+), 5 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" diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 24eb24c..28a7a98 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -178,8 +178,7 @@ bindsym XF86AudioPlay exec $HOME/bin/touchpad bindsym $mod+n exec $HOME/bin/workspace n bindsym $mod+Shift+n exec $HOME/bin/workspace m bindsym $mod+semicolon exec --no-startup-id $HOME/bin/run -bindsym $mod+z exec --no-startup-id $HOME/bin/tmux_attach -bindsym $mod+e exec --no-startup-id $HOME/bin/rename_workspace +bindsym $mod+e exec --no-startup-id $HOME/bin/tmux_attach bindsym $mod+o exec --no-startup-id $HOME/bin/references bindsym $mod+Escape exec systemctl suspend -- cgit v1.2.3