feat(tmux): script to change from notes to last session
This commit is contained in:
parent
dd3c3efa54
commit
5643ec6b12
3 changed files with 20 additions and 5 deletions
|
@ -61,5 +61,5 @@ bind -r ">" swap-window -d -t +1
|
||||||
# Projects
|
# Projects
|
||||||
bind-key Enter popup -E -h 80% -w 80% "dev"
|
bind-key Enter popup -E -h 80% -w 80% "dev"
|
||||||
|
|
||||||
# Notes Session
|
# Switch from Notes/Tasks Session with last session
|
||||||
bind-key n run "tmux switch-client -t 'notes-tasks'"
|
bind-key n run "tmux-notes-switch"
|
||||||
|
|
|
@ -19,14 +19,14 @@ yaml_config() {
|
||||||
tmuxp_load() {
|
tmuxp_load() {
|
||||||
launch_docs
|
launch_docs
|
||||||
if [[ -n "$TMUX" ]]; then
|
if [[ -n "$TMUX" ]]; then
|
||||||
tmuxp load -d "$selected_dir"
|
tmuxp load -y "$selected_dir"
|
||||||
zoxide_score
|
zoxide_score
|
||||||
else
|
else
|
||||||
tmuxp load "$selected_dir"
|
tmuxp load "$selected_dir"
|
||||||
zoxide_score
|
zoxide_score
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmux switch-client -t "$tab_title"
|
# tmux switch-client -t "$tab_title"
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_tmuxp() {
|
handle_tmuxp() {
|
||||||
|
@ -65,7 +65,9 @@ zoxide_score() {
|
||||||
}
|
}
|
||||||
|
|
||||||
launch_docs() {
|
launch_docs() {
|
||||||
tmuxp load -d notes-tasks # Doesn't load if it exists already
|
if ! tmux has-session -t "$SESSION_NOTES" 2>/dev/null; then
|
||||||
|
tmuxp load -d notes-tasks
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
selected_dir=$($projects_command | $fzf_command --prompt='Select a directory: ' \
|
selected_dir=$($projects_command | $fzf_command --prompt='Select a directory: ' \
|
||||||
|
|
13
.local/bin/tmux-notes-switch
Executable file
13
.local/bin/tmux-notes-switch
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SESSION_NOTES="notes-tasks"
|
||||||
|
|
||||||
|
if [ "$(tmux display-message -p '#S')" == "$SESSION_NOTES" ]; then
|
||||||
|
tmux switch-client -l
|
||||||
|
else
|
||||||
|
if tmux has-session -t "$SESSION_NOTES" 2>/dev/null; then
|
||||||
|
tmux switch-client -t "$SESSION_NOTES"
|
||||||
|
else
|
||||||
|
tmuxp load -y "$SESSION_NOTES"
|
||||||
|
fi
|
||||||
|
fi
|
Loading…
Add table
Reference in a new issue