mortenn / BrowserPicker

Smart browser selector for Windows
MIT License
263 stars 17 forks source link

Allow default to match more than hostname #23

Closed stuartleeks closed 3 years ago

stuartleeks commented 3 years ago

I have some sites that I use where matching on the hostname isn't sufficient. For example, with Azure DevOps the URLs are https://dev.azure.com/org1/..., https://dev.azure.com/org2/... and I want to be be able to direct each to a different browser.

Would you be open to a PR that added the ability to match on (for example) the full prefix of the URL rather than suffix match on the hostname? Or maybe regex matches?

mortenn commented 3 years ago

good suggestion - when I made this, I just wanted to keep it real simple to enable as many users as possible to make good use of it :)

I will definitely look into allowing matching the query path for rules, and I may add an "advanced" option to use regex that the user will need to enable. I myself am no stranger to regex, but from memes I gather that most people want as little as possible to do with them ;)

stuartleeks commented 3 years ago

I've got a branch working locally that adds some more options. The existing hostname suffix match still works.

In addition, you can configure the default rule fragment using the following form:

|prefix|https://example.com/test - this would match against https://example.com/test/wibble but not https://example.com/something/else

Regular expressions are also supported:

|regex|your-regex - this would use the your-regex value to match against the full URL. Having implemented this, I've not actually got a good example for when I would use it (yet!)

This is something of a PowerUser implementation currently (as you mentioned, regex is something of an advanced option).

Would love your thoughts on whether this is something you are interested in as a PR?

mortenn commented 3 years ago

I'm happy to look over any and all PRs ^_^

stuartleeks commented 3 years ago

Cool - I don't remember why, but I opted to branch off the work for #25 for this exploration so it probably makes sense to deal with your feedback on that PR first and then submit another PR after that!

stuartleeks commented 3 years ago

And BTW - thanks for this project. I've been considering writing something like this for a while and then someone pointed me at BrowserPicker and I'm happy to say that after a bit testing I found that it is tantalisingly close to what I want 😁

mortenn commented 3 years ago

Closing this one now, as the feature has been merged. I've fixed some issues and done a bit of refactoring since merging.

I may end up doing some more redesign, to get most of the logic into the viewmodel and not have multiple windows to manage, but I will have to think about it.