// Name: Clipboard Monitor
// Description: Detects paste events and logs clipboard contents.
// Author: tayiorbeii
import '@johnlindquist/kit';
// Timeout duration in milliseconds (10 minutes)
const TIMEOUT = 10 * 60 * 1000;
const startTime = Date.now();
/**
* Monitors the clipboard for changes and logs the contents when a paste event is detected.
* If no paste event occurs within the timeout period, the script exits.
*/
const intervalId = setInterval(async () => {
if (Date.now() - startTime > TIMEOUT) {
clearInterval(intervalId);
console.log('Timeout: No paste event detected within 10 minutes.');
exit();
return;
}
const currentClipboard = await clipboard.readText();
if (currentClipboard) {
console.log('Paste event detected!'); console.log('Clipboard contents:', currentClipboard);
clearInterval(intervalId);
exit();
}
}, 1000);