add(tmux, fish): tmux_home

This commit is contained in:
Léana 江 2023-10-29 11:42:16 +01:00 committed by Léana 江
parent c75c92254f
commit b2c6b0ce6d
3 changed files with 34 additions and 0 deletions

View file

@ -49,6 +49,12 @@ if status is-interactive
# tools
starship init fish | source
# call tmux_home
if [ -z $TMUX ]
tmux attach-session -t "home"
end
end
# iTerm2 intergration

View file

@ -0,0 +1,27 @@
function tmux_home
set session_name "home"
set tmux_running (pgrep tmux)
if [ -z "$TMUX" ] && [ -z "$tmux_running" ]
tmux \
new-session -s $session_name \; \
new-window -t $session_name \; \
select-window -t $session_name:1 \;
return 0
end
if ! tmux has-session -t=$session_name 2> /dev/null
tmux \
new-session -ds $session_name \; \
new-window -t $session_name \; \
select-window -t $session_name:1 \;
end
if [ -z $TMUX ]
tmux attach-session -t $session_name
else
tmux switch-client -t $session_name
end
end