aboutsummaryrefslogtreecommitdiff
path: root/tmux
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2021-09-21 10:48:07 +0300
committereug-vs <eugene@eug-vs.xyz>2021-09-21 10:48:07 +0300
commit58d06a10ed7b753839160568c5430f319097cee2 (patch)
tree1caa2ba0e4c2e9c9a4a0c86cdfeffcf69ad0f2a5 /tmux
parent902d3a8b00a8141737889faa5c82b1707fe3da1a (diff)
downloaddotfiles-58d06a10ed7b753839160568c5430f319097cee2.tar.gz
feat(tmux): choose any project with tmux-menu
Diffstat (limited to 'tmux')
-rwxr-xr-xtmux/.local/bin/tmuxinator-menu.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/tmux/.local/bin/tmuxinator-menu.sh b/tmux/.local/bin/tmuxinator-menu.sh
index 4dfcc14..dd6c8d9 100755
--- a/tmux/.local/bin/tmuxinator-menu.sh
+++ b/tmux/.local/bin/tmuxinator-menu.sh
@@ -1,5 +1,20 @@
#!/bin/sh
+PROJECTS_DIRS="$HOME/Documents/Projects $HOME/Documents/Projects/hp"
+TMUXINATOR_PROJECTS_DIR="$HOME/.config/tmuxinator"
-PROJECTS_DIR=~/.config/tmuxinator
+SELECTED=$({ for dir in $PROJECTS_DIRS; do ls $dir; done; ls $TMUXINATOR_PROJECTS_DIR; } | dmenu -l 10)
-ls $PROJECTS_DIR | sed 's/\.yml//g' | dmenu -l 10 | xargs tmuxinator start
+if [ $(echo $SELECTED | grep '.yml') ]; then
+ # Tmuxinator project was selected, start it
+ tmuxinator start "${SELECTED%.*}"
+else
+ # Project directory was selected, find its full path (in any of the dirs)
+ for dir in $PROJECTS_DIRS; do
+ FULL_PATH=$(find $dir -maxdepth 1 -type d -name $SELECTED)
+ if [ -n "$FULL_PATH" ]; then
+ # Start project based on the template
+ tmuxinator start --no-attach -p=$HOME/.config/tmuxinator/.template.yml name=$SELECTED root=$FULL_PATH 2>/dev/null &
+ break
+ fi
+ done;
+fi