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
29
select-term.zsh
Executable file
29
select-term.zsh
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/zsh
|
||||
|
||||
zparseopts -D -E p:=install_path -path:=install_path h:=help -help:=help
|
||||
|
||||
if [[ $help ]]; then
|
||||
<<-HELP
|
||||
Usage: $0 [opts]
|
||||
|
||||
Installs a wrapper script for the selected terminal under the name
|
||||
"x-terminal-emulator" in path. The wrapper ensures a common interface for
|
||||
setting title, class and passing commands.
|
||||
|
||||
Options:
|
||||
-p, --path PATH target directory to install into (defaults to ~/.local/bin)
|
||||
HELP
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [[ ! $install_path ]]; then
|
||||
install_path=$HOME/.local/bin
|
||||
else
|
||||
install_path=${install_path[2]}
|
||||
fi
|
||||
|
||||
terms=( lib/term-wrapper-* )
|
||||
|
||||
selected_term=$(printf "%s\n" ${terms:t} | fzf)
|
||||
ln -fsr lib/$selected_term $install_path/x-terminal-emulator
|
||||
Loading…
Add table
Add a link
Reference in a new issue