w3c / window-management

Window Management API
https://www.w3.org/TR/window-management/
Other
96 stars 25 forks source link

Request to track the "active" screen #17

Closed michaelwasserman closed 2 years ago

michaelwasserman commented 4 years ago

This was brought up in https://github.com/webscreens/screen-enumeration/issues/11

@mrunalk wrote: "I looked at the api and one thing which I found missing is the display in focus or active where user might be typing or has it's mouse pointer in focus. The detail this api provides seems fairly static. Do you plan to add any dynamic properties or that's not the goal of this api?"... "For example, Microsoft's new Surface Neo, https://www.microsoft.com/en-us/surface/devices/surface-neo has two separate screens which fold. If it is folded in other direction only one screen might be visible making that the "active" and other one inactive. Similar state changes could be thought of for other multi-screen or foldable screen devices where 2nd display might turn-off or primary or secondary display readjusts it's resolution. Example for this could be adjustable keyboard on the 2nd screen of Surface Neo. I know it's still too early to talk about such devices but considering this api tries to address new and upcoming use cases I wanted to throw this based on potential use-cases."

There may be value in exposing information about which screen is active, with a couple possible interpretations of "active":

This is worthwhile consideration for future iterations of the proposal, with associated privacy and security implications.

michaelwasserman commented 4 years ago

The additional explorations doc considers ways to check the "current" screen, which is the screen hosting the given execution context, but that may not necessarily be the "active" screen.

michaelwasserman commented 2 years ago

The updated API shape includes a currentScreen attribute, which matches the entry in screens corresponding to window.screen (the screen currently showing the relevant window). Additionally, it's possible to find the entry in screens with the primary attribute set to true, which is the OS/WM primary display. Together, these may reasonably satisfy the original request; feel free to followup if not.