From 8b9171e709f77b6f2d1f3c1aa10d318f2756cea4 Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Tue, 8 Apr 2025 07:05:48 -0500 Subject: [PATCH] update --- .config/scripts/sessions.sh | 16 ++++++++++++++++ .config/tmux/tmux.conf | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.config/scripts/sessions.sh b/.config/scripts/sessions.sh index 0023cdc..f2cb840 100755 --- a/.config/scripts/sessions.sh +++ b/.config/scripts/sessions.sh @@ -91,6 +91,21 @@ popup() { tmux attach-session -t "$name" } +scratch() { + name="scratch" + + 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 send-keys -t "$name" 'nvim scratch' C-m + tmux attach-session -t "$name" +} + case "$1" in new) new $2 ;; switch) switch ;; @@ -98,5 +113,6 @@ delete) delete ;; window) window ;; notes) notes ;; popup) popup ;; +scratch) scratch ;; *) echo "Please enter an action" ;; esac diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 3d0de11..45f301a 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -112,7 +112,7 @@ bind T if-shell -F '#{==:#{session_name},popup}' { bind S if-shell -F '#{==:#{session_name},scratch}' { detach-client } { - display-popup -d "#{pane_current_path}" -xC -yC -w 80% -h 75% -E 'tmux attach-session -t scratch || tmux new-session -s scratch nvim new' + display-popup -d "#{pane_current_path}" -xC -yC -w 80% -h 75% -E ". $HOME/.config/scripts/sessions.sh scratch" } bind N if-shell -F '#{==:#{session_name},notes}' {