diff --git a/.config/tmux/conf/binds.conf b/.config/tmux/conf/binds.conf index 0e033b09..10533026 100644 --- a/.config/tmux/conf/binds.conf +++ b/.config/tmux/conf/binds.conf @@ -62,7 +62,8 @@ bind -r ">" swap-window -d -t +1 bind-key Enter popup -E -h 90% -w 100% -x C -y C "tf" # Switch from Notes/Tasks Session with last session -bind-key n run "tmux-notes-switch" +bind-key n run "tmux-session-switcher notes-tasks" +bind-key m run "tmux-session-switcher mail" # Switch to last used panel and zoom bind-key Z select-pane -l \; resize-pane -Z diff --git a/.local/bin/tmux-notes-switch b/.local/bin/tmux-notes-switch deleted file mode 100755 index a2bc5298..00000000 --- a/.local/bin/tmux-notes-switch +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -SESSION_NOTES="notes-tasks" - -if [ "$(tmux display-message -p '#S')" == "$SESSION_NOTES" ]; then - tmux switch-client -l &>/dev/null -else - if tmux has-session -t "$SESSION_NOTES" 2>/dev/null; then - tmux switch-client -t "$SESSION_NOTES" &>/dev/null - else - tmuxp load -y "$SESSION_NOTES" &>/dev/null - fi -fi diff --git a/.local/bin/tmux-session-switcher b/.local/bin/tmux-session-switcher new file mode 100755 index 00000000..14acbe1e --- /dev/null +++ b/.local/bin/tmux-session-switcher @@ -0,0 +1,17 @@ +#!/bin/bash + +SESSION_NAME=$1 + +if [ -z "$SESSION_NAME" ]; then + tmux switch-client -l &>/dev/null +fi + +if [ "$(tmux display-message -p '#S')" == "$SESSION_NAME" ]; then + tmux switch-client -l &>/dev/null +else + if tmux has-session -t "$SESSION_NAME" 2>/dev/null; then + tmux switch-client -t "$SESSION_NAME" &>/dev/null + else + tmuxp load -y "$SESSION_NAME" &>/dev/null + fi +fi