<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[`Workspace`](Workspace) › [on('file-menu')](Workspace/on('file-menu').md)
## Workspace.on('file-menu') method
Triggered when the user opens the context menu on a file.
0.9.12
**Signature:**
```typescript
on(name: 'file-menu', callback: (menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf) => any, ctx?: any): EventRef;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| <code>name</code> | <code>'file-menu'</code> | |
| <code>callback</code> | <code>(menu: </code>[`Menu`](Menu)<code>, file: </code>[`TAbstractFile`](TAbstractFile)<code>, source: string, leaf?: </code>[`WorkspaceLeaf`](WorkspaceLeaf)<code>) => any</code> | |
| <code>ctx</code> | <code>any</code> | _(Optional)_ |
**Returns:**
[`EventRef`](EventRef)