You are not logged in.

#1 2010-08-01 02:07:46

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Importing freedesktop file associations into various file managers

I love light FMs that don't rely on HAL (or rather, don't rely on it AND don't make me mess around with XML files to get them working). But file associations in most of them are a pain.

- ROX makes you set up associations one by one
- So does tuxcmd, as far as I can tell
- Emelfm2 comes with assocations, but doesn't pay attention to what you have installed
- XFE is probably the best, it lets you associate various broad types of files (audio, video, etc.) with an application... But unusual filetypes still need to be associated manually.

My thought is: the .desktop files are already there, in /usr/share/applications. Can I import associations from those?

ROX I already know can do that, albeit in a kind of crippled fashion, with perl-mime-info. That doesn't seem to work for the other three though.

If I had to guess, I'd say XFE didn't support importing associations, since it makes things the least painful. Tuxcmd I'm not sure about, I'd think it would given that it starts out with all of two associations, generic file and generic directory...

Emelfm2 on the other hand appears to have some way of importing .desktop file info. However, the website is down and Google's cached version won't load, so that's all I know.

Does anyone know more about dealing with .desktop files in the above FMs?

Offline

#2 2010-08-01 03:29:24

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Importing freedesktop file associations into various file managers

You could take a look at mimeo (for opening files) and mimeman (for managing associations).

Mimeman lets you set associations (including defaults) using globbing and regexes so you can avoid most manual work. Mimeo respects associations set by mimeman as well as those in .desktop files. If you can get your file manager to use mimeo for everything then you should be able to get consistent behavior.

Mimeo also supports an arbitrary association list that is based on argument strings rather than mimetypes, which allows it to open e.g. URLs.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2010-08-01 04:05:21

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Importing freedesktop file associations into various file managers

Thank you very much, that looks quite useful! Doesn't look like it can import the default assocations en masse though? Or am I missing something obvious?

Offline

#4 2010-08-01 04:21:20

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Importing freedesktop file associations into various file managers

It scans the desktop files automatically. wink


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#5 2010-08-01 04:58:41

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Importing freedesktop file associations into various file managers

Awesome! Thank you!

Offline

#6 2010-08-01 05:15:13

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Importing freedesktop file associations into various file managers

Hmm. Maybe I'm just very dense, but the man pages seem quite cryptic to me.

'mimeo foo.rtf' gives me 'error: text/rt', and doesn't open it in any app even though I've got Abiword installed.

It looks like there should be some way to import all the default file associations, but right now I'm not seeing it... neutral Maybe I should try again in the morning.

Last edited by Gullible Jones (2010-08-01 05:15:44)

Offline

#7 2010-08-01 12:43:54

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Importing freedesktop file associations into various file managers

OMG. I am amazed: with pel-file-mimeinfo installed, mc will by default open files with the default viewer, with a single keystroke. Looks like my FM-switching days are over. Thank you devs!

Edit: no wait it just has a lot of file associations by default. Ah well, I can change that.

Last edited by Gullible Jones (2010-08-01 13:03:26)

Offline

Board footer

Powered by FluxBB