balta2ar / brotab

Control your browser's tabs from the command line
MIT License
389 stars 27 forks source link

Activate : any chance to bring the browser to front ? #20

Closed naeloob closed 4 years ago

naeloob commented 4 years ago

It will be perfect if activate, or another new action, would have an option to, after activate the tab, bring the browser to front. The target is to activate and focus the browser.

Could be posible?

Thanks in advance!!

Regards

PD : I think it's possible with this api chrome.windows.update(integer windowId, object updateInfo, function callback) with updateInfo focused=True... from https://developer.chrome.com/extensions/windows

balta2ar commented 4 years ago

Let clarify your request: focused=True will help activate the new tab withint the browser, but it will not bring browser windows on top. At least that's my understanding, correct me here if I'm wrong. If you're interested in focusing browser window, you'll need some additional dancing moves. On Linux I used xdotool to bring browser window forward. On Windows I think I can use some sort of Win32 API, but I'm fluffy here, I haven't programmed for Windows in more than 10 years, so help is appreciated.

naeloob commented 4 years ago

Well... that's what the Doc says...

boolean | (optional) focused | If true, brings the window to the front; cannot be combined with the state 'minimized'. If false, brings the next window in the z-order to the front; cannot be combined with the state 'fullscreen' or 'maximized'.

naeloob commented 4 years ago

Now i can change and test chrome extension. I will try to make some tests.

naeloob commented 4 years ago

Well, i've make a pull request to introduce the focus parameter. https://github.com/balta2ar/brotab/pull/21

balta2ar commented 4 years ago

can change and test chrome extension. I will try to make some tests

if you could recommend me a way to test chrome/firefox extension code in isolation from the rest of the brotab, that would be awesome. I was trying to write integration tests that would bring up both chrome and firefox instances, but that was very slow and too much of a hassle, so I dropped it. right now I think I should just mock extension behaviour and test python code. but I have no idea howto properly test extension code alone, I'm not a frontend developer.

naeloob commented 4 years ago

Neither me. I never touched browser extensions before. Looking for it i found interesting information on https://stackoverflow.com/questions/2869827/how-to-test-chrome-extensions There they talk about :

They seems useful.

Hope it helps in any way.

balta2ar commented 4 years ago

"--focused" argument is available in 1.2.0. But if you're using chrome, it may take several weeks to finish review process of the new version.