In Electron Framework, Can I access clipboard?

I believe what you are looking for is in the clipboard API.

There is also a global shortcut API. Check out this SO answer where I gave an example of how it works.

Here is an example of some basic read/write operations using the clipboard API:

const {clipboard} = require('electron');
clipboard.writeText('Example String');
let clipboardStr = clipboard.readText();

The 'Example String' is the text you would add to the clipboard.


const {clipboard} = require('electron')
clipboard.writeText('Example String', 'selection')
console.log(clipboard.readText('selection'))

Tags:

Electron