BiglyBT icon indicating copy to clipboard operation
BiglyBT copied to clipboard

Keep web browser front focus when clicking on Torrent link or Magnet link (stop BiglyBT from taking front focus)

Open Stepcraft opened this issue 3 years ago • 8 comments

I've tried everything I can think of, and I can't stop BiglyBT from taking the front focus when clicking a Torrent link or Magnet link from my browser. I don't want BiglyBT to take over, and pop to the front. I want to keep my browser in front.

I have tried combinations of the following preference settings with no luck (tried both checked and unchecked):

Options/Alerts Show the main window when a download is added by another application (currently unchecked) Reduce situations where the main window is automatically shown (currently checked) Options/Files When opening a torrent, show options dialog: never again (currently set to "never again") Options/Interface/Display Suppress File Download popup dialog (currently checked)

Am I missing something? Or is it impossible to keep BiglyBT from taking the front focus? Maybe it's a MacOS thing?

Thanks for the help!

My specs: iMac 27" / 128 GB / 3.6 GHz 10-Core Intel Core i9 / macOS 11.6.2 (20G314) Java 1.8.0_321 (64 bit) / BiglyBT B3.0.0.0/4 az3

Stepcraft avatar Mar 27 '22 20:03 Stepcraft

I think you've got all the possible options there. On Windows they work as expected so it is likely that it is an OSX thing :(

parg avatar Mar 28 '22 08:03 parg

That's a bummer! :(

Stepcraft avatar Mar 30 '22 03:03 Stepcraft

Actually I've been lazy - I can see the issue on older OSX versions - I'll add a fix for the next beta, let you know when it is available.

parg avatar Mar 30 '22 12:03 parg

Double actually I got ahead of myself. I fixed it for the non-OSX case but unfortunately OSX uses a different mechanism for passing the "open document" request to BiglyBT and I can't see a way of preventing the window from being activated.

I could possibly detect the activation and immediately de-activate the window, bit annoying though.

Also, if you have BiglyBT minimised then only the menu bar becomes active which is slightly less bothersome that the whole app doing so.

parg avatar Mar 30 '22 15:03 parg

My fiddling did expose an issue (on my machine at least) with adding a torrent when BiglyBT was minimized (and the "add torrent options dialog is enabled). When BiglyBT was made visible the dialog wasn't visible until you manually clicked on BiglyBT and moved the main window. Then it magically appeared. So it appeared that the torrent hadn't been added and if you attempted to re-add the torrent now BiglyBT was visible it still wouldn't add due to the fact that there was a torrent-options dialog for it already there (but invisible)...

This is fixed in the latest beta - 3001_B09.

parg avatar Mar 31 '22 11:03 parg

@parg Thanks for trying! I'm glad you stumbled onto the other issue and were able to fixed it. So your effort was worth it. :) And just to be clear, your statement "OSX uses a different mechanism for passing the "open document" request to BiglyBT and I can't see a way of preventing the window from being activated." This means there is no way to fix the front focus issue for MacOS, correct? And yes, when I click a torrent link and have the BiglyBT torrent window minimized, it does still give the focus to BiglyBT by showing BiglyBT in the menu bar. And you are right, this is less bothersome because the BiglyBT torrent window does not pop and cover my browser window.

Stepcraft avatar Mar 31 '22 22:03 Stepcraft

With Windows + Linux when you click on a magnet or .torrent file a new instance of BiglyBT is started (a very lightweight version!). This connects to the "real" BiglyBT" process via a TCP connection and sends the details (magnet URI or torrent file location). The real BiglyBT then decodes the parameters and is control of how the UI reacts to them - i.e. it can decide not to bring the BiglyBT window to the front if the user has configured things that way.

On OSX an "OpenDocument" event is sent directly to the BiglyBT process by the OS. This is handled by the SWT UI library that BiglyBT uses and before BiglyBT knows anything about the event the library makes BiglyBT the "key application" which activates it. I can't see any way of stopping this apart from perhaps hacking the SWT source to work around it and compiling our own version - something I'm not really happy to consider doing.

parg avatar Apr 01 '22 08:04 parg

Thank you very much for your detailed explanation. Big appreciation to you for all your continued hard work on BiglyBT and your direct communication with the users.

Stepcraft avatar Apr 01 '22 16:04 Stepcraft