Add session-created hook to automate session layouts
This commit is contained in:
parent
27025bffbd
commit
1e14c8f9c6
9
hooks/session-create.sh
Executable file
9
hooks/session-create.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
session_name=$(tmux display-message -p '#S')
|
||||||
|
session_layout=~/.local/share/tmux/layouts/session-$session_name
|
||||||
|
if [ -f $session_layout ]; then
|
||||||
|
tmux source-file $session_layout
|
||||||
|
else
|
||||||
|
tmux rename-window home
|
||||||
|
fi
|
7
layouts/session-local
Normal file
7
layouts/session-local
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
rename-window home
|
||||||
|
new-window -c ~/.config/local
|
||||||
|
rename-window local
|
||||||
|
move-window -s local:local -t 9
|
||||||
|
select-window -t local:home
|
||||||
|
|
||||||
|
# vim: filetype=tmux
|
@ -14,6 +14,8 @@
|
|||||||
dest: ~/.tmux.conf
|
dest: ~/.tmux.conf
|
||||||
- src: ~/.config/tmux/layouts/session-main
|
- src: ~/.config/tmux/layouts/session-main
|
||||||
dest: ~/.local/share/tmux/layouts/session-main
|
dest: ~/.local/share/tmux/layouts/session-main
|
||||||
|
- src: ~/.config/tmux/layouts/session-local
|
||||||
|
dest: ~/.local/share/tmux/layouts/session-local
|
||||||
- src: ~/.config/tmux/layouts/window-tall
|
- src: ~/.config/tmux/layouts/window-tall
|
||||||
dest: ~/.local/share/tmux/layouts/window-tall
|
dest: ~/.local/share/tmux/layouts/window-tall
|
||||||
- src: ~/.config/tmux/layouts/window-wide-left
|
- src: ~/.config/tmux/layouts/window-wide-left
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
# Set global hooks to perform actions when events occur
|
||||||
|
set-hook -g session-created 'run ~/.config/tmux/hooks/session-create.sh'
|
||||||
|
|
||||||
# Set the tmux version to check for command support
|
# Set the tmux version to check for command support
|
||||||
run 'tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6-8)'
|
run 'tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6-8)'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user