LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   bash script to set extension association (http://www.linuxquestions.org/questions/programming-9/bash-script-to-set-extension-association-167952/)

vi0lat0r 04-08-2004 09:15 PM

bash script to set extension association
 
What is the code that will set the extension (say .html) to use (say Mozilla) instead of the default (say Konqueror)? I would like to put that script in my .bash_profile script so I wouldn't have to change it back everytime I login :-)

Thanks!

paulsm4 04-08-2004 10:26 PM

Hi -

What program gets activated when you click on a file has nothing to do with your shell (e.g. "bash") and everything to do with your desktop GUI and your choice of "File Explorer" tool.

For example, I have a KDE desktop and use "Konqueror" as both my web browser and File Explorer. I can change file mappings from inside of Konqueror. When I do so, it invokes the executable "/usr/bin/keditfiletype", which in turn updates the MIME types on my machine. This may or may not be what you want to do.

You can find more information here:

http://docs.kde.org/en/HEAD/kdevelop...ents-mime.html

'Hope that helps .. PSM

vi0lat0r 04-09-2004 03:16 PM

Ok that isn't what I was talking about.

When Kopete says I have a new email, I click on it then it opens Konqueror and loads my email inbox. I have to change the default application from Konqueror everytime I login to Mozilla Firefox, and I just wanted to know what the command to do that is, so I can add it to .bash_profile.

Meaning, login, click the new email thing from Kopete, Mozilla Firefox loads my inbox instead of Konqueror (without having to go in and change the default application manually).

So anyone know the command?

vi0lat0r 04-10-2004 01:39 PM

Anyone at all?

paulsm4 04-10-2004 02:37 PM

Your original question was quite vague with respect to:
a) What you were trying to do
b) What you hoped to accomplish

I'm inferring from your subsequent responses that the actual problem is this:

1) You're using Kopete from your desktop

2) You're unhappy with the file associations Kopete is giving you:

When you double-click on something with an .html suffix, you'd prefer
to get "Mozilla" instead of "Konqueror" (for example).

I'm not familiar with Kopete, and I certainly don't know how Kopete manages "file associations". For example, "File Explorer" under Windows lets you manage "file types" directly from the File Explorer GUI (specifically, "Tools, Folder Options, File types"), but the actual associations are stored on a system-wide basis in the Windows registry. As another example, Konqueror also supports "file associations", and also lets you manage these associations from the Konqueror GUI - but it uses the Apache-level "MIME types" mappings (see the URL I forwarded you yesterday for more details).

Under no circumstances can you easily set some environment variable to change these mappings - I think it's extremely unlikely you'll find some "magic command" to insert into your .bash_profile.

Instead, I'd strongly suggest going back and looking closer at "Kopete" and working your way backwards from there.

Good luck - and please let us know what you find!

Eskarel 05-02-2004 11:24 PM

I haven't quite solved this yet myself, but as far as I can tell, the key to this is changing the file association for kde. Kopete is a part of kde and as such it tends to use kde associations.

Rico16135 05-24-2004 07:04 PM

To get Kopete to use Firefox you have to go to the kde control panel -> kde-components -> file associations -> text -> html and move Firefox above Konqueror.

Of course this solution is system-wide, but if you're trying to use Firefox in Kopete, you probably want it that way system-wide. I don't believe however that the writer's of Kopete gave Kopete the option of what browser to bring up. It is a kde project, so they probably relied on KDE's file-extension gui within the control panel.


All times are GMT -5. The time now is 03:12 AM.