DEV Community

Migsar Navarro
Migsar Navarro

Posted on

Change the default application for Ubuntu's terminal launcher

This is something I has been trying to accomplish for a long time, maybe six months now. I started looking for it, then find a dead end and leave it untouched for a few weeks. This morning I decided it was distracting me enough so I really have to find it. It ended up being simpler than I thought, sadly the answer is not obvious and there are so many misleading pages out there.

About a year ago I bought an amazing laptop, a tuxedo computer with their recommended OS installed, I must say I am quite happy with the laptop, and definitely think it is worth it. It came with Tilix preinstalled as the terminal, which is really nice I must admit, and I would love to explore at some point in the future (no commitment here), but the moment I learned about Alacritty I fell in love with it.

So I am used to Ubuntu's <Primary><Alt>t to open the terminal, and from time to time I use the Open in Terminal from the file explorer and I wanted to properly configure my system, with no overrides or symbolic links to use Alacritty instead of Tilix.

After reading a few StackOverflow answers I learned about dconf, I was able to find where to change the shortcut to trigger the action but not how to change the command that was executed by the action, and I was stuck with that problem for a few weeks. Then at some point I read about:

gsettings list-recursively

If you pass no argument it lists all the keys and values. I didn't think about it initially but my answer ended up coming from here. I saved the output of the command in a text file, opened it in vim and search for tilix.

It was that way that I found this four keys:

org.gnome.desktop.default-applications.terminal exec-arg '-e'
org.gnome.desktop.default-applications.terminal exec 'tilix'
org.cinnamon.desktop.default-applications.terminal exec-arg '-x'
org.cinnamon.desktop.default-applications.terminal exec 'tilix'
Enter fullscreen mode Exit fullscreen mode

What I did was totally empirical, so if someone can shed some light about the related concepts I would really appreciate it. No need to install update-alternatives or to alter my system in any other form, just used gsettings to set these four keys and it worked. Since I've no idea if I needed any argument I just set that empty.

gsettings set org.gnome.desktop.default-applications.terminal exec-arg ""
gsettings set org.gnome.desktop.default-applications.terminal exec "alacritty"
gsettings set org.cinnamon.desktop.default-applications.terminal exec-arg ""
gsettings set org.cinnamon.desktop.default-applications.terminal exec "alacritty"
Enter fullscreen mode Exit fullscreen mode

That's it! It worked like charm! Hope it save you some frustration :)!

Top comments (0)