You are not logged in.

#1 2009-05-19 21:12:00

Mr.Cat
Member
Registered: 2008-09-27
Posts: 79

Handling default applications in non-gnome-non-kde environments

After switching to openbox (planning awesome in future) I've encountered the following problem.
Some applications (like xarchiver) use xdg-open to open files. For openbox (for non-kde non-gnome non-xfce to be precise) xdg-open uses a web browser (selected from a list of known browsers) to open any given file. I want to modify xdg-open script and override this behavior (so that xdg-open would select the right app), but what is the correct way to do that?

First of all I tried xdg-mime, but it does not identify the right app if it is not registered in .local/share/applications/defaults.list. What I want is an app or a script, which does what pcmanfm does when opening a file. It seems, that it does the following:
1. Get the file mime type with xdg-mime.
2. Search ~/.local/share/applications/defaults.list for the associated app.
3. Search /usr/share/applications/*.desktop for any app which is known to handle this mime (MimeType= array).
4. Search ~/.local/share/applications/*.desktop
5. Do some other magic, I'm not aware of (would be nice to know that in case I'll have to write my own script).
6. Launch the found app or report eror.

Is there a ready-to-use script or app, that does that?
Fortunately that seems to be an easy task for a ruby script. What should I also know if I decide to implement that?

Last edited by Mr.Cat (2009-05-19 21:51:13)

Offline

Board footer

Powered by FluxBB