sindresorhus / get-windows

Get metadata about the active window and open windows (title, id, bounds, owner, etc)
MIT License
794 stars 164 forks source link

Difference between a full-screen window size and screen resolution #61

Open guillaumemeyer opened 4 years ago

guillaumemeyer commented 4 years ago

The display settings are 2256*1504 on my laptop. But when the active window is full-screen, the activeWin() promise returns the following bounds:

{ x: -7, y: -7, width: 1519, height: 977 }

This is a real difference! Maybe I just missed something...

P.S: this module is exactly what I was looking for, thanks @sindresorhus

sindresorhus commented 4 years ago

What operating system?

albinekb commented 4 years ago

And have you tried this with different fullscreen-apps? Some apps have multiple windows, like photoshop or webstorm IDEs, even though it looks like one window.

guillaumemeyer commented 4 years ago

OK I found the issue. active-win is not an exe, and therefore doesn't have a manifest file to enable the "dpiAware" option. So when using the win32 api, the node-module doesn't take into account the % of zoom defined in Windows display settings.

anis-dr commented 2 years ago

Any solutions for this issue?

sindresorhus commented 2 years ago

It might be possible to make it DPI aware while running: https://github.com/luapower/winapi/blob/master/winapi/dpiaware.lua

Nantris commented 1 week ago

@guillaumemeyer does Electron's Display.scaleFactor possibly help with accounting for this?

https://www.electronjs.org/docs/latest/api/structures/display