qubes-run-terminal 919 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. # Try to find a terminal emulator that's installed and run it.
  3. is_command() {
  4. # bogus warning from ShellCheck < 0.5.0
  5. # shellcheck disable=SC2039
  6. type "$1" >/dev/null 2>&1
  7. }
  8. if is_command x-terminal-emulator; then
  9. exec x-terminal-emulator
  10. fi
  11. if is_command gnome-terminal; then
  12. # Check if our gnome-terminal version supports --wait
  13. # (we can't just run it and check exit code, because if it works, it will
  14. # return the exit code of the child process)
  15. if gnome-terminal --help-terminal-options | grep --silent -- --wait; then
  16. exec gnome-terminal --wait
  17. else
  18. exec gnome-terminal
  19. fi
  20. fi
  21. for terminal in xfce4-terminal konsole urxvt rxvt termit terminator Eterm aterm roxterm termite lxterminal mate-terminal terminology st xterm; do
  22. if is_command "$terminal" ; then
  23. exec "$terminal"
  24. fi
  25. done
  26. echo "ERROR: No suitable terminal found." >&2