• Sets up clipboard IPC listeners for the main process. Provides secure clipboard write operations from the renderer process.

    Parameters

    • mainWindow: BrowserWindow

      The main Electron browser window instance.

    Returns void

    export function setupClipboardIPC(mainWindow: BrowserWindow) {
    secureHandle<[string]>(
    CLIPBOARD_WRITE_CHANNEL,
    (_event: IpcMainInvokeEvent, text: string) => {
    try {
    if (typeof text !== "string") {
    throw new TypeError("Text must be a string");
    }
    clipboard.writeText(text);
    return { success: true };
    } catch (error) {
    const errorMessage =
    error instanceof Error ? error.message : "Unknown error";
    console.error(
    "[Clipboard IPC] ❌ Failed to write to clipboard:",
    errorMessage,
    );
    throw error;
    }
    },
    mainWindow,
    );
    }