#!/bin/sh set -eu CONFIG_PATH="$XDG_CONFIG_HOME/fzy-tmux-project" search_dirs=$(cat "$CONFIG_PATH" | sed "s|~|$HOME|g") dir=$(find "$search_dirs" -mindepth 1 -maxdepth 1 -type d | fzy) || exit 0 [ ! -d "$dir" ] && exit 1 name=$(basename "$dir" | tr . _) [ -z "$TMUX" ] && ! pgrep tmux >/dev/null && exec tmux new -s "$name" -c "$dir" ! tmux has -t "$name" 2>/dev/null && tmux new -ds "$name" -c "$dir" tmux switchc -t "$name"