Skip to content
filedom
Esc
↑↓navigate↵open⌘Jpreview
On this page

useDesktopMetrics

Subscribes to desktop metrics in state and a ref.

import { useDesktopMetrics } from 'filedom';

const { metrics, metricsRef } = useDesktopMetrics();

Wait for metrics?.calibrated before positioning content. This hook only subscribes; it does not change view settings or reveal the desktop.

Options

PropType
initial?SystemMetrics

Initial value for both metrics and metricsRef.

TypeSystemMetrics
transform?((metrics: SystemMetrics) => SystemMetrics)

Transforms incoming metrics before storing them.

Type((metrics: SystemMetrics) => SystemMetrics)
onMetrics?((metrics: SystemMetrics) => void)

Called after each metrics update, with the transformed value.

Type((metrics: SystemMetrics) => void)
host?DesktopHost

Optional host adapter for tests.

TypeDesktopHost

Returns

metrics: SystemMetrics | null drives renders. metricsRef mirrors it for event and timer callbacks.

Was this page helpful?