david-tejada / rango

🦎 The cross browser extension that helps you control your browser by voice. It blends in!
MIT License
122 stars 15 forks source link

Create command to focus tab with matching URL #100

Closed david-tejada closed 9 months ago

david-tejada commented 1 year ago

Some people have moved away from using native apps to using web apps when available in order to be able to use Rango. One small issue with this is that there is no way to directly focus one of those web apps. In knausj we have the command open {website} to open one of our custom websites defined in websites.csv. So, for example, I use open talon slack often. The problem is every time I use the command it opens a new tab. It would be nice to have a command that worked like open but that it would focus the open tab if there is already one with the same domain. If there is none it would open the page in a new tab (maybe with the option of making it pinned). This command needs to work globally and not just when the browser is focused.

So, if in my websites I have https://app.slack.com/client/T7FPSMV8F,talon slack and I use the command browse talon slack, one of two things can happen:

There are a couple of issues with this implementation though:

One alternative to handle this second issue is to focus the tab with the same domain but also navigate to the website specified in websites.csv. Maybe this could be a different command, for example something like browse go talon slack. Another alternative is to match the entire address when using browse go, so it no tab matches the entire url it opens a new tab. Afterwards the browse command would prefer the tab that matches the url better.

Since this is going to be a global command we also need a way to know which is the default browser to be able to focus it. It could be stored the first time the user uses a Rango command, and also have a command like rango set default to override that.

david-tejada commented 9 months ago

Having this command be available globally is more difficult than expected. There is no easy way to switch to a given browser or even the default one that works for all OSes. Apart from that to make this work I would have to make the actions to send commands to the extension available globally, which I find a bit messy.

So I have decided to make this command available only when the browser is focused.