tmux session managment fix

This commit is contained in:
thek4n 2024-10-13 23:51:10 +03:00
parent 76a911ffc9
commit 5423cd1bd1
3 changed files with 36 additions and 3 deletions

7
.gitignore vendored
View File

@ -27,6 +27,7 @@ home/user/.termux/shell
home/user/.config/tmux/plugins
home/user/.config/tmux/local.conf
home/user/.tmux/*
!home/user/.tmux/01.sh
!home/user/.tmux/10.sh
!home/user/.tmux/*
!home/user/.tmux/dotfiles.sh
!home/user/.tmux/temp.sh

18
home/user/.tmux/dotfiles.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -x
SESSION=dotfiles
MAINW=1
WORKING_PROJECT="$HOME/dotfiles"
if ! tmux has-session -t "$SESSION"; then
tmux new-session -s "$SESSION" -d -n "$MAINW" -c "$WORKING_PROJECT"
tmux splitw -t "$SESSION:$MAINW" -d -b -h -l "$_tmux_other_pane_size" -c '#{pane_current_path}'
tmux send-keys -t "$SESSION:$MAINW.1" "git pull && git push" Enter
tmux send-keys -t "$SESSION:$MAINW.2" '$EDITOR' Enter
tmux send-keys -t "$SESSION:$MAINW.2" ':Telescope find_files' Enter
fi
tmux switch-client -t "$SESSION"

14
home/user/.tmux/temp.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -x
readonly RND="${RANDOM}"
readonly SESSION="sandbox${RND}"
declare WORKING_PROJECT
WORKING_PROJECT="$(mktemp -td "sandbox${RND}.XXXX")"
readonly WORKING_PROJECT
tmux new-session -s "${SESSION}" -d -c "${WORKING_PROJECT}"
tmux switch-client -t "${SESSION}"