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

useDesktopSelection

Tracks selected Finder paths.

import { useDesktopSelection } from 'filedom';

const { selection } = useDesktopSelection();

Parameters

useDesktopSelection(
  onSelectionChange?: ((paths: string[]) => void)
)

onSelectionChange: optional callback that receives the selected paths on each change.

Returns

selection: string[], the current selection, and setSelection(paths). Finder does not allow desktop icons to be selected programmatically, so setSelection only affects Finder windows.

Was this page helpful?