From a6813bcc320363cdc89a5936908b2e3f90a601ce Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Thu, 27 Feb 2025 00:04:10 +0500 Subject: Add more options tmux session selection script Create new session by path, tmuxp or tmuxinator project name, prefered paths. --- tmux-sessionizer | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tmux-sessionizer b/tmux-sessionizer index 0b90b4f..03a7490 100755 --- a/tmux-sessionizer +++ b/tmux-sessionizer @@ -5,10 +5,21 @@ set -euo pipefail main() { if [ $# -eq 1 ]; then - selected=$(realpath "$1") + if [ -d "$1" ]; then + selected=$(realpath "$1") + elif command -v tmuxp >/dev/null; then + tmuxp load -y "$1" + exit + elif command -v tmuxinator >/dev/null; then + tmuxinator "$1" + exit + else + echo "Unknown selection" + exit 1 + fi else read -r -a extra_paths <<<"${TMUX_SESSIONIZER_EXTRA_PATHS:-}" - selected=$(find ~/src "${extra_paths[@]}" -mindepth 1 -maxdepth 1 -type d | fzf --scheme path --tiebreak end) + selected=$(find ~/src "${extra_paths[@]}" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | fzf --scheme path --tiebreak end || true) fi if [ -z "$selected" ]; then -- cgit v1.2.3