Monitor
이 콘텐츠는 아직 번역되지 않았습니다.
Module @netwiv/api/window · Kind Interface
import { Monitor } from '@netwiv/api/window';Allows you to retrieve information about a given monitor.
Members
Section titled “Members”name: string | nullHuman-readable name of the monitor
position
Section titled “position”position: PhysicalPositionthe Top-left corner position of the monitor relative to the larger full screen area, in physical pixels.
Note that window creation options such as x, y, width and height expect
logical pixels, so convert with {@linkcode Monitor.scaleFactor} first:
import { currentMonitor } from '@netwiv/api/window';import { WebviewWindow } from '@netwiv/api/webviewWindow';
const monitor = await currentMonitor();if (monitor) { const position = monitor.position.toLogical(monitor.scaleFactor); const webview = new WebviewWindow('my-label', { x: position.x, y: position.y });}scaleFactor
Section titled “scaleFactor”scaleFactor: numberThe scale factor that can be used to map physical pixels to logical pixels,
e.g. monitor.position.toLogical(monitor.scaleFactor).
size: PhysicalSizeThe monitor’s resolution in physical pixels.
Use {@linkcode Monitor.scaleFactor} to convert to logical pixels:
const logicalSize = monitor.size.toLogical(monitor.scaleFactor);workArea
Section titled “workArea”workArea: { position: PhysicalPosition; size: PhysicalSize; }The monitor’s work area (the monitor area excluding taskbars and docks) in physical pixels.
Use {@linkcode Monitor.scaleFactor} to convert to logical pixels as shown in {@linkcode Monitor.position}.
Upstream since 1.0.0
Descriptions come from the pinned @tauri-apps/api@2.11.1 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.