Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am looking for the specs necessary to build a .desktop file to be used in Ubuntu 11.10.

Many terminal applications or even GUI application do not show on Open with other application tab anymore and I want to create a .desktop file that makes that application be listed on the list again.

I know that you can create a .desktop file and place it in ~/.local/share/applications but I do not know what all those settings mean.

Is there a guide that allows me to customize my .desktop files to my needs?

share|improve this question
    
If you don't need to remember thast association, this script could be handy: github.com/gecos-team/openwith –  Alfonso E.M. Sep 25 '12 at 11:39

2 Answers 2

up vote 28 down vote accepted

An example of a .desktop file to select vim terminal editor for your files in the Open with other application dialog is

[Desktop Entry]
Encoding=UTF-8
Name=Vim Text Editor (Console)
Comment=Edit text files in a console using Vim
Exec=vim %u
Terminal=true
Type=Application
Icon=/usr/share/pixmaps/vim.svg
Categories=Application;Utility;TextEditor;
StartupNotify=true
MimeType=text/plain;
NoDisplay=true

Save this as ~/.local/share/applications/vim.desktop and the application will be automatically shown on Open with other application to be selected as default application.

The options for the .desktop files are many but its important to know what they mean.

nautilus-actions.org supplies a very good guide and explanations for creating your .desktop files and all the possible parameters that you can use on them so if you have any doubts about creating a special .desktop file you can visit the site and look at the examples there.

share|improve this answer
1  
+1. This is what I was looking for Bruno. Thanks. –  Luis Nov 30 '11 at 22:30

When an installed app shows up on the r. click > open with but not on the r. click > properties > open with list it's usually because of the Exec= line in the app's .desktop

Two ways around - Just add the apps .desktop to an appropriate line in the [Default Applications] section of

~/.local/share/applications/mimeapps.list

If the line already exists then you'd just replace the current .desktop with the intended app's .desktop

In the case of .tex the line would be

text/x-tex=

The other solution would be to open the app's .desktop in a text editor and add to the end of the Exec= line a space %letter

Not knowing your app I'd say that either %f or %U are generally ok.

Ex. using gedit to show what i mean

Exec=gedit %U

This will then allow the app to show up in the r. click > properties ... list

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.