From 19498a2dd5aa8edb95c216482b63ed947a903bcc Mon Sep 17 00:00:00 2001 From: eug-vs Date: Tue, 21 Sep 2021 10:50:19 +0300 Subject: refactor: rename tmuxinator-menu -> tmux-menu --- tmux/.local/bin/tmux-menu.sh | 20 ++++++++++++++++++++ tmux/.local/bin/tmuxinator-menu.sh | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) create mode 100755 tmux/.local/bin/tmux-menu.sh delete mode 100755 tmux/.local/bin/tmuxinator-menu.sh (limited to 'tmux') diff --git a/tmux/.local/bin/tmux-menu.sh b/tmux/.local/bin/tmux-menu.sh new file mode 100755 index 0000000..dd6c8d9 --- /dev/null +++ b/tmux/.local/bin/tmux-menu.sh @@ -0,0 +1,20 @@ +#!/bin/sh +PROJECTS_DIRS="$HOME/Documents/Projects $HOME/Documents/Projects/hp" +TMUXINATOR_PROJECTS_DIR="$HOME/.config/tmuxinator" + +SELECTED=$({ for dir in $PROJECTS_DIRS; do ls $dir; done; ls $TMUXINATOR_PROJECTS_DIR; } | dmenu -l 10) + +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 diff --git a/tmux/.local/bin/tmuxinator-menu.sh b/tmux/.local/bin/tmuxinator-menu.sh deleted file mode 100755 index dd6c8d9..0000000 --- a/tmux/.local/bin/tmuxinator-menu.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -PROJECTS_DIRS="$HOME/Documents/Projects $HOME/Documents/Projects/hp" -TMUXINATOR_PROJECTS_DIR="$HOME/.config/tmuxinator" - -SELECTED=$({ for dir in $PROJECTS_DIRS; do ls $dir; done; ls $TMUXINATOR_PROJECTS_DIR; } | dmenu -l 10) - -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 -- cgit v1.2.3