strom/fish-misc
Archived
1
0
Fork 0
This repository has been archived on 2023-08-27. You can view files and clone it, but cannot push or open issues or pull requests.
fish-misc/functions/safe_launch.fish

15 lines
438 B
Fish

# vim: ft=fish ts=4 sw=4 noet
function safe_launch --description 'launch command inside a tmux session'
if ! command -sq tmux; return 1; end
if _is_tmux
command tmux new-window "$argv;bash -i"
else
if command tmux has-session -t 'main' >/dev/null 2>&1
command tmux new-window -t 'main' "$argv;bash -i" \
&& command tmux attach-session -t 'main'
else
command tmux new-session -A -s 'main' "$argv;bash -i"
end
end
end