fish: refactored tmux_sessionizer

This commit is contained in:
Primrose 2024-07-19 23:17:28 +02:00
parent d2d49f9de4
commit d78f5b9043
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
7 changed files with 74 additions and 78 deletions

View file

@ -1,20 +1,19 @@
function tmux_home
# echo "---home---" >> /tmp/TMUX_DEBUG
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
echo (tmux display-message -p '#S') >/tmp/TMUX_LAST
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
function tmux_home \
--description "Take me back to ~"
# create session if doesn't exist
if ! tmux has-session -t="home" 2>/dev/null
set session_name home
if [ -n "$TMUX" ]
__tmux_register_session
end
if pgrep tmux 2>&1 >/dev/null; or ! tmux has -t=$session_name 2>/dev/null
tmux \
new-session -ds home \; \
new-window -t home \; \
select-window -t "home":1
end
if [ -z $TMUX ]
tmux attach-session -t home
else
tmux switch-client -t home
end
__tmux_attach_or_switch $session_name
end