emvaized / open-in-popup-window-extension

This tiny browser extension allows to open any links and images in a popup window
13 stars 2 forks source link

Popup opens on wrong monitor #8

Closed Daki0082 closed 3 days ago

Daki0082 commented 4 days ago

I have two monitors. When Firefox is on the primary monitor, it works just fine, but when Firefox is on the secondary monitor, the popup always opens on the primary monitor

emvaized commented 4 days ago

Thanks for report! Unfortunately, I don't have multi-monitor setup to test.

1) Is your secondary monitor located to the left or to the right of the primary monitor? 2) What happens if you change popup location to "Bottom left" or "Bottom right"?

Daki0082 commented 4 days ago
  1. My Primary monitor is on the right, and my secondary monitor is on the left.

  2. If I change the location to "Bottom left", the popup window opens in the bottom left corner of my primary monitor. If I change it to "Bottom right", the popup window opens on the bottom left side of my primary monitor.

  3. If I change it to "Mouse cursor position" it always opens on the very left side of my primary monitor

emvaized commented 4 days ago

Hm, that's weird. In given setup, at least the "Bottom left" option should work correctly and open on the secondary monitor, as we're just padding 0 as dx coordinate with this setting.

Maybe some window manager on your computer overrides the screen placement and forces new windows to open on primary monitor?

Daki0082 commented 4 days ago

No, I don't have any window manager installed

emvaized commented 4 days ago

Could you try to install this test version and then try again with the "Bottom left" position settings?

I can provide detailed instructions on how to install it if you specify which browser are you using.

UPD: Removed wrong file

Daki0082 commented 4 days ago

I installed it, but I think you sent me the wrong extension. You sent me "Linkover", not "Open in popup window"

emvaized commented 4 days ago

Oops! My bad. Here's the correct archive: test_open_in_popup_window.zip

Here I disabled the code which checks if opened window is going to be rendered off-screen, and shifts it to fit to the screen. I have a suggestion that this code causes wrong behavior on multi-screen setup.

Daki0082 commented 4 days ago

Yes, now it works!

emvaized commented 4 days ago

Does it work with all tested options for popup placement, both "mouse position" and "bottom left/right" corners?

Daki0082 commented 4 days ago

Sorry, I forgot to test the other options.

Only "Mouse cursor position" and "Near mouse cursor" work, the other options still open on the primary monitor

emvaized commented 4 days ago

I see. It's very confusing, as "Top left" and "Bottom left" options just pass 0px as dx coordinate for the new window. And in multi-monitor setup the very left edge of your combined screen space should be considered as dx = 0.

I have no idea why in your case the left side of the secondary monitor is actually considered 0 – which probably means that left side of the secondary monitor is -n px)?

Probably I should create a release with detailed console logging on each open of the popup window, and then we should examine your console output and actual screen coordinates

emvaized commented 4 days ago

Please try this version, and let me know what is the console output with both Bottom left and Mouse position options enabled. test_logging.zip

Let me know if you need help on where to find the console output of the background sript.

Example output screenshot
Daki0082 commented 4 days ago

(The popup windows now open on the primary monitor again when using the mouse options, idk if it's intended or not)

Mouse cursor position:

grafik

Bottom Left:

grafik

emvaized commented 4 days ago

Thanks! As I suggested, your secondary screen is treated as a negative space for some reason. I can't think of a quick solution right now, but I will investigate this problem.

Daki0082 commented 4 days ago

Okay, thank you!

emvaized commented 4 days ago

Could you please open dev tools (Ctrl + Shift + I on Windows), switch to "Console", paste window.screen.availLeft and hit Enter? What will it return when browser is on primary screen, and when it is on a secondary screen?

Daki0082 commented 4 days ago

Primary screen: 0

Secondary screen: -1920

emvaized commented 4 days ago

Okay, thanks! Another test build for you to try: test3.zip

Daki0082 commented 4 days ago

I'll try it tomorrow

Daki0082 commented 4 days ago

I tried it, but the popup windows still open on the primary monitor, no matter which location I choose

emvaized commented 3 days ago

I see. And what does it output in the dev console, if you enable the new "Debug mode" option in the setting?

Daki0082 commented 3 days ago

Mouse Cursor Position:

Sending message to bg script:
Object { mouseX: -1412, mouseY: 889, elementHeight: 16, elementWidth: 163, availHeight: 1032, availWidth: 1920, selectedText: "", availLeft: -1920, type: "shiftClick", nodeName: "A", … }

Bottom Left:

Sending message to bg script:
Object { mouseX: -1386, mouseY: 889, elementHeight: 16, elementWidth: 163, availHeight: 1032, availWidth: 1920, selectedText: "", availLeft: -1920, type: "shiftClick", nodeName: "A", … }

emvaized commented 3 days ago

That's weird... Could you please try this build, and if no option still works, post the output of the background script console with "Debug mode" option enabled (the one which can be accessed on about:debug page by clicking the "Inspect" button?

test4.zip

Daki0082 commented 3 days ago

No option worked, here is the console output:

Mouse Cursor Position: grafik

Bottom Left: grafik

emvaized commented 3 days ago

This is the output when you open popup when browser is on the secondary screen on the left, is it correct?

Daki0082 commented 3 days ago

Yes, that is correct

emvaized commented 3 days ago

Please also share the output from the page developer console, which could be opened by Ctrl+Shift+I on any page (when browser is on the secondary screen)

Daki0082 commented 3 days ago

Mouse Cursor Position: grafik

Bottom Left: grafik

emvaized commented 3 days ago

Okay, then I think this one might work just fine: test5.zip

Daki0082 commented 3 days ago

All the options work, except for top right

emvaized commented 3 days ago

Great! Does it work on both primary and secondary monitors?

Daki0082 commented 3 days ago

Yes, everything works. Only Top Right is broken on secondary monitor

emvaized commented 3 days ago

OK, great! Then I'll fix the "top right" option and release an update with multi-monitor support. Thanks for help with debugging! 👍

Daki0082 commented 3 days ago

Great! You're welcome!

emvaized commented 3 days ago

I just pushed new update v0.3.2 which includes the fix 🎉