You can do this with Xdg, as described in the ArchLinux Wiki . For GUI applications, the file type can be associated directly with the application using left-click -> Properties -> Open With
. If you want to start xterm using a program, you can associate MimeType with a command to run as follows:
Go to ~/.local/share/applications
. There, add a file that describes how to start the application, and save it as my-application.desktop
or similar:
[Desktop Entry] Encoding=UTF-8 Type=Application NoDisplay=true Name=vim Exec=/usr/bin/xterm -name vim -e /usr/bin/vim MimeType=text/plain
Now you need to edit the defaults.list
file. There, add the entry for MimeType that you want to associate with the new entry:
[Default Applications] text/plain=`my-application.desktop`
After a reboot, thunar should be able to run xterm with vim when you click regular text files.
source share