new script: g
This commit is contained in:
parent
6e2766f373
commit
472718f4ff
29
misc/g
Executable file
29
misc/g
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/zsh
|
||||
|
||||
if [[ "${0:t}" == "g" ]]; then
|
||||
echo "Symlink to g\$progname to start \$progname in tmux in a new terminal or reattach a tmux session named \$progname in a new terminal"
|
||||
echo
|
||||
echo "Symlink to g.\$progname to start \$progname in tmux in a new terminal regardless of existing tmux sessions"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -e /etc/zsh/zprofile ]]; then
|
||||
. /etc/zsh/zprofile
|
||||
fi
|
||||
if [[ -e $HOME/.zshenv ]]; then
|
||||
. $HOME/.zshenv
|
||||
fi
|
||||
|
||||
prog=${${0:t}[2,-1]}
|
||||
if [[ "$prog[1]" == "." ]]; then
|
||||
prog=${prog[2,-1]}
|
||||
action="tmux new-session ${prog}"
|
||||
elif tmux list-sessions | grep -qe "^${prog}:"; then
|
||||
action="tmux attach -t ${prog}"
|
||||
else
|
||||
action="tmux new-session -s ${prog} ${prog}"
|
||||
fi
|
||||
|
||||
#exec alacritty --title G${prog} -e ${=action}
|
||||
#exec urxvt -name G${prog} -e ${=action}
|
||||
exec alacritty -t G${prog} -e ${=action}
|
Loading…
Reference in a new issue