mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-07 07:09:15 +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
|
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
|
in
|
||||||
symlinkJoin {
|
symlinkJoin {
|
||||||
name = "tmux-sessionizer";
|
name = "tmux-sessionizer";
|
||||||
paths = [
|
paths = [
|
||||||
tmux-register-session
|
tmux-register-session
|
||||||
tmux-maybe-create
|
tmux-maybe-create
|
||||||
|
tmux-attach-or-switch
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue