diff --git a/.config/scripts/sessions.sh b/.config/scripts/sessions.sh index 471e7b2..0023cdc 100755 --- a/.config/scripts/sessions.sh +++ b/.config/scripts/sessions.sh @@ -72,16 +72,31 @@ notes() { tmux new-session -s notes nvim Welcome.md sleep 1 - tmux send-keys -t "$name" 'set -g status off' C-m + tmux send-keys -t "$name" 'tmux set -g status off;clear' C-m tmux send-keys -t "$name" 'nvim Welcome.md' C-m tmux attach-session -t "$name" } +popup() { + name="popup" + + tmux has-session -t ${name} >/dev/null && { + tmux attach-session -t ${name} + return + } + tmux new-session -d -s "$name" -c "$HOME" + + sleep 1 + tmux send-keys -t "$name" 'tmux set -g status off;clear' C-m + tmux attach-session -t "$name" +} + case "$1" in new) new $2 ;; switch) switch ;; delete) delete ;; window) window ;; notes) notes ;; +popup) popup ;; *) echo "Please enter an action" ;; esac diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 2ab3fcc..3d0de11 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -106,7 +106,7 @@ bind f display-popup -E -w 80% -h 75% "yazi" bind T if-shell -F '#{==:#{session_name},popup}' { detach-client } { - display-popup -d "#{pane_current_path}" -xC -yC -w 80% -h 75% -E 'tmux attach-session -t popup || tmux new-session -s popup' + display-popup -d "#{pane_current_path}" -xC -yC -w 80% -h 75% -E ". $HOME/.config/scripts/sessions.sh popup" } bind S if-shell -F '#{==:#{session_name},scratch}' {