The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type { ContextMenuSource } from "@t3tools/contracts"; |
| 2 | |
| 3 | // Chromium uses no button for keyboard context menus and zero clicks for keyboard activation. |
| 4 | export function contextMenuSourceOf( |
| 5 | event: Pick<MouseEvent, "type" | "button" | "detail">, |
| 6 | ): ContextMenuSource { |
| 7 | return (event.type === "click" ? event.detail === 0 : event.button === -1) ? "keyboard" : "mouse"; |
| 8 | } |