electron-selected-text
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

Electron Selected Text

Get selected text from any application using Electron's clipboard and robotjs

For Electron 9 and later, this module should only be used in the main process because robotjs is not context aware

Install

$ npm install electron-selected-text

Usage

import { app } from "electron";
import { getSelectedText, registerShortcut } from "electron-selected-text";

const printSelectedText = (selectedText) => {
  console.log(`Selected Text: ${selectedText}`);
};

getSelectedText().then(printSelectedText);

app.whenReady().then(() => {
  const ret = registerShortcut("F6", printSelectedText);

  if (!ret) {
    console.warn("registration failed");
  }
});

Package Sidebar

Install

npm i electron-selected-text

Weekly Downloads

3

Version

1.1.2

License

MIT

Unpacked Size

8.48 kB

Total Files

5

Last publish

Collaborators

  • aabuhijleh