You are not logged in.
Hello,
Holding down CTRL and clicking on a URL in Terminator causes Firefox to open up (or open a new tab) with that URL loaded.
How do I change this behaviour to load some other browser (elinks in another terminator window, say) instead of Firefox?
I find that (usually) on occasions when I'm dealing with URLs in a terminal, the last thing I want popping up is Firefox, sucking the life out of my semi-old PC.
The terminator_config man page does not have anything on this matter, and a rudimentary search on the forums for "terminator click hyperlink|URL" revealed nothing.
Last edited by karthik (2009-04-28 05:48:36)
Offline
it's based on the default browser for your system I'm afraid, so changing it will make clicking on ANY link outside of a browser load up in the browser you set. (Obv clicking a link inside firefox will always open in Firefox 
I forget the command I'm afraid, but it's something like "sudo update-alternatives --config x-www-browser" or something.
Ex-KDE user.
Collects old PC's (Coz he can't afford new ones =P)
Crunchbang @ Distrowatch
My Blog (updated infrequently, and on the #! Planet too.)
Offline
I think Terminator is just calling xdg-open to launch the URL. xdg-open doesn't have much (any?) configuration available. As such I think that to change the browser used by Terminator you'd have to change the default browser:
sudo update-alternatives --config x-www-browserJinx! almost to the second, with the same answer no less.
Last edited by fhsm (2009-04-26 21:02:18)
FHSM: avoid vowels and exotic consonants and you'll get your handle every time. identi.ca
Offline
Beat you by a second fhsm!! And I got the command right as a long-distance recall!!! 
Ex-KDE user.
Collects old PC's (Coz he can't afford new ones =P)
Crunchbang @ Distrowatch
My Blog (updated infrequently, and on the #! Planet too.)
Offline
Beat you by a second fhsm!! And I got the command right as a long-distance recall!!!
It is true, I spent that second making a esoteric reference to terminator's internal workings.
FHSM: avoid vowels and exotic consonants and you'll get your handle every time. identi.ca
Offline
Thank you, mehall, fhsm.
Trying to run update-alternatives gives:
There are 2 alternatives which provide `x-www-browser'.
Selection Alternative
-----------------------------------------------
+ 1 /usr/bin/dillo
* 2 /usr/bin/firefox-3.0
Press enter to keep the default[*], or type selection number: Neither of which suit my purpose. I want it to run
terminator --command elinks %when a link is clicked. I could make a short script with the above command, but how do I get update-alternatives to recognize this as one of the x-www-browser alternatives?
Offline
not sure how to make it recognize it, but I can tell you why it doesn't, elinks is a terminal program not X. Your updateing the preferred X browser so it doesn't show up. Hopefully that helps you get pointed in the right direction.
I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.
Offline
I would look for a extremally lightweight X program, I'm sure there's some around here. I can't seem to remember the name of one for my life though. 
Offline
Dillo is the most lightweight X based browser there is- next only to "links2 -g", I guess. Nevertheless, navigating through Dillo is a real chore- I find elinks to be far more keyboard friendly and advanced.
Reading the xdg-open (which as mentioned above, is what terminator uses to open URLs) man page did not provide any answers either.
Offline
Reading the xdg-open (which as mentioned above, is what terminator uses to open URLs) man page did not provide any answers either.
I don't think xdg-open is the place to start trying to solve your problem. It's only important because it shows that terminator really wants to launch an x app in response to a url click. Terminator (terminatorterm.py) uses xgd-open to open URLs. I don't think xdg-open can be configured. So your first option is to hack xdg-open out of terminator and replace it with custom url handling. If you really know what you are doing this may get you better results in the end, but it takes you totally off the reservation with terminator moving forward.
The second option is to work with xdg-open's behavior. xdg-open is going to look to see what you have set for x-www-browser and launch that with the url terminator passes. The x-www-browser alternative is a sym links in /etc/alternatives set by update-alternatives (which is a perl script in sbin if you want look under the covers). This has to be an x application so no matter what you do I don't think you can set elinks as your x-www-browser directly. Instead you are going to need to get at elinks via a shell script that runs elinks in a new emulator window. Something as simple as the following should get the job done:
#!/bin/sh
terminator --command="elinks $1"To get xdg-open to do what you want, you need to do is register elinks/launcher script as a the x-www-browser alternative. I've never added an alternative manual, but I can think of a couple of possibilities for getting elinks listed as the x-www-browser:
1)You could manually set the symlink. I don't know how update-alternatives "manages" /etc/alternatives, the script might respond poorly to having you go behind its back, but it may not.
2) You could try using update-alternatives --set. Maybe you can make elinks the x-www-browser even though it's not on the list.
3) You can try adding it to the list. Doing so on the cli is involved however you can use the galternatives gui for it. If you want to try and add it from the cli you can read about it here or here (bottom of the page).
The downsides to this second sort of solution is that you'll spawn a new emulator window for each link and that your system wide default browser will now be elinks running in an emulator.
As an aside you have a non-x browser alternative (www-browser) that can be set. Mine is elinks by default. You can check this with sudo update-alternatives --config www-browser , note the lack of an x in front of www-browser. This point is really academic as xdg-open isn't going to look at this option.
Bottom line: I'd see two options, hacking terminator to respond to links with something other than xdg-open or registering a shell script that runs elinks in an emulator as the systems x-www-browser.
FHSM: avoid vowels and exotic consonants and you'll get your handle every time. identi.ca
Offline
Update: Karthik suggests a much better script below. Please read the whole thread before attempting.
Composite tutorial: a post with clear instruction on how to combine all of these steps.
My previous post can be treated as helpful background to annotate what's about to happen. I think I've got a solution worked out, here's what you do:
$ touch ~/bin/runelinks
$ gedit ~/bin/runelinksPast the following in:
#!/bin/sh
terminator --command="elinks $1"Then save and close. Now chmod the script so xgd-open can run it:
$ chmod +x ~/bin/runelinks Next manually set the symlink for x-www-browser:
$ sudo rm /etc/alternatives/x-www-browser
$ sudo ln -s $HOME/bin/runelinks /etc/alternatives/x-www-browserYou can undo this change by selecting another browser with:
$ sudo update-alternatives --config x-www-browser When you run that command elinks / runelinks will not show up on the list; however, you can make another selection and the symlink will overwrite correctly.
I guess Openbox, like gnome, stores its own defaults elsewhere instead of using alternatives. This means that most of the applications will still default to firefox or whatever you set with right click > "open with"
It would be much cooler if this opened within the same terminal window but that I think would take hacking up terminator.
Last edited by fhsm (2009-04-28 13:09:00)
FHSM: avoid vowels and exotic consonants and you'll get your handle every time. identi.ca
Offline
Thanks, Fhsm! I have it working now.
I modified your suggested "runelinks" script (great name, by the way!) to the following:
#!/bin/sh
if pgrep "^elinks$"; then
elinks -remote "openURL($*, new-tab)"
else
terminator --command="elinks $*"
fiso I wouldn't have to spawn a new instance of Terminator each time I click on a link.
I followed your instructions to the dot regarding the x-www-browser soft link.
ln -fs ~/bin/runelinks /etc/alternatives/x-www-browser(I had to force ln to replace the existing link.)
Since my www-browser alternative was already set to elinks, I spent all of yesterday trying to change the behaviour of xdg-open and xdg-mime to open links with www-browser- that would have been an elegant solution. Too bad that can't be done.
This is pretty fantastic- Firefox, Flash and Javascript cause all kinds of trouble on my old laptop- I'm now one step further away from bloat.
I really appreciate that you wrote in such detail explaining the problem and the workarounds. You're not cramped for patience or time, I take it. 
Offline
^^ nice work guys! 
Offline
Thanks, Fhsm! I have it working now.
I modified your suggested "runelinks" script (great name, by the way!) to the following:
#!/bin/sh if pgrep "^elinks$"; then elinks -remote "openURL($*, new-tab)" else terminator --command="elinks $*" fiso I wouldn't have to spawn a new instance of Terminator each time I click on a link.
Much better script. Would you mind if I edited your suggestions back into my post above (w/ credit of course) so anyone else who finds this thread and fails to read the whole thing in detail can get the benefits of it? Using tabs was a great idea.
This was a problem worth solving. Particularly once I found that openbox doesn't respect alternatives settings any more than gnome does
. Now with the tabs script it was time well spent.
FHSM: avoid vowels and exotic consonants and you'll get your handle every time. identi.ca
Offline
Would you mind if I edited your suggestions back into my post above (w/ credit of course) so anyone else who finds this thread and fails to read the whole thing in detail can get the benefits of it?
Of course not! Please go ahead. On that note, perhaps the name of this thread ought to be changed to "Choosing a custom x-www-browser alternative" or something like that? Mentioning Terminator in the title is misleading, seeing as the actual problem is with /etc/alternatives.
Offline
Would you mind if I edited your suggestions back into my post above (w/ credit of course) so anyone else who finds this thread and fails to read the whole thing in detail can get the benefits of it?
Of course not! Please go ahead. On that note, perhaps the name of this thread ought to be changed to "Choosing a custom x-www-browser alternative" or something like that? Mentioning Terminator in the title is misleading, seeing as the actual problem is with /etc/alternatives.
While that is true I think the behavior is Terminator specific because not all terminals will use xgd-open to respond to url clicks. Not to mention most people are going to think of the problem in terms of the terminal and not the debian subsystem. All of that said you have the power to edit the original post and change the thread title. Thanks again for bringing up the topic and providing the tabbing script.
Composite tutorial a post with clear instruction on how to combine all of these steps.
FHSM: avoid vowels and exotic consonants and you'll get your handle every time. identi.ca
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.