LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (http://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   How to change mime associations in firefox (http://www.linuxquestions.org/questions/linux-desktop-74/how-to-change-mime-associations-in-firefox-500678/)

gkiagia 11-11-2006 05:07 PM

How to change mime associations in firefox
 
I have a simple problem. When I click on media links in firefox (for example .m3u files or .asx or .ram), firefox offers either to save to disk or to open with xmms or kaffeine.

The problem is that I want all of these links to open with amarok. Selecting open with other is a big waste of time because that stupid GTK open file dialog only allows you to browse through the filesystem to find the executable that you want. In addition, it doesn't remember the executable that you selected last time.

So, how can I change the default firefox file associations? I am using Debian testing with kde 3.5.5 and firefox 2.0.

bigrigdriver 11-11-2006 07:14 PM

Somewhere in the users home directory, there is a hidden file with a .rdf extension that you can edit to change the mime type.

find ~/ -name '*.*' -type f | grep 'mimeType'

Edit the one for FireFox.

gkiagia 11-12-2006 03:41 PM

Thanks. I'll check it out.

jonr 12-02-2006 11:55 AM

Quote:

Originally Posted by bigrigdriver

find ~/ -name '*.*' -type f | grep 'mimeType'

Edit the one for FireFox.

Thanks for this tip; it may provide what I need for the same problem.

In FireFox (I reverted to 1.5 because 2.0 did annoying things I imagine will be fixed later), the function "View and edit actions" under "Edit > Preferences > Download" does not allow just typing in the name of the application I want to open various files. Instead, my only choice seems to be to "browse" to the application--and that takes literally more than a minute for each line I want to change, as the program labors through the entire /usr/bin (or other) directory before displaying its contents.

Am I missing something? I could just type in the name of the application I want to use in a couple of seconds. When there are lots of lines to change, the method provided is simply out of the question.

I'll look into editing the .rdf file -- but there is a list of about six or seven of them, and I'm not sure which to choose; and as searching reveals this to be a very common problem, I'd think requiring manual editing of a (to most users) obscure file is not the way to enhance Firefox's popularity.

Thanks again for the tip.

gkiagia 12-02-2006 01:00 PM

Quote:

Originally Posted by jonr
Thanks for this tip; it may provide what I need for the same problem.

In FireFox (I reverted to 1.5 because 2.0 did annoying things I imagine will be fixed later), the function "View and edit actions" under "Edit > Preferences > Download" does not allow just typing in the name of the application I want to open various files. Instead, my only choice seems to be to "browse" to the application--and that takes literally more than a minute for each line I want to change, as the program labors through the entire /usr/bin (or other) directory before displaying its contents.

Am I missing something? I could just type in the name of the application I want to use in a couple of seconds. When there are lots of lines to change, the method provided is simply out of the question.

I'll look into editing the .rdf file -- but there is a list of about six or seven of them, and I'm not sure which to choose; and as searching reveals this to be a very common problem, I'd think requiring manual editing of a (to most users) obscure file is not the way to enhance Firefox's popularity.

Thanks again for the tip.

The inability to type in the application name is a stupid "feature" of the GTK libraries. Firefox unfortunately uses the GTK libraries and it inherits this behaviour.

GTK and GNOME developers, however, think that having a typing field on the open/save dialog "confuses" the users and they don't implement it because they want GNOME to be "easy to use" (?!)...

craigevil 12-02-2006 01:15 PM

You can change the way the file picker looks.

In about:config change : ui.allow_platform_file_picker to false

or add the following to use.js, this only works with 2.0
/* Get rid of the ugly file picker */
user_pref("ui.allow_platform_file_picker", false);

See my settings for more useful tweaks:
http://www.geocities.com/reverendsky....0settings.txt

If you are using plugins like totem-plugin, kaffeiene-plugin, mplayerplug-in, plugger or mozplugger you need to edit the config files for that particular plugin to point it toward the media player of your choice.

jonr 12-02-2006 01:33 PM

gkiaga wrote:
Quote:

The inability to type in the application name is a stupid "feature" of the GTK libraries. Firefox unfortunately uses the GTK libraries and it inherits this behaviour.
Aha! I'm glad to know that; Firefox developers are not entirely to blame, then. It's just another example of the dumbing-down of things that actually makes them more difficult, not less. Sigh.

craigevil, thanks for your link. I'm going to look at your settings now.

Edited P.S.: The about:config change wasn't possible for me because there is no reference to "file_picker" in it... Maybe that's only on v. 2.0 also.

craigevil 12-03-2006 05:05 AM

Getting rid of the ugly file picker, in Firefox 1.5 is a little more complicated, but still possible:

Konquefox - Extension and tricks for a better integration of Firefox into Linux and KDE
Quote:

Firefox 1.5 : It's a little bit more complex !

Look for a file named nsFilePicker.js in the "components" folder of your firefox installation (usually in /usr/lib/firefox/components/ or /usr/lib/mozilla-firefox/components/). Open it with your favorite text editor (you'll probably need administrator rights), then localize the following lines :

function (compMgr, fileSpec, location, type)
{
debug("registering (all right -- a JavaScript module!)");
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);

compMgr.registerFactoryLocation(FILEPICKER_CID,
"FilePicker JS Component",
//@line 278 "/builds/tinderbox/Fx-Mozilla1.8.0....
"",
//@line 280 "/builds/tinderbox/Fx-Mozilla1.8.0....
fileSpec,
location,
type);
}

and replace the previous red line with this green one :

function (compMgr, fileSpec, location, type)
{
debug("registering (all right -- a JavaScript module!)");
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);

compMgr.registerFactoryLocation(FILEPICKER_CID,
"FilePicker JS Component",
//@line 278 "/builds/tinderbox/Fx-Mozilla1.8.0....
FILEPICKER_CONTRACTID,
//@line 280 "/builds/tinderbox/Fx-Mozilla1.8.0....
fileSpec,
location,
type);
}

