AnswerBun.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!

Related Questions

Ubuntu functioning as display adapter

0  Asked on January 22, 2021 by richard-boekamp

     

Completely remove openssl dev version

2  Asked on January 21, 2021 by goelakash

         

What replaced mail-stack-delivery?

1  Asked on January 20, 2021 by isagalaev

     

How to run a .sh file in terminal on login

2  Asked on January 19, 2021 by user2662920

       

SFTP Access to multiple directories for different groups

1  Asked on January 19, 2021 by balab

       

Wine post installation errors in Ubuntu 20.04 LTS

1  Asked on January 19, 2021 by muhammad-asraf-ahmed-imon

   

Error in make install: “cannot copy file”

2  Asked on January 19, 2021 by lmbano-ivn-lpez-coello

 

How to disable TLS 1.0, TLS 1.1 on Apache

3  Asked on January 18, 2021 by eranga-kapukotuwa

       

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir