You are not logged in.
Karthik asked an interesting question over in Help & Support on how to get Terminator to use eLinks instead of Firefox as the default browser when responding to ctrl+click of a hyperlink in the terminal. The original thread provides good background and is well worth reading. After a bit of back and forth I think we've arrived at a good solution. The following is a compost of work by numerous authors on the original thread.
1) Create script to run eLinks as an x application
$ touch ~/bin/runelinks
$ gedit ~/bin/runelinks
Paste the following in (thanks Karthik):
#!/bin/sh
if pgrep "^elinks$"; then
elinks -remote "openURL($*, new-tab)"
else
terminator --command="elinks $*"
fi
Then save and close. Now make the script executable:
$ chmod +x ~/bin/runelinks
2) Manual override the x-www-alternative
$ sudo ln -fs ~/bin/runelinks /etc/alternatives/x-www-browser
That's it.
Explanation
Terminator uses xgd-open to respond to url clicks, more. Xgd-open uses whatever browser is set as the x-www-alternative. The above solution uses the Debian alternatives system but goes around the management script $ update-alternatives by manually setting the link, more and more.
Openbox appears to stores default browsers independent of the alternatives system; as such, overriding x-www-alternatives has a limited scope of effect. Firefox continues to work as the default browser in most GUI settings. But now when ctrl+clicking a link in Terminator the url is opened in eLinks in a new tab.
Undo
This can be reversed at any time with:
$ sudo update-alternatives --config x-www-browser
Many thanks to Karthik, Iggykoopa, and Mehall
Last edited by fhsm (2009-06-22 03:05:23)
Offline
reviving this thread although i'm simply trying to make firefox my default rather than chromium.
$ sudo update-alternatives --display x-www-browser
x-www-browser - auto mode
link currently points to /home/driscoll/bin/firefox/firefox
/home/driscoll/bin/firefox/firefox - priority 150
/usr/bin/chromium-browser - priority 40
Current 'best' version is '/home/driscoll/bin/firefox/firefox'.
as you can see above, firefox is my x-www-browser but when i right-click "open link" in terminator, the link opens in chromium.
is the problem here that firefox is located in my home dir? should i make a symlink somewhere else and point to it?
{{ Eee 1005HA // Eee 1001PX // Thinkpad X131e }}
@desconcentrado
Offline
Hi txtmsg,
if you are using XFCE, you could run
exo-preferred-applications
and check the Browser there.
What happens if you open
x-www-browser
and
xdg-open http://www.crunchbanglinux.org
from terminal?
Sweaty lads picking up the soap | I love the new "Ignore user" button
Offline
thank you for the quick reply! we are definitely getting somewhere!
x-www-browser
...firefox.
xdg-open http://www.crunchbanglinux.org
...chromium.
i use wmii so exo-preferred-applications actually worked. do you happen to know which file or symlinks this program is modifying? i read both the man page and documentation but couldn't find it...
{{ Eee 1005HA // Eee 1001PX // Thinkpad X131e }}
@desconcentrado
Offline
It creates links to ~/.local/share/xfce4/helpers/
you find your custom-WebBrowser.desktop there
Probably you have lines there like
X-XFCE-CommandsWithParameter=/usr/bin/chromium-browser "%s"
X-XFCE-Commands=/usr/bin/chromium-browser "%s"
so you can change them to /usr/bin/firefox "s%"
Sweaty lads picking up the soap | I love the new "Ignore user" button
Offline
rebooted the machine this morning and the behavior has returned. now i am perplexed.
both of these commands open firefox:
$ xdg-open http://crunchbanglinux.org
$ x-www-browser
and this looks correct:
$ cat .local/share/xfce4/helpers/custom-WebBrowser.desktop
[Desktop Entry]
NoDisplay=true
Version=1.0
Encoding=UTF-8
Type=X-XFCE-Helper
X-XFCE-Category=WebBrowser
X-XFCE-CommandsWithParameter=~/bin/firefox/firefox "%s"
Icon=firefox
Name=firefox
X-XFCE-Commands=~/bin/firefox/firefox
yet "open link" in terminator still opens chromium!
{{ Eee 1005HA // Eee 1001PX // Thinkpad X131e }}
@desconcentrado
Offline
if you are using bash, you can append this line in .bashrc
export DE=xfce
Save it. Close terminator, open terminator. Terminator then calls bash, and this sets the right environment for the commands in bash. I guess
Last edited by machinebacon (2011-07-08 20:38:55)
Sweaty lads picking up the soap | I love the new "Ignore user" button
Offline
That didn't work either, unfortunately.
I opened a question over on the Terminator launchpad:
https://answers.launchpad.net/terminato … ion/164208
An old answer suggests that Terminator attempts to open links in the following order:
* xdg-open
* GNOME helper application
* python webbrowser
I'll report back if I figure this out.
Thanks for all the help!
{{ Eee 1005HA // Eee 1001PX // Thinkpad X131e }}
@desconcentrado
Offline
Yes, the problem is even more obvious if we run:
xdg-settings set default-web-browser firefox
because the output is:
xdg-settings: unknown desktop environment
and even though we set the DE=xfce, xdg doesn't accept this.
> env | grep DE
DESKTOP_SESSION=openbox
DE=xfce
*think think*
But something else I would like to ask you:
the section in your .dekstop file
X-XFCE-CommandsWithParameter=~/bin/firefox/firefox "%s"
Icon=firefox
Name=firefox
X-XFCE-Commands=~/bin/firefox/firefox
points to your home/user/bin/firefox/firefox - do you actually have this location? I would change the path to /usr/bin/firefox
Sweaty lads picking up the soap | I love the new "Ignore user" button
Offline
.desktop points to your home/user/bin/firefox/firefox - do you actually have this location? I would change the path to /usr/bin/firefox
Yes. I do have this location but I also have a symlink at /usr/bin/firefox. This is because Firefox 5 wasn't in any repositories yet so I manually installed to ~/bin.
Check this out. For me:
$ env | grep DE
DE=xfce
DESKTOP_SESSION=wmii
$ xdg-settings get default-web-browser
firefox.desktop
For kicks, I purged chromium (which auto installs iceweasel) and, as expected, Terminator "Open Link" now opens iceweasel. (xdg-open still opens ~/bin/firefox/firefox.)
Here is some relevant output:
update-alternatives: using /usr/bin/iceweasel to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode.
Adding 'diversion of /usr/bin/firefox to /usr/bin/firefox.real by iceweasel'
As you can see, my old symlink was moved to "firefox.real".
/usr/bin/firefox is now a shell script that tries to run firefox.real but runs iceweasel if it doesn't have permissions:
#!/bin/bash
FIREFOX="$(which $0)"
[ -x "$FIREFOX.real" ] && exec "$FIREFOX.real" "$@"
exec iceweasel "$@"
I can confirm that this script is called when I run "$ firefox" manually but it doesn't seem to get called when I click "Open Link." Even if I comment out the last line and replace it with "exec leafpad" or something similar, iceweasel still opens. This suggests that there must be something else being called first...
Hm...
PS. This blog post catalogs some common locations for default browser:
http://blog.codef00.com/2011/02/18/the- … x-debacle/
{{ Eee 1005HA // Eee 1001PX // Thinkpad X131e }}
@desconcentrado
Offline
Also, dealing with the "alternatives" system, I created the following symlinks:
# ln -s /usr/bin/firefox /etc/alternatives/x-www-browser
# ln -s /usr/bin/firefox /etc/alternatives/gnome-www-browser
This didn't solve the problem either. o__O
{{ Eee 1005HA // Eee 1001PX // Thinkpad X131e }}
@desconcentrado
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat