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'm trying to create a custom "open with" dialog that allows the user to open a file with a not-yet-installed application. In Ubuntu, is it possible to obtain a list of programs that can be used to open a file? I need to find a list of downloadable programs (instead of installed programs) that can open a file, from the command line.

share|improve this question
    
I know this doesn't help, but I really doubt that it is possible as it would require a huge DB of MIME-types. I might be wrong though. –  MiJyn Nov 30 '12 at 17:07
1  
@MiJyn Why wouldn't it be feasible to query a large database of MIME-types? –  Anderson Green Nov 30 '12 at 17:13
add comment

2 Answers

PackageKit allows you to search for applications by mime-type. Sadly, the Ubuntu devs haven't put much effort into integrating PackageKit with Ubuntu by default, but it still works surprisingly well.

First, make sure you've installed the graphical toolkit for PackageKit, gnome-packagekit-tools Install gnome-packagekit-tools.

Then, run gpk-install-mime-type on the command line, followed by a mime-type. For example:

gpk-install-mime-type text/plain

Screenshots:

First gpk-install-mime-type confirmation dialog

Dialog listing applicable packages

share|improve this answer
    
It looks like you posted the same answer to two separate questions: askubuntu.com/questions/224001/… –  Anderson Green Nov 30 '12 at 21:17
1  
I know. I realise they're different questions, but this answer is useful for both of them. I'm not sure what the policy is on copying and pasting like this. –  Flimm Nov 30 '12 at 21:20
    
Here is a relevant discussion relating to this issue: meta.stackoverflow.com/questions/36648/… –  Anderson Green Nov 30 '12 at 21:22
add comment

My guess is you would need to compile the information yourself. You would need to compile the file types and associations with programs in the package manager. A lengthy task, but I'd be happy to help. Sounds like a worth while project. We could even open source the task and get others to help. You can go to my site and send me an email from the contact form.

Other then that known file types are stored internally in most linux distros to a smaller degree. Here is a question that addresses that Where are file associations stored?

share|improve this answer
    
Which package manager are you referring to specifically? –  Anderson Green Nov 30 '12 at 20:09
    
apt-get is the package manager I use and theoretically you could probably set it up to work with other package managers and distros, but it might be more work. –  Goddard Nov 30 '12 at 20:12
    
Here's a relevant question: askubuntu.com/questions/224001/… –  Anderson Green Nov 30 '12 at 20:28
    
There's a program called PackageKit that you can use to obtain a list of programs for a specific mime type: askubuntu.com/a/224022/71277 –  Anderson Green Nov 30 '12 at 21:14
add comment

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.