---
title: useDesktopRightClick
description: "Calls a handler when a file is right-clicked."
---

```tsx
import { useDesktopRightClick } from 'filedom';

useDesktopRightClick(path, () => flagCell());
```

The handler fires on a right-click, two-finger click or Control-click on the file at `path`. The gesture is consumed, so Finder's context menu does not open.

## Parameters

```ts
useDesktopRightClick(
  path: string | undefined,
  onRightClick?: (() => void)
)
```

`path`: filesystem path to watch. Undefined disables the subscription.

`onRightClick`: optional handler. Omit it to disable the subscription.

## Returns

Nothing (`void`).
