useViewOptions
Reads and updates desktop view settings.
import { useViewOptions } from 'filedom';
const { applied, updateViewOptions } = useViewOptions({ iconSize: 96 });
const enlargeIcons = () => updateViewOptions({ iconSize: 128 });
Each change restarts Finder to apply the settings, once metrics are calibrated. On unmount the hook restores the icon size, grid spacing and arrangement it read before its first change. For initial game layout, use useDesktopGameShell instead.
Parameters
useViewOptions(
initial?: ViewOptionsProps,
host?: DesktopHost
)
initial: starting ViewOptionsProps. Later changes to this argument are ignored; call setOptions or updateViewOptions instead.
host: optional host adapter for tests.
ViewOptionsProps has optional iconSize, gridSpacing, gridArrangement, textSize and labelPosition ('bottom' or 'right').
Returns
metrics: current metrics, or null.ready: true once metrics are calibrated.applied: true when the latest request has finished applying. It is also true after a failed attempt.generation: number of requests made; 0 means none.options: requested settings.setOptions(next): replaces settings.updateViewOptions(partial): merges settings.