If you’ve installed a program for working with specific file types, you might find that Ubuntu‘s file manager Nautilus has no idea about it when you right-click a file and go to Open With, where a list of alternative programs to the default are presented. While in most cases that new app will be found when you choose Other Application… from the context menu, sometimes this isn’t the case.
Back in Gnome 2.x, if the program wasn’t listed, you could choose to add a custom application, which let you specify the command manually. However, this is no longer the case, but there should be another way to rectify this (see also the command-line interface method at the bottom).
In this example, we’ll look at getting Nautilus to recognise PDF Editor (pdfedit) as a viable program when right-clicking PDF documents, since the file manager doesn’t know it exists, and one can no longer just specify pdfedit as a custom command (at least via the GUI).
While you could be forgiven for thinking you’d need to hack a list of applications (for example, ~/.local/share/applications/mimeapps.list), the answer in fact lies in editing the .desktop file of the newly-installed program, and simply inserting three characters into it. Basically, this will allow Nautilus to add it to its context menu (actually, it specifies that the application can be passed a filename, which is what is missing).
All you need is the actual command that runs the program (e.g. pdfedit for PDF Editor), and you should be able to guess the .desktop file’s name (e.g. pdfedit.desktop), and open it for editing with the following command (replacing pdfedit with the appropriate name in your case):
gksudo gedit /usr/share/applications/pdfedit.desktop
(Note that the .desktop files should be in /usr/share/applications, but if not will be in ~/.local/share/applications, so change the path accordingly if you need to. Also, if you cannot correctly guess the .desktop file’s name, you can get the correct name by going to the folder and browsing for it).
[Desktop Entry]
Name=PDF Editor
Comment=PDF Editor
Exec=pdfedit
Icon=/usr/share/pdfedit/icon/pdfedit_logo.png
Type=Application
StartupNotify=false
Terminal=false
Categories=TextTools;Viewer;Graphics;Qt;
Find the Exec= line and you will see the command listed after it. Simply go to the end of the line, hit the spacebar, and add %f, so the line looks like:
Exec=pdfedit %f
(Once again, substitute your command’s name for pdfedit).
Simply save the file when exiting, and you shouldn’t even need to restart Nautilus, let alone log out or totally reboot. You should immediately see the desired program in the list of apps presented in Other Application…, and once you open a file with it, the app should be easily accessible in the list of secondary programs found in Open With.
If you want to make that program the new default for opening the particular filetype, you can now right-click one, choose Properties, go to the Open With tab, click on the app under Recommended Applications, and click the Set as default button.
CLI Method to Change Application & Set Default:
You can easily open a file with another application using the mimeopen command in the terminal. However, if the program isn’t already in the list of recommended applications, you’ll need to make it the default for that filetype first. Simply open a terminal in the folder where the file is and run a command like the following (substituting Recipes.pdf with the appropriate filename and filetype):
mimeopen -d Recipes.pdf
Please choose a default application for files of type application/pdf
1) GIMP Image Editor (gimp)
2) Adobe Reader 9 (AdobeReader)
3) Document Viewer (evince)
4) Other…
use application #4
use command: pdfedit
Simply choose the number that corresponds to Other… (in this case it’s 4), then type the command of the program after use command: (you probably won’t need to specify the path, but if it doesn’t work without it, it should be something like /usr/bin/pdfedit).
After that, you can switch default applications quite easily with the above command, or use the --
ask option to just open the file in the desired app without changing the default (note there is no option to choose Other…, which is why you have to use the -d switch first):
mimeopen --
ask Recipes.pdf
Please choose an application
1) pdfedit (pdfedit-usercreated-2)
2) GIMP Image Editor (gimp)
3) Adobe Reader 9 (AdobeReader)
4) Document Viewer (evince)
use application #
☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻
That’s it – hopefully with either of the methods you’re not cursing Nautilus any more, and have more control of your filetypes than your file manager currently provides.
☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻
Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!
Thanks for this.
As a new-ish Linux dabbler (I’ve used it for a long time, but never in-depth, really) the fact that I couldn’t seem to add programs to ”open with” was really upsetting. One thing I’ll mention is that, as a new user, I have no idea where to even begin to look for my program launchers (or, .exe’s in MS). Would love to see a chart that lays out what = what, moving from MS to Linux?
Thanks again!
Wonderful, now all HD videos run with mplayer by default and do not drop any longer.
u r really genius
Thanks! it worked fine for Adobe Reader!
why on earth was the browse to add another application removed?
Yeah, tell me about it! Since the move to Gnome 3, Nautilus has lost a lot of features and customisability, but slowly they’re coming back (we hope).
Sometimes I would just like to tell the person responsible for decisions like this what I think of it.
Do they even think of their users? They only think about the piece of code that they can delete and have no longer to maintain. In the end gnome will reduce itself to printf(“Hello world”) and they will be happy and nobody will use it – problem solved.
I at least seem to spend less and less time with drivers and linux quirks, as it “just works” (thanks kernel developers, x-org, ubuntu…) but more and more time circumventing stupid design decisions by gnome that are made by lazy devolpers trying to dumb-down Linux.
I agree. I’m tempted to file it as a bug.
I am looking for Ubuntu blog in Google and I found this blog. Thank you…
It worked for me: open folders with puddletag. (Though not the CLI Method, only the one above – maybe, because the filetype that I want to open are folders.) Thanks!
Thanks for this tip
For Fedora 17, I had to add a space then %F, ie it was:
sudo vi /usr/local/share/applications/calibre-gui.desktop
Exec=calibre %F
I think that’s always the case – Ubuntu Genius just overlooked it. As I understand it, it’s because %f will be replaced with an argument, needing a space.
SWEET!! I was able to use your printed info as a template to make my own .desktop and get blender 2.65a to register as a program in ubuntu, thanks!
I managed to add pdfedit in the “open with” list thanks to your help. Thank you!
And how to remove applications from that list? I have multiple instances of Wine in it (yeah, why do I need that again?? anyway)
Great advice above though!
Thanks.
@Leo:
Me, too! I asked at the Mint forums a while back- never got a response…
http://forums.linuxmint.com/viewtopic.php?f=47&t=124088
Anybody here know how to cull the duplicates?
@Tracy:
Have a look in your /home/homefolder/.local/share/application (.local is obviously a hidden folder).
Maybe you make a copy of that folder as a backup and then start deleting stuff – which I guess you will recognize right away as the source of your duplicities. If you then miss something in your open with applications list you still can go back using the copy. ;)
That’s what I found as a solution in the meantime. Good luck.
hey there and thank you for your information – I have definitely picked up something new from right here.
I did however expertise several technical issues using this web site,
since I experienced to reload the website many times previous to I could get it to load properly.
I had been wondering if your web hosting is OK?
Not that I am complaining, but sluggish loading instances times
will very frequently affect your placement in google and can damage your
high-quality score if ads and marketing with Adwords. Well I’m adding this RSS to my e-mail and could look out for a lot more of your respective exciting content. Ensure that you update this again very soon.
[…] and there’s no way to change that. Used to hitting F3 to open up another pane within Nautilus to drag-drop files between two different locations? You’ll learn to open up a new window to do the same thing now. Also, the “Open with” menu item has been removed for directories. Forget about being able to add an entire directory to the VLC playlist directly, that’s wrong. File association is messed up, but it’s been the case for a while now. […]
Great sggestions. Thank you.
Solved My Wine Problem..
Thank You. It worked great with Calibre in Linux Mint.
Agreed; I used this for Calibre as well as its included Ebook-Viewer.
We are a group of volunteers and starting a new scheme in our community.
Your web site provided us with valuable info to work on.
You’ve performed an impressive activity and our entire group shall be grateful to you.
Hi Leo,
Still no answer to this:
http://forums.linuxmint.com/viewtopic.php?f=47&t=124088
I can’t be the only person on the planet with this happening?
Any other thoughts on it that you might reckon will point me in the right direction?
Btw- my files using the “gksudo gedit /usr/share/applications/…” command have “%u” after them already. Not wanting to break anything- what is the difference between that & “%f” ?
Also- I have Evince set to open pdf’s, which is fine if they are saved to the computer. If, however, it’s a pdf I want to open via Firefox, it tries to open with Archive Mounter, for some bizarre reason. I can’t see how to alter this using this work-around?
Hi Tracy, have you had a look in the folder I mentioned above? Maybe you post the output of
ls ~/.local/share/application
here, using a terminal.
My home folder (tracy) contents come up when I use “ls ~/”. If I use “ls ~/.local/share/application”, I get “No such file or directory”. If I click to view hidden files, I can drill through to tracy/.local/share & ls:
tracy@tracy-desktop ~/.local/share $ ls
applications desktop-couch icons totem webkit
audacious desktop-directories mime Trash wineprefixes
deskbar-applet gvfs-metadata rhythmbox vlc
If I use “ls ~/.local/share/application(s)” (plural):
tracy@tracy-desktop ~ $ ls ~/.local/share/applications
mimeapps.list wine-extension-jpe.desktop
mimeinfo.cache wine-extension-jpeg.desktop
secondlife-viewer.desktop wine-extension-jpg.desktop
wine wine-extension-jpm.desktop
wine-extension-accda.desktop wine-extension-jxr.desktop
wine-extension-accdb.desktop wine-extension-kdc.desktop
wine-extension-accdc.desktop wine-extension-lbm.desktop
wine-extension-accde.desktop wine-extension-mad.desktop
wine-extension-accdr.desktop wine-extension-maf.desktop
wine-extension-accdt.desktop wine-extension-mag.desktop
wine-extension-accdu.desktop wine-extension-mam.desktop
wine-extension-acr.desktop wine-extension-maq.desktop
wine-extension-ade.desktop wine-extension-mar.desktop
wine-extension-adn.desktop wine-extension-mas.desktop
wine-extension-adp.desktop wine-extension-mat.desktop
wine-extension-ani.desktop wine-extension-mau.desktop
wine-extension-b3d.desktop wine-extension-mav.desktop
wine-extension-bmp.desktop wine-extension-maw.desktop
wine-extension-cam.desktop wine-extension-mda.desktop
wine-extension-chm.desktop wine-extension-mdb.desktop
wine-extension-clp.desktop wine-extension-mdbhtml.desktop
wine-extension-cr2.desktop wine-extension-mde.desktop
wine-extension-crd.desktop wine-extension-mdn.desktop
wine-extension-crw.desktop wine-extension-mdt.desktop
wine-extension-cur.desktop wine-extension-mdw.desktop
wine-extension-dcm.desktop wine-extension-mng.desktop
wine-extension-dcx.desktop wine-extension-ngg.desktop
wine-extension-dds.desktop wine-extension-nlm.desktop
wine-extension-dib.desktop wine-extension-nol.desktop
wine-extension-djvu.desktop wine-extension-ovisuite.desktop
wine-extension-ecw.desktop wine-extension-pbm.desktop
wine-extension-emf.desktop wine-extension-pcd.desktop
wine-extension-eps.desktop wine-extension-pcx.desktop
wine-extension-exr.desktop wine-extension-pgm.desktop
wine-extension-ezconfig.desktop wine-extension-pic.desktop
wine-extension-ezhex.desktop wine-extension-png.desktop
wine-extension-eztut.desktop wine-extension-ppm.desktop
wine-extension-eztutor.desktop wine-extension-psd.desktop
wine-extension-ezup.desktop wine-extension-ps.desktop
wine-extension-ezupgrade.desktop wine-extension-psp.desktop
wine-extension-fpx.desktop wine-extension-ras.desktop
wine-extension-fsh.desktop wine-extension-raw.desktop
wine-extension-g3.desktop wine-extension-rels.desktop
wine-extension-gif.desktop wine-extension-rgb.desktop
wine-extension-gsm.desktop wine-extension-rle.desktop
wine-extension-hcu.desktop wine-extension-rtf.desktop
wine-extension-hdp.desktop wine-extension-sff.desktop
wine-extension-hfw.desktop wine-extension-sfw.desktop
wine-extension-hlp.desktop wine-extension-sgi.desktop
wine-extension-hol.desktop wine-extension-sid.desktop
wine-extension-htm.desktop wine-extension-sun.desktop
wine-extension-html.desktop wine-extension-tga.desktop
wine-extension-icl.desktop wine-extension-tif.desktop
wine-extension-ico.desktop wine-extension-tiff.desktop
wine-extension-iff.desktop wine-extension-tlc.desktop
wine-extension-ima.desktop wine-extension-txt.desktop
wine-extension-img.desktop wine-extension-wbmp.desktop
wine-extension-ini.desktop wine-extension-wdp.desktop
wine-extension-iw44.desktop wine-extension-webp.desktop
wine-extension-j2k.desktop wine-extension-wizhtml.desktop
wine-extension-jfif.desktop wine-extension-wmf.desktop
wine-extension-jls.desktop wine-extension-wri.desktop
wine-extension-jng.desktop wine-extension-xbm.desktop
wine-extension-jp2.desktop wine-extension-xml.desktop
wine-extension-jpc.desktop wine-extension-xpm.desktop
tracy@tracy-desktop ~ $
Is this correct or is something amiss?
well, this looks at least as the source of your
65 instances of Irfanview
34 Microsoft Office Access
wine seems to have created a seperate entry for every file type these programs can handle (MIME types).
I would recommend you to delete all these entries that clutter up your “open with” dialogue (make a copy of that folder though, so you can go back just in case) and open such files by first running the specific program and directing it to the files you want to open.
Alternatively, you could work out a “clean” solution, where there is only one entry of Irfanview and MS Access resp., but that can handle all MIME types, have a look here:
https://developer.gnome.org/integration-guide/stable/desktop-files.html.en
and here:
https://developer.gnome.org/integration-guide/stable/mime.html.en
Hope that helps.
Hi genius!! I used to switch between totem or nautilus depending on if what I wanted was to browse files or just to play the hole folder in Ubuntu 12.04. Despite your entry here, I’ve not been capable of doing so in Ubuntu 13.04. Would you give me another clue on that? Thanks in advance!
The new version of Nautilus has unfortunately done away with “Open with” for folders (among other things!!). However, there is a way around this: Nautilus Actions. Once installed, you can use the Nautilus-Actions Configuration Tool to define your own actions. While I will be doing a couple of step-by-step articles very soon (so stay tuned, or subscribe to this blog), featuring a couple of my favourites – “Open with Image Viewer”, and also “Open in New Window” (the basic function of being able to open multiple selected folders in their own windows has also been removed!), here is a quick guide on what to do. In the Nautilus-Actions Configuration Tool, click the Define a new action button and name that action to what you want to appear in the menu (eg: Open with Totem or Open with Movie Player). Making sure that is selected in the left-pane, in the right-pane you will see a bunch of tabs, and it is the second – Command – where you define what that menu option will do. For the Path: enter totem or the full path (/usr/bin/totem), for Parameters: enter %b (for first basename), and finally for Working directory: enter %d (for first base directory). While there are a bunch of other tabs in the tool, that is all you should need to do. You will find your new action in the Nautilus-Actions actions sub-menu in your context menus.
And of course, feel free to vent your frustration at the Nautilus forum or mailing list, as the amount of useful things that have been removed over the last couple of years is staggering. If no one complains, the developer will continue to dumb it down to the point you’ll be thanking your lucky stars that you can still open folders and access files!
That did the trick!! And I’ll write it down: “feel free to vent your frustration at the Nautilus forum or mailing list, as the amount of useful things that have been removed over the last couple of years is staggering. If no one complains, the developer will continue to dumb it down” ;)
Do you mind if I quote a couple of your articles
as long as I provide credit and sources back to your blog?
My blog is in the exact same niche as yours and my visitors would definitely benefit from a lot of the information you
provide here. Please let me know if this ok with you.
Thanks!
Yeah, sure, “ping-backs” are welcome. Cheers.
Way cool! Some extremely valid points! I appreciate you writing this article plus the rest of
the website is very good.
perhaps, somebody know how to do this on wheezy?
THANK YOU. Unbelievable how much other convoluted CRAP there is out there to do something that should be the simplest task. This is great.
Hi, I edited the .deskop file for software (I’ll call it ABC) installed with WINE. A WINE icon now appears in the open list & it works, not ABC. But the problem is, when I click SET AS DEFAULT or even ADD, it does nothing. It does work when I click on the default ubuntu list of programs. Please help, thanks.
Hi. I’m not sure I follow you completely. I understand “Set as Default” doesn’t work for you, and I would have said maybe it’s to do with it being a Windows/WINE app rather than Linux-native, but I have successfully set programs like Adobe Photoshop to open specific filetypes by default. As for “Add”, that should just add that program to the top list of programs (“Recommended Applications”), which are all the ones you see in the “Open With” sub-menu when you right-click a file. So check that ABC hasn’t been added to that list, because come to think of it, you won’t be able to set is as default unless it is in that list. If that’s a bust, I suggest right-clicking a file, choosing Open With > Other Application, and select ABC. Sounds like the same thing, just done another way, but I have found this will work when Properties > Open With doesn’t – your program should then be in “Recommended Applications”, so will show in the Open With menu, and when you go to set is as default via Properties, it should work.
Thank you so much for this. I use Pinta for quick editing of pictures and never could figure out how to get it to show up in the Open With list.
[…] to be a better way. And eventually these rough edges will be removed I expect. But in the meantime: Ubuntu Fix: Add Program to List of Applications in “Open With” When Right-Clicking Files in Naut… and How do I set the default file association in Ubuntu 13.10 Nautilus/Files with Unity to […]
thanks man, the %f did the trick
[…] Eine Lösung fand ich in dieser Anleitung zu PDFEdit […]
An outstanding share! I have just forwardfed this onto a co-worker who was conducting a little research
on this. And he actuaslly ordered mee dinner because I foud iit for him…
lol. So let me reword this…. Thanks for the meal!! But yeah, thanx for
spending the time to talk about this matter here onn your website.
Thanks a lot for the tip. Still (and also) works with Nemo (a fork of Nautilus made by Cinnamon / Mint, which still have the F3 option to open up another pane).
Just had to retrieve the “new” program in the “Other applications”.
Yes, I’ve turned to Nemo since the “improvements” to Nautilus have just gotten ridiculous in the latest version. It’s one thing they keep dumbing it down by removing features, but now in drag and drop you can’t hover over a folder for more than half a second without ending up inside it? Nautilus is becoming unrecognisable, and frustrating to use. Thank goodness for the Nemo team!
Hi Genius! Great site. Hey, thanks for the info but it seems it is way over me. I’ve tried your solution and when I try to right-button open-with a program, it won’t show the required program. Perhaps I’m doing it all wrong? The program is Master PDF Editor and the original .desktop entry is:
[Desktop Entry]
Name=Master PDF Editor
Comment=Edit PDF and XPS files
Exec=/opt/master-pdf-editor/pdfeditor
Path=/opt/master-pdf-editor
Terminal=false
Icon=master-pdf-editor
Type=Application
Categories=Office;Utility;TextEditor
I changed it to:
[Desktop Entry]
Name=Master PDF Editor
Comment=Edit PDF and XPS files
Exec=/opt/master-pdf-editor/pdfeditor %f
Path=/opt/master-pdf-editor
Terminal=false
Icon=master-pdf-editor
Type=Application
Categories=Office;Utility;TextEditor
and I also did the same with both of the locations, /usr/share/applications/ and ~/.local/share/applications to no avail. I’m running Ubuntu 12.04 without Unity and Genome fallback. Any hint on why is no change? Thank you for such great info site!
I think you missed a step:
“You should immediately see the desired program in the list of apps presented in Other Application…, and once you open a file with it, the app should be easily accessible in the list of secondary programs found in Open With.”
Well, it doesn’t hurt to add a new line with:
MimeType=application/pdf
This is a good tip. There is, however, a real problem (which you did address, but did not explain why). Too many people assume that just because you are running Linux, it is on a personal computer that you have control of. THIS IS NOT ALWAYS THE CASE. Please, in the future, consider educating users to use LOCAL customisations, rather than changing the application defaults for the whole system. Linux comes from a heretage of multiuser systems where users do not have superuser access, and STILL allows them to customise their own environment. THIS IS IMPORTANT! We have to get people to realise how a UNIX-like environment really should be used.
OK, while you’re right it isn’t always the case, it’s NEARLY ALWAYS THE CASE – I would assume the VAST MAJORITY of Linux users are home users, and of those that are multi-user most would be families where changing the default app or whatever system-wide wouldn’t be an issue. While more and more businesses and government departments are turning to Linux distros like Ubuntu, Windows is still by far the dominant platform. So rather than over-complicate things for single users, I work on the assumption that any business/department running Linux on its workstations would have already instructed employees not to mess with any settings whatsoever, since they’re there to work, not customise the workstation.
[…] Ubuntu Fix: Add Program to List of Applications in “Open With” When Right-Clicking Files in Naut…. […]
An outstanding share! I have just forwarded this onto a coworker who
was conducting a little homework on this. And he in fact bought me dinner due to
the fact that I discovered it for him… lol.
So allow me to reword this…. Thanks for the meal!!
But yeah, thanx for spending the time to talk about this matter here on your web page.
Hey There. I found your weblog the use of msn. That is an extremely
smartly written article. I’ll be sure to bookmark it and return to learn extra of
your helpful information. Thanks for the post. I will certainly comeback.
[…] Ubuntu Fix: Add Program to List of Applications in “Open With” When Right-Clicking Files in Nau… […]
[…] If you’ve installed a program for working with specific file types, you might find that Ubuntu ‘s file manager Nautilus has no idea about it when you … more… […]
This blog was… how do I say it? Relevant!! Finally I’ve found something that helped me.
Thank you!
[…] [liberamente ispirato a un illuminante articolo di OzzyFrank] […]
For those wary of the commmand line there is an alternative way to solve the problem using alacarte (sudo apt-get install alacarte). Just add an entry for instance in Other menu, then it will be presented by “open with” ….
[…] types, you might find that Ubuntu ‘s file manager Nautilus has no idea about it when you … Download Ubuntu Fix: Add Program to List of Applications in “Open … | […]
Thanks for this post, I got an application working through the right click of nautilus with this information. Very helpful!
I have a related problem. If I want to open a file on internet, it will only allow me to open it in Movieplayer. I first have to download it, go to its file location and then open it. Nautilus does recognize the file type, but apparently the open in internet protocol or whatever doesnt
If it’s on the internet, then you’re using your web browser to access it, so you should be looking at how to set default programs for different file-types within your browser. If using Firefox, you can edit them in Edit > Preferences > Applications. Also, if the dialogue box pops up asking you what you want to do with the file, often (but not always, admittedly) you’re given more choices than the default program via the “Other Application”(or whatever it may be called in your browser) button. But if you’re wanting to open video files within the browser, then that really depends on having the plugins that can handle those specific types of video files. If the latter is the case, Google something relevant like “play avi in firefox browser window plugin” (assuming it’s AVIs you want to play within the browser).
Thank you, it worked. I’ve been looking for a solution to set Blender installed from blender.org as a default program for .blender files.
[…] Ubuntu Fix: Add Program to List of Applications in “Open With” When Right-Clicking Files in Naut…. […]
[…] but add %f after sublime in the Exec field so that you can open it from Nautilus, as described in this post. Also don’t escape spaces for the Icon field and use the full path, no tilde. Replace with […]
[…] More details: Add Program to List of Applications in “Open With” When Right-Clicking Files in Nautilus. […]
Hello,
On Ubuntu, I would like to open a xxx.shoes file using Ruby Shoes, but it is not displayed in the “Open with” list.
I added the following file: /usr/share/applications/shoes.desktop
more /usr/share/applications/shoes.desktop
[Desktop Entry]
Name=Shoes Walkabout
Exec=/home/dassadar/.shoes/walkabout/shoes
StartupNotify=true
Terminal=false
Type=Application
Comment=Ruby Graphical Programming
Icon=/home/dassadar/.shoes/walkabout/static/app-icon.png
Categories=Application;Development;Education;
Can someone advise why it doesn’t work please?
Regards, David
Did you add the %f at the end of the Exec= line as per the guide?
this fixes, thanks!
Cheers for this…pdfshuffler wasn’t in the ‘Open With’…context menu…now sorted :-)
cannot be that you gotta do THIS do register a file type extension! linux is a piece of shit as a desktop os
[…] Eine Lösung fand ich in dieser Anleitung zu PDFEdit […]