LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Setting default programs (https://www.linuxquestions.org/questions/linux-general-1/setting-default-programs-411476/)

JungleNut 02-04-2006 03:01 AM

Setting default programs
 
Hi, I have been toying with linux for a year or so but have only just started using it on a permanent basis, so I am at the stage where I know just enough about it to be quite dangerous!

My question relates to setting the default programs. I installed FC4 which included Firefox 1.0.7. Since there is no rpm for the latest version of FF I downloaded FF 1.5 as a tar.gz file and installed it into the /opt directory and then created a link on the desktop to it. OK so far.

The problem is that when I click on a link in another application (eg Thunderbird) AND if firefox is not already running, the link will open in FF 1.0.7, but if I have FF 1.5 open the link will open in that.

I have noticed in KDE that if I right click the browser icon in the panel, the command is set to "htmlview %u". I presume this refers to the default program to open links??? Can I change it to "open with" my preferred program like in windoze?

jschiwal 02-04-2006 03:09 AM

I think that you should uninstall the RPM version of Firefox and make sure that the new version is added to your path.
As root: rpm -e firefox

JungleNut 02-04-2006 04:57 AM

OK, I've removed the old version, now how do I add the new one the the path?

jschiwal 02-04-2006 05:24 PM

Add the directory location where the firefox program is at to the PATH variable.
Edit either your $HOME/.bash_profile or $HOME/.profile file.
Check if one of them already exists. Sometimes one will check for the other and source
it if it exists. The .bash_profile is bash specific and what bash checks for first. The .profile file is checked for second if .bash_profile doesn't exist.

These files are run when you log into the computer, not every time a new shell is started. ( Unless you start bash with the "-l" option. )

See if there is a line such as PATH=$PATH:/usr/bin .
If there is, add :<firefox bin directory> to the end of the line. For example, this may mean adding:
":/opt/MozillaFirefox/bin"

Make sure there is a line that says: export PATH
There could be a line that has more export targets after the export command. That would be fine. If none of these lines exist, then add lines like this:
PATH=PATH:/opt/MozillaFirefox/bin
export PATH
(note: your path to add may be different)

One other thing to note. You don't want to add this to the .bashrc file. This is because this file is sourced every time a new shell is opened. So a subshell will have the path variable extended again, once for each time a subshell is run.

There are a couple of things to mention. If there is a link from /usr/bin/firefox to the firefox executable, then you may not need to add the firefox bin directory to your path variable. ( unless you mucked something up earlier, /usr/bin is in your path. ) Also, the link may be to a script rather than to a binary program. If that is the case, then the script will add the firefox library load path automatically. If not, you may need to add the firefox lib directory to the end of the /etc/ld.so.conf file and execute "ldconfig" as root. For the RPM installation, the startup script would change the value of the LD_LIBRARY_PATH instead. If you wanted, you could do the same thing in your .bash_profile script rather than editing /etc/ld.so.conf. This is what you would have to do, for instance, if you had an account on a machine, but not root access.

Code:

## Set LD_LIBRARY_PATH
##
if [ "$LD_LIBRARY_PATH" ]
then
  LD_LIBRARY_PATH=$MOZ_DIST_LIB/plugins:$MOZ_DIST_LIB:$LD_LIBRARY_PATH
else
  LD_LIBRARY_PATH=$MOZ_DIST_LIB/plugins:$MOZ_DIST_LIB
fi
export LD_LIBRARY_PATH


JungleNut 02-05-2006 01:50 AM

Excellent, thank you. I just added :/opt/firefox to the path and it works fine.

And I have learned something today so it is a good day :)

jschiwal 02-05-2006 07:36 AM

Glad I was able to help.


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