webscreens / screen-enumeration

Screen enumeration API explainer
Apache License 2.0
23 stars 4 forks source link

Proposed screen properties may already be exposed via the Web #17

Closed markafoltz closed 4 years ago

markafoltz commented 4 years ago

Screen.dpi: The display density as the number of pixels per inch.

Derived by looking at devicePixelRatio and in CSS, 96px = 1 inch (unless that's changed recently)

Screen.hidden: True if the display is not visible (e.g. closed laptop).

IntersectionObserver?

Screen.subpixelOrder: The order/orientation of this display's subpixels. Screen.interlaced: True if the display's mode is interlaced. Screen.refreshRate: The display's refresh rate in hertz. Screen.overscan: The display's insets within its screen's bounds. Screen.colorDepth and Screen.pixelDepth:

See CSS Media Queries Level 4, particularly the display and color quality sections.

Display HDR support is another dimension, which is being tracked for video output specifically in a long issue on the Media Capabilities API.

In general, I wonder which screen properties are better handled as CSS media queries, versus properties of the Screen; unless there is content that would only work if the Screen has certain properties and knowledge of them is needed to guide window placement.

michaelwasserman commented 4 years ago

Most of the properties listed here are from the "New properties that may be worth considering." section of the explainer, which are not intended for Screen Enumeration V1 without significant additional signals of interest from developers. I wanted that to be a more exhaustive list to help gauge possible interest, shape the possible future surface area of the API, and potentially pursue only if there's sufficient interest. I'll clarify this intent in the explainer, and maybe provide some details about alternate ways to obtain related information. (thanks for the links!)

Still, as you've noted, the aim for providing this type of information with the Screen Enumeration API is to facilitate selection of the appropriate display to inform Window Placement. Relying on window.devicePixelRatio or CSS media queries wouldn't facilitate determination of the optimal screen to host the content before placing the window in a multi-screen environment. For example, a medical application may want to introspect the connected displays, and place a dashboard window on a full color screen, and then show full size x-ray images on another gray-scale screen. I'll make sure this is clear in the explainer.

michaelwasserman commented 4 years ago

Similar to #14 I believe the updated explainer addresses the desire to select screens by their properties. Please let me know if the proposal's language could better explicitly describe that goal, or if there are specific ScreenInfo properties that should be refined.