# launches KiTTY in single-instance mode if available.
# otherwise,claunches a URxvt client, starting the URxvt server if necessary.

command -v kitty >/dev/null && exec kitty --single-instance "$@"

urxvtc "$@"; status=$?
test "${status}" -eq 2 && urxvtd -q -o -f && { sleep 1; exec "$0" "$@"; }
exit "${status}"
