Colin
e519c1c629
now i can type mailto:foo@bar.com into firefox urlbar and it opens in aerc in a new terminal
40 lines
937 B
Bash
Executable File
40 lines
937 B
Bash
Executable File
#!/bin/sh
|
|
# xdg-terminal-exec is a proposed XDG extension, with example implementation:
|
|
# - <https://github.com/Vladimir-csp/xdg-terminal-exec>
|
|
#
|
|
# its purpose is to allow any program which needs to launch a terminal to do so
|
|
# in a manner which respects user preferences.
|
|
# it aims to be `xdg-open`, but for opening a terminal.
|
|
#
|
|
# a notable user is glib/gio: <repo:gnome/glib:gio/gdesktopappinfo.c>
|
|
# and by extension, Firefox
|
|
#
|
|
# it's not actually packaged for NixOS, nor Alpine, as of 2023/06/29.
|
|
# this script is just a hackier version. it lets me insert my preferences
|
|
|
|
termargs="$@"
|
|
|
|
try_term() {
|
|
if command -v "$1" > /dev/null
|
|
then
|
|
exec "$1" $termargs
|
|
fi
|
|
}
|
|
|
|
# user preference
|
|
if [ -n "$TERMINAL" ]
|
|
then
|
|
exec "$TERMINAL" $termargs
|
|
fi
|
|
|
|
# hardcoded checks, imprecise order
|
|
try_term kitty
|
|
try_term alacritty
|
|
try_term foot
|
|
try_term st
|
|
try_term gnome-terminal
|
|
try_term konsole
|
|
|
|
# fallback to default
|
|
exec xterm "$termargs"
|