Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I seem to switch which browser I am using a lot. I've never found one that works best for everything.
As such I also find myself switching default browswers a lot, because I really hate when I'm browising in one, and then click on a link in another application, like my email client or MY IM client, and then my machine feels the need to open a second (or third) browser. Not to mention this eats up my already limited memory.
Is there a way I can get the system to check and see which browser is currently running and then use that?
If there isn't something like that pre-built anywhere, is there any way I can simply check is program X Y or Z running, and perhaps use that to build some kind of script to write my www-browser on the fly?
I'm not much on scripting, so I can't give you specifics, but most things use xdg-open to determine the default app to launch. You could replace the xdg-open script with your own script.
Probably use a case statement with ps probably, ie, a flow like
Case 1) check ps output for firefox, if found launch
Case 2) check ps output for chrome, if found launch
and so on.
And then a final case if nothing is found, launch a specified browser.
EDIT: Just to be clear, you probably don't want to replace the whole xdg-open script, just modify the section pertaining to setting the browser variable.
This worked great when I just had the first two, epiphany and iceweasel, expect when using iceape mail it continued to open with iceape browser even though I would have assumed it would have opened with epiphany or iceweasel if either were already running. This may be an issue within Iceape? (iceape is Debian's unbranded version of Mozilla Seamonkey AKA Netscape Suite) FYI Iceape is my normal default browser
When I added elinks, it worked fine if I was in terminal and already had an instance of elinks running in a different window
i.e.
Code:
xdg-open http://www.google.com
opened Google.com within the elinks browser, although within in a new tab of the current terminal window, instead of a new tab within the current instance of elinks as I had hoped. However if I clicked a hyperlink within another application, such as Icedove or Pidgin, nothing happened at all if elinks was already running, and iceweasel and epiphany were not.
For some reason the iceape one only worked when i wrote it the way i did and not when I wrote the whole string /usr/lib/iceape/iceape-bin
Any insight on getting it to work better with elinks, and getting iceape mail to use a different browser if its already running would be appreciated. Of course if I'm going about this all wrong, any insight on that would be appreciative as well.
Ok, so I found out that you can control remote instance of elinks with the command
Code:
elinks -remote
As such I replaced
Code:
exec /usr/bin/elinks ${URL:+"URL"}
With
Code:
exec elinks -remote ${URL:+"URL"}
It does what I'd expect it to do that is opens the hyperlink from another program in a new tab within a running instance of elinks, assuming elinks is already running, however I didn't realize that it worked at first. This is because the focus was not automatically changed to the terminal window in which elinks was running. The others, do always switch, but I think we're going to after to ad some other snippet of code to get it to change focus as well.
Nope, no error messages, just isn't doing anything.
So if I have my sensible-browser file set up like that and I click a link in another application, now the hyperlink turns colors, but when I click on the LXTERM that elinks is running in, nothing has changed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.