mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
packages/tmux-sessionizer: attach-or-switch
This commit is contained in:
parent
ddeb5859b0
commit
b69c80497f
1 changed files with 16 additions and 0 deletions
|
|
@ -28,11 +28,27 @@
|
|||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
tmux-attach-or-switch = writeShellApplication {
|
||||
name = "__tmux-attach-or-switch";
|
||||
runtimeInputs = [tmux];
|
||||
text = ''
|
||||
session_name="$1"
|
||||
TMUX=''${TMUX:-}
|
||||
|
||||
if [ -z "$TMUX" ]; then
|
||||
tmux attach-session -t "$session_name"
|
||||
else
|
||||
tmux switch-client -t "$session_name"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
in
|
||||
symlinkJoin {
|
||||
name = "tmux-sessionizer";
|
||||
paths = [
|
||||
tmux-register-session
|
||||
tmux-maybe-create
|
||||
tmux-attach-or-switch
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue