refactor(tmux): session-switcher is now dynamic
Can pass a session name
This commit is contained in:
parent
259ad2106c
commit
335db8d4bd
3 changed files with 19 additions and 14 deletions
|
@ -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"
|
bind-key Enter popup -E -h 90% -w 100% -x C -y C "tf"
|
||||||
|
|
||||||
# Switch from Notes/Tasks Session with last session
|
# 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
|
# Switch to last used panel and zoom
|
||||||
bind-key Z select-pane -l \; resize-pane -Z
|
bind-key Z select-pane -l \; resize-pane -Z
|
||||||
|
|
|
@ -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
|
|
17
.local/bin/tmux-session-switcher
Executable file
17
.local/bin/tmux-session-switcher
Executable file
|
@ -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
|
Loading…
Add table
Reference in a new issue