mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
tmux: use builtin switch to last session
lol I reinvented the wheel
This commit is contained in:
parent
3f46bd7c81
commit
38b704da0e
3 changed files with 3 additions and 24 deletions
|
|
@ -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
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue