Desktop file and terminal emulator issues

Published: Thu, 01 Mar 2018
Modified: Wed, 10 Jun 2020

In: Linux

Tags: terminal

Translations: bs

I've had problems with opening text files with my text editor that's running inside a terminal emulator (Vim) from inside my file manager. Nothing was happening after double clicking a file in my file manager (Nemo).

A lot of time has passed between the time I became aware of that problem and now when I definitely found out why it was happening. Since it's pretty boring and menial, here's the general gist: problem discovery, no idea why it's happening, ugly hacky solution by specifying the terminal emulator to open Vim and the file inside the desktop file, the hacky solution not working because my distribution packaged Vim's desktop file which was overwriting mine, figuring the problem out.

The cleanest hacky solution for someone else's mistake

Turns out that Glib was responsible for it. The problem lies in the fact that Glib hardcodes certain terminal emulators which are used to open the program if the desktop file contains a Terminal=yes line. If none of the hardcoded terminals is available, it fails.

That behaviour is kind of disappointing and there's a bug report, but it doesn't look like it will be resolved soon.

A hopefully temporary solution is to just create a symlink which points gnome-terminal to your terminal emulator.

ln -s YOUR-TERMINAL-EMULATOR /usr/bin/gnome-terminal

Update
This commit added support for xfce4-terminal, which I'm using. Therefore I don't need to apply this fix anymore. If your terminal emulator isn't on the list, then it's still useful.

Let's hope that the Glib people find a way to solve this properly and that they settle for a way which would allow us to reliably set a default terminal emulator system wide.