7

I want to change the default terminal in the GNOME desktop environment to lilyterm. Here are the instructions that I've found on the internet:

gsettings set org.gnome.desktop.default-applications.terminal exec lilyterm
gsettings set org.gnome.desktop.default-applications.terminal exec-arg ""

But when I'm pressing the shortcut that should run the default terminal, I'm getting:

Windows manager warning: Error on terminal command"(null)". Terminal command is not defined.

Where have I made a mistake?

6 Answers6

14

Have you tried changing it via the Terminal command:

sudo update-alternatives --config x-terminal-emulator

I guess this does not help if the GNOME shortcut is set specifically to gnome-terminal instead of x-terminal-emulator.

marto
  • 1,431
13

Most of the answers here are outdated for today's Gnome software. For Gnome 3.36 there's no easy workaround. The problem lies in the fact that most Gnome software is based on Gio which it decides what terminal emulator to use eventually. Quoting a Gnome developer from gitlab.gnome.org:

The decision which terminal is going to be used by gnome-shell when starting apps that specify that they run in a terminal is made by glib and not gnome-shell and currently in glib there is a hardcoded list of terminals that is being tried).

Hence, looking e.g at Gio's (version 2.76.2) code responsible for this behavior, we can see that Gio has hard coded the tests for several specific terminal emulators' executables search in $PATH. xdg-terminal-exec is tested there first and other terminal emulators are tested further. If xdg-terminal-exec is found in your $PATH, it will be used and there's nothing one can do, besides altering the programs in your $PATH:

# ln -s /usr/bin/lilyterm /usr/bin/xdg-terminal-exec

This also means that the most widely solution to this problem, using gsettings, doesn't work (also proposed here: 1, 2, 3, 4, 5).

2

There are a few options:

  • Try with:

    gsettings set org.gnome.desktop.default-applications.terminal exec 'lilyterm'
    gsettings set org.gnome.desktop.default-applications.terminal exec-arg '-x'
    

    Note: You need to log out and log in again (tested succesfully on GNOME on Ubuntu 13.04).

  • Another possibility is to go to Shortcuts in GNOME Settings and add a new one with lilyterm as command, and set it to Ctrl+Alt+T or anything else you prefer.

  • Another way is to replace gnome-terminal with a symlink that points to lilyterm - but you don't want to do that.

dadexix86
  • 6,776
1

In Ubuntu 25.04 the terminal program GNOME uses is (mostly) controlled by the xdg-terminal-exec program and the configuration of xdg-terminal-exec is described in its man page. Under GNOME, xdg-terminal-exec will pick gnome-terminal by default (because that is what is specified in /usr/share/xdg-terminal-exec/ubuntu-xdg-terminals.list) but the user can override this. In the Ptyxis terminal GUI if you scroll to the bottom of Preferences | Behaviour there is a button "Set as Default Terminal" which does as it says with a slight drawback - when pressing Ctrl+Alt+T it will only start a new terminal if no Ptyxis terminal is running already. To have the behaviour of always opening a new Ptyxis window, edit ~/.config/xdg-terminals.list and add the line org.gnome.Ptyxis.desktop:new-window to the top of the file and save.

Why does xdg-terminal-exec only "mostly" control the default terminal? Because:

  • Files/Nautilus will continue to use gnome-terminal when selecting "Open in Terminal" from its right mouse button menu even when xdg-terminal-exec launches something else because it is the nautilus-extension-gnome-terminal package that is providing that feature
  • If the user sets the org.gnome.desktop.default-applications.terminal dconf key (see the Ubuntu 24.10 instructions below) then xdg-terminal-exec will be cut out of the loop
  • Tools like x-terminal-emulator specify the terminal to use separately via update-alternatives

In the Ubuntu 24.10 package for gnome-settings-daemon an Ubuntu specific patch called media-keys-restore-terminal-keyboard-shortcut-schema.patch is being carried to add media key support for launching a terminal. This patch references the exec entry of the dconf key org.gnome.desktop.default-applications.terminal:

[...]
+static void
+do_terminal_action (GsdMediaKeysManager *manager)
+{
+        GSettings *settings;
+        char *term;
+
+        settings = g_settings_new ("org.gnome.desktop.default-applications.terminal");
+        term = g_settings_get_string (settings, "exec");
+
+        if (term)
+        execute (manager, term, FALSE);
[...]

Running

gsettings set org.gnome.desktop.default-applications.terminal exec "/usr/bin/ptyxis --new-window"

successfully made the terminal media key launch the Pytxis terminal rather than gnome-terminal.

Anon
  • 382
1

I just accidentally bumped into this question and this what worked for me:

  1. Check which terminal is left in your system. I had already removed all "terminal apps" such as xterm etc and chose rxvt-unicode as default terminal.

  2. Then go to Settings → Keyboard Shortcuts and create a custom shortcut. It will do the trick for you.

0

Perhaps you should open the add/edit users dialogue and see if you can change the default terminal there.

Updated: Users & Groups (as admin) > Select User > Advanced Settings > Advanced > Shell

There is a drop down menu, but you can also type out /path/to/your/shell.