Browsers-software/browsers

Auto-choose browser

Closed this issue ยท 6 comments

GRbit commented

I'm always frustrated when I need to open links with different browsers. This app was a delightful cure for my problem, many thanks to you @liias ! But I would like to push it even further.

I would like this software to be able to automatically choose a browser. As far as I understand it's pretty impossible to trace the app that triggers a link opening call, but there is another way โ€“ we can make a decision based on a URL.

For example, my work is based around atlassian, bitbucket, and some other custom domains, and I want links like this to always open in my work profile. So I'd like to set regex like https://%my_company_name%.atlassian.net and https://bitbucket.org/%_my_company% and point them to my working profile.

Optionally, there could be some "tick" field in the interface saying "always open this link in this profile" or something like this. It's hard to thoroughly describe all the cases for GUI, but for manual config editing, I could imagine this feature will be not so hard.

I see that simplicity is one of the app's goals, so I would like to know if this feature considers being interesting. If not, still thank you for your efforts in writing such a convenient tool.

I also like to extend @GRbit proposal with an optional catch-all default.
This is my use case:
I normally use firefox for everything but i want to use chrome for google meeting because of the virtual background support, so at the moment i have a really stupid script that do this but i like to switch to browsers :-)

I understand is not the purpose that bring life to browsers but i still think could be good feature for broader adoption

oc013 commented

I also have the same use case of separating work from personal with different browsers.

I started reading the source code but it will take me a bit to figure out Rust I think. With inspiration from this conversation, I was able to come up with a simple bash based system for Ubuntu at least: https://github.com/oc013/browser-redirect

Would be cool to see the general idea built into this app.

liias commented

Hey. Glad to see some interest in this feature.

Btw, there is an unstable (as in, it can break in future) config api to configure it already, let me copy the comment from #12 (comment)

In config.json (see โ‹ฎ->About to see configuration path) you can add the rules section.

rules: [
{
    "url_pattern": "https://exact.domain.com"
    "profile": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome#Profile 1"
}
]
  • url_pattern can currently detect only the domain (no wildcards)
  • profile has to be in form of <browser binary path>#<the profile id>

You can find profile names from the cache file (again see the About dialog for cache path) or in that same config file if you have changed order for the browser explicitly.

It would also make sense to add a feature to have a fallback/default if no other rules match.
I think I will collect requirements for sometime until we figure out the best usecases while preserving easy configuration options.

oc013 commented

@liias This is cool, look forward to seeing it able to match against parts of the whole url one day, thank you ๐Ÿ™

liias commented

Some updates on this: with version 0.3.4 I added support for patterns in the rules and also a support for default browser if no rule is matched. You can see some examples on using patterns and setting a default browser at #34

Feel free to try it out, there might be bugs. In future there will be a GUI for this.

liias commented

I will close this for now, as it should fulfill the minimum requirement. Feel free to open new feature request/issue per improvement.