API reference
petty.fileActions
capability: file-actionspetty.fileActions.register
register(config: FileActionConfig): voidpetty.fileActions.unregister
unregister(id: string): voidTypes referenced
FileActionConfig
interface FileActionConfig {
id: string;
title: string;
categories?: FileCategory[];
matchMultiple?: boolean;
handler: (context: DropContext, done: (result: DropResult) => void) => void;
}FileCategory
type FileCategory =
| "image" | "video" | "audio" | "pdf"
| "sourceCode" | "plainText" | "markdown"
| "archive" | "folder" | "spreadsheet"
| "mixed" | "unknown" | "*";DropContext
interface DropContext {
urls: string[];
category: FileCategory;
modifiers: DropModifier[];
clipboardHint?:
| { type: "text"; value: string }
| { type: "image" }
| { type: "filePath"; value: string };
}DropResult
type DropResult =
| { kind: "success"; message: string }
| { kind: "info"; message: string }
| { kind: "error"; message: string }
| { kind: "cancelled" };DropModifier
type DropModifier = "option" | "shift" | "command" | "control";