diff options
| author | Anton Bobov <anton@bobov.name> | 2025-02-27 00:04:10 +0500 |
|---|---|---|
| committer | Anton Bobov <anton@bobov.name> | 2025-02-27 00:04:10 +0500 |
| commit | a6813bcc320363cdc89a5936908b2e3f90a601ce (patch) | |
| tree | 56cb8e3e1300cd7f8a98b98e95b1e97fe7da36e7 | |
| parent | 08cec0b96bb963cdfa71f7de08f0f63309b9407f (diff) | |
Add more options tmux session selection script
Create new session by path, tmuxp or tmuxinator project name, prefered
paths.
| -rwxr-xr-x | tmux-sessionizer | 15 |
1 files 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 |
