diff options
author | frosty <passedgoandgot200@disroot.org> | 2025-07-04 07:07:06 -0400 |
---|---|---|
committer | frosty <passedgoandgot200@disroot.org> | 2025-07-04 07:07:06 -0400 |
commit | 0a70b07e4bb0d22d8762697ff863cf87179f9731 (patch) | |
tree | a08e4d448d867f4e904314798e0f9d3f89fe48d2 /.local/bin/fzy-tmux-project | |
parent | 9be23514542ab9aedb6fb465301cba7a134fd4eb (diff) | |
download | dotfiles-0a70b07e4bb0d22d8762697ff863cf87179f9731.tar.gz dotfiles-0a70b07e4bb0d22d8762697ff863cf87179f9731.zip |
add scripts
Diffstat (limited to '.local/bin/fzy-tmux-project')
-rwxr-xr-x | .local/bin/fzy-tmux-project | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/.local/bin/fzy-tmux-project b/.local/bin/fzy-tmux-project new file mode 100755 index 0000000..b4cd23e --- /dev/null +++ b/.local/bin/fzy-tmux-project @@ -0,0 +1,15 @@ +#!/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" |