Add wrappers for terminals to make scripts terminal-agnostic
Scripts launching a terminal will now require x-terminal-emulator in the path. A symlink for it can be created using `select-term.zsh`.
This commit is contained in:
parent
a367418433
commit
7ba3dba2bc
6 changed files with 53 additions and 35 deletions
30
misc/guiterm
30
misc/guiterm
|
@ -1,30 +0,0 @@
|
|||
#!/bin/zsh
|
||||
#dep:tmux alacritty
|
||||
|
||||
if [[ "${0:t}" == "guiterm" ]]; then
|
||||
<<-HELP
|
||||
Symlink to g\$progname to start \$progname in tmux in a new terminal or
|
||||
reattach a tmux session named \$progname in a new terminal
|
||||
|
||||
Symlink to g.\$progname to start \$progname in tmux in a new terminal
|
||||
regardless of existing tmux sessions"
|
||||
|
||||
Example symlink names:
|
||||
gmutt: start mutt in a terminal or open the existing one
|
||||
g.zsh: open a terminal running a new zsh session
|
||||
HELP
|
||||
exit 1
|
||||
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 alacritty -t G${prog} -e ${=action}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/zsh
|
||||
#dep:alacritty tmux mosh
|
||||
#dep:x-terminal-emulator tmux mosh
|
||||
if [[ "$1" == "-S" ]]; then
|
||||
shift
|
||||
server=${1};
|
||||
|
@ -8,4 +8,4 @@ else
|
|||
server="qwerty";
|
||||
fi
|
||||
|
||||
exec alacritty -t Weechat -e tmux new-session mosh "${server}" -- tmux attach "$@" -t weechat
|
||||
exec x-terminal-emulator -t Weechat -e tmux new-session mosh "${server}" -- tmux attach "$@" -t weechat
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue