aboutsummaryrefslogtreecommitdiff
path: root/scripts/.scripts
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2023-06-07 02:53:07 +0300
committeromagdy7 <omar.professional8777@gmail.com>2023-06-07 02:53:07 +0300
commitc2bdb9b430a51309e5bc3f86f22c7ba94fa4e0cb (patch)
tree65f370761459b875cbaecab16b32e9cdcd35c038 /scripts/.scripts
parent6fc0fdae169635c974cb28f316f94868108a6e87 (diff)
downloaddotfiles-c2bdb9b430a51309e5bc3f86f22c7ba94fa4e0cb.tar.xz
dotfiles-c2bdb9b430a51309e5bc3f86f22c7ba94fa4e0cb.zip
Added a shortcut to tmux_sessionizer.sh in kitty ctrl+f to quickly find projects and start a tmux session
Diffstat (limited to 'scripts/.scripts')
-rwxr-xr-xscripts/.scripts/tmux-sessionizer.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/.scripts/tmux-sessionizer.sh b/scripts/.scripts/tmux-sessionizer.sh
index 727735c..c536df7 100755
--- a/scripts/.scripts/tmux-sessionizer.sh
+++ b/scripts/.scripts/tmux-sessionizer.sh
@@ -3,23 +3,27 @@
if [[ $# -eq 1 ]]; then
selected=$1
else
- selected=$(find ~/test -mindepth 1 -maxdepth 2 -type d | fzf)
+ selected=$(find ~/programming -mindepth 1 -maxdepth 2 -type d | fzf)
fi
if [[ -z $selected ]]; then
- exit 0
+ exit 1
fi
selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
- tmux new-session -s $selected_name -c $selected
+ tmux new-session -s $selected_name
+ tmux send-keys -t $selected_name "cd $selected" Enter
+ tmux send-keys -t $selected_name "clear" Enter
exit 0
fi
if ! tmux has-session -t=$selected_name 2> /dev/null; then
- tmux new-session -ds $selected_name -c $selected
+ tmux new-session -ds $selected_name
+ tmux send-keys -t $selected_name "cd $selected" Enter
+ tmux send-keys -t $selected_name "clear" Enter
fi
tmux switch-client -t $selected_name