How to open different plain text files (.txt and .tex) with different default applications?
You can try manually modifying the mimeapps.list
file which contains all custom file associations.
This file can be found in ~/.local/share/applications
or ~/.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:
-
Find the name of the desktop entry for your Texmaker program:
Run this command in a terminal:
ls /usr/share/applications | grep -i tex
Look at the output and find something like:
texmaker.desktop
-
Open the
mimeapps.list
file with a text editor. 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 the following line to the
[Default Applications]
part:text/x-tex=texmaker.desktop
The part would then look like this:
[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