-
I'd like to make a best-effort to remember the monitor preferences that a user selects in their settings for a project I'm working on. I'm planning on allowing users to choose between I'm able to iterate over the connected monitors with the
Basically, what attributes are generally the best to persist that I could later use to attempt to try and identify the same monitor the next time my application starts. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Android, Redox and web only support one monitor, so on those you can simply use the primary monitor. macOS doesn't expose it, but has a way to get a unique ID for a monitor (which it uses in comparisons). The monitor support on iOS is very spotty, so I doubt it's possible to get a stable identifier for monitors here. I also can't seem to find any information on the stability of Windows' It might be possible for us to create a unified API over these (uses the exact ID where possible, a best-effort match on iOS and Windows, and falling back to the primary monitor otherwise), though unsure how exactly that would work. |
Beta Was this translation helpful? Give feedback.
winit::platform::*::MonitorHandleExt*::native_id
is somewhat stable on Linux-like platforms.Android, Redox and web only support one monitor, so on those you can simply use the primary monitor.
macOS doesn't expose it, but has a way to get a unique ID for a monitor (which it uses in comparisons).
The monitor support on iOS is very spotty, so I doubt it's possible to get a stable identifier for monitors here.
I also can't seem to find any information on the stability of Windows'
HMONITOR
.It might be possible for us to create a unified API over these (uses the exact ID where possible, a best-effort match on iOS and Windows, and falling back to the primary monitor otherwise), though unsure…