DesktopMonitor record

Namespace Runic.Platform in Runic.Platform 0.23.0

public sealed record DesktopMonitor : IEquatable<DesktopMonitor>

Inherits or implements IEquatable.

One monitor (a screen or display) of the desktop.

Parameters

Id

The platform's identifier of the monitor; treat it as opaque. It stays the same across restarts where the operating system has a stable one: the display's device path on Windows, its display UUID on macOS and its connector name on Linux. Pass it to DesktopWindow.MoveToMonitorAsync or DesktopWindowOptions.MonitorId.

DisplayName

A name to show, such as the monitor's model, or its connector where the model is unknown.

Remarks

DesktopMonitor.Bounds and DesktopMonitor.WorkArea use the units the platform's windows use for their position and size, so a work area can be passed to DesktopWindow.MoveAsync as it is: physical virtual-screen pixels on Windows, points on macOS and logical pixels on Linux. Every platform measures right and down from the top-left corner of the primary monitor, so a monitor above or left of it has negative coordinates; on macOS before Runic 0.12 they were AppKit's, measured up from the bottom of the primary screen.

Constructors

DesktopMonitor

public DesktopMonitor(string Id, string DisplayName)

One monitor (a screen or display) of the desktop.

Parameters

Id

The platform's identifier of the monitor; treat it as opaque. It stays the same across restarts where the operating system has a stable one: the display's device path on Windows, its display UUID on macOS and its connector name on Linux. Pass it to DesktopWindow.MoveToMonitorAsync or DesktopWindowOptions.MonitorId.

DisplayName

A name to show, such as the monitor's model, or its connector where the model is unknown.

Remarks

DesktopMonitor.Bounds and DesktopMonitor.WorkArea use the units the platform's windows use for their position and size, so a work area can be passed to DesktopWindow.MoveAsync as it is: physical virtual-screen pixels on Windows, points on macOS and logical pixels on Linux. Every platform measures right and down from the top-left corner of the primary monitor, so a monitor above or left of it has negative coordinates; on macOS before Runic 0.12 they were AppKit's, measured up from the bottom of the primary screen.

Properties

Bounds

public DesktopRect Bounds { get; init; }

Gets the whole monitor.

DisplayName

public string DisplayName { get; init; }

A name to show, such as the monitor's model, or its connector where the model is unknown.

Id

public string Id { get; init; }

The platform's identifier of the monitor; treat it as opaque. It stays the same across restarts where the operating system has a stable one: the display's device path on Windows, its display UUID on macOS and its connector name on Linux. Pass it to DesktopWindow.MoveToMonitorAsync or DesktopWindowOptions.MonitorId.

IsPrimary

public bool IsPrimary { get; init; }

Gets whether this is the primary monitor. Wayland has none, so every monitor reports false there.

Scale

public double Scale { get; init; }

Gets the monitor's scale: 1 is 96 DPI on Windows, the backing scale factor on macOS and GDK's scale on Linux.

WorkArea

public DesktopRect WorkArea { get; init; }

Gets the part of the monitor windows normally use: without the taskbar, the Dock and menu bar, or panels.

Remarks

Equals DesktopMonitor.Bounds where the platform does not report one, such as on Wayland.