tmux: use builtin switch to last session

lol I reinvented the wheel
This commit is contained in:
Primrose 2025-07-16 21:06:01 +02:00
parent 3f46bd7c81
commit 38b704da0e
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
3 changed files with 3 additions and 24 deletions

View file

@ -53,28 +53,6 @@
'';
};
tmux-last = writeShellApplication {
name = "tmux-last";
text = ''
tmux_last=/tmp/TMUX_LAST
if [ ! -f $tmux_last ]; then
echo "Last session is not yet set"
return 1
fi
session_name="$(cat $tmux_last)"
session_path="$session_name"
if [ ! -d "$session_path" ]; then
session_path="/tmp"
fi
# bail if not in tmux, nothing to register
${lib.getExe tmux-register-session} || :
${lib.getExe tmux-maybe-create} "$session_name" "$session_path"
${lib.getExe tmux-attach-or-switch} "$session_name"
'';
};
tmux-sessionizer = writeShellApplication {
name = "tmux-sessionizer";
runtimeInputs = [fzf gnused];
@ -121,7 +99,6 @@ in
tmux-register-session
tmux-maybe-create
tmux-attach-or-switch
tmux-last
tmux-sessionizer
];
}