5

As discussed here, gtk-launch can launch applications either directly or in a terminal window, depending on whether the .desktop file specifies that the application runs in a terminal. It seems to me that this terminal is not the x-terminal-emulator from the alternative system (it doesn't change when I update the alternatives).

Is there a way to specify which terminal emulator gtk-launch should use?

1 Answer 1

2

Doesn't seem to be possible without workaround.

https://askubuntu.com/a/294430

Gtk-launch (a part of gtk) is not related to x-terminal-emulator at all. In my case glib2 2.68.0 (behind gtk-launch) has its terminal choosing logic hardcoded in prepend_terminal_to_vector() in gio/gdesktopappinfo.c.

# Most preferred
gnome-terminal -- APP ARG1 ARG2 ...

# Then
mate-terminal  -x APP ARG1 ARG2 ...
xfce4-terminal -x APP ARG1 ARG2 ...

# After that
tilix       -e APP ARG1 ARG2 ...
konsole     -e APP ARG1 ARG2 ...
nxterm      -e APP ARG1 ARG2 ...
color-xterm -e APP ARG1 ARG2 ...
rxvt        -e APP ARG1 ARG2 ...
dtterm      -e APP ARG1 ARG2 ...

# Last resort
xterm -e APP ARG1 ARG2 ...

A dirty workaround on my machine

I want to invoke alacritty -e ...

1. Create a dummy gnome-terminal (α)

sudo install -vDm755 /dev/null /usr/local/bin/gnome-terminal

2a. If you do NOT have gnome-terminal installed, put the following into α

#!/bin/bash

[ x"$1" = x"--" ] || { exec /usr/bin/gnome-terminal "$@"; exit 0; }

shift

TITLE="$(basename "$1")"
if [ -n "$TITLE" ]; then
  /usr/bin/alacritty -t "$TITLE" -e "$@"
else
  /usr/bin/alacritty             -e "$@"
fi

2b. If you have gnome-terminal installed, put the following into α

#!/bin/bash

[ x"$1" = x"--" ] || exit 1

shift

TITLE="$(basename "$1")"
if [ -n "$TITLE" ]; then
  /usr/bin/alacritty -t "$TITLE" -e "$@"
else
  /usr/bin/alacritty             -e "$@"
fi

askubuntu x-post

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.