TransWikia.com

How to open different plain text files (.txt and .tex) with different default applications?

Ask Ubuntu Asked by Pentaquark on November 25, 2020

I would like to open .txt files with Text Editor by default but .tex files with Texmaker. However, if I change the default programme for .tex files to Text Editor by editing the properties of the file, Ubuntu apparently sets this as the default to open ALL plain text files, including .tex files with Text Editor.

Does anyone know how to solve this issue?

I am using Ubuntu 18.04

One Answer

You can try to manually modify the mimeapps.list file which contains all custom file associations.

This file can be found in /home/.local/share/applications or in /home/.config (I'm using Ubuntu 20.04 and the file is in .config; I'm not sure about 18.04 though)

Here is how you can proceed:

  1. Find out the name of the desktop entry for your Texmaker program:

Type in terminal:

ls /usr/share/applications | grep tex

look in the output and find something like: texmaker.desktop

  1. Open the mimeapps.list file with whatever text editor you want, and you will see something like this:
[Default Applications]  
audio/mpeg=vlc.desktop
image/jpeg=qView.desktop

[Added Associations]
audio/ogg=vlc.desktop;celluloid.desktop;

Add this line text/x-tex=texmaker.desktop to the [Default Applications] part, like this for example:

[Default Applications]  
audio/mpeg=vlc.desktop
image/jpeg=qView.desktop
text/x-tex=texmaker.desktop

Save the file and you're done (remember to change texmaker.desktop to the name that you found).

*For reference, the line for txt files will be something like:

text/plain=org.gnome.gedit.desktop

Correct answer by Calico Cat on November 25, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP