Integrate scripts into home-manager
This commit is contained in:
23
scripts/tmux-sessionizer
Normal file
23
scripts/tmux-sessionizer
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
selected=$(find ~/projects -maxdepth 1 -mindepth 1 | fzf)
|
||||
if [[ -z "$selected" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
selected_name=$(basename $selected | tr ".,: " "____")
|
||||
|
||||
switch_to() {
|
||||
if [[ -z "$TMUX" ]]; then
|
||||
tmux attach-session -t $selected_name
|
||||
else
|
||||
tmux switch-client -t $selected_name
|
||||
fi
|
||||
}
|
||||
|
||||
if tmux has-session -t="$selected_name"; then
|
||||
switch_to
|
||||
else
|
||||
tmux new-session -ds $selected_name -c $selected
|
||||
tmux send-keys -t $selected_name "tmux-setup" ^M
|
||||
switch_to
|
||||
fi
|
||||
Reference in New Issue
Block a user