import { exec } from "child_process"; export interface ClipboardSetOptions { /** * Clipboard text to set */ text: string; } /** * Set the system clipboard text */ export async function clipboardSet( options: ClipboardSetOptions ): Promise { return new Promise((resolve, reject) => { // TODO: Fix escape characters in text "" const command = `termux-clipboard-set "${options.text}"`; exec(command, (error, stdout, stderr) => { if (error) { return reject(`Error: ${error.message}`); } if (stderr) { return reject(`Error: ${stderr}`); } return resolve(); }); }); }