Important : to make this change take effect, you need to reset Firefox's chrome registry, which you can do by installing or disabling an extension, then restarting Firefox. Now, when you need to open or save a file, it should come up with the KDE/Qt style dialog, rather than the default GTK file dialogs.

jonr 12-03-2006 02:17 PM

Get rid of GTK 's use-crippling dialog
 
Quote:

Originally Posted by craigevil
Getting rid of the ugly file picker, in Firefox 1.5 is a little more complicated, but still possible:

craigevil, thanks for your research and helpful suggestion. Isn't it a shame it's necessary to jump through these hoops just to use a decent user interface? (I'm retired and I still feel it's a waste of my time to have to put up with these things.)

As soon as I can, I'll test this implementation and post back with results. I expect it to work if I carefully follow the instructions. Being red/green colorblind, I had a little trouble with the lines involved, but I did find them and marked them on a printout -- in blue! :)

Should be back in a couple of days or less with what works/didn't work for me.

P. S. I spent two hours AGAIN just getting sound working in the browser. I'm perpetually losing sound in this application or that; sometimes ESD is the cause, and sometimes it's the answer. The great crippling problem in Open Source is the (understandable) lack of coordination among developers. Oh, well, it's still better than you-know-what.

gkiagia 12-04-2006 03:37 AM

Quote:

Originally Posted by craigevil
You can change the way the file picker looks.

In about:config change : ui.allow_platform_file_picker to false

or add the following to use.js, this only works with 2.0
/* Get rid of the ugly file picker */
user_pref("ui.allow_platform_file_picker", false);

Wow! This trick is awesome. I finally got rid of the stupid GTK open/save dialog.

Thanks craigevil.

jonr 12-04-2006 11:04 AM

Quote:

Originally Posted by gkiagia
Wow! This trick is awesome. I finally got rid of the stupid GTK open/save dialog.

Thanks craigevil.

Now I'm really eager to do this. Maybe today or tomorrow.

I wonder if Mozilla could be persuaded to go back to the sensible way. (By somebody tough-skinned enough to suggest it to them.) :rolleyes:

noranthon 12-07-2006 08:33 AM

I have just posted this link to another thread asking the same question.


All times are GMT -5. The time now is 06:11 AM.