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.
Type
SystemMetricstransform?((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.
Type
DesktopHostReturns
metrics: SystemMetrics | null drives renders. metricsRef mirrors it for event and timer callbacks.