@todesktop/plugin-selected-text
TypeScript icon, indicating that this package has built-in type declarations

0.17.0 • Public • Published

ToDesktop Selected Text

Retrieve the selected text from any application.

Installation

Install @todesktop/client-selected-text in your client-side application using

npm install @todesktop/client-selected-text

Installation of the plugin package is also necessary. Using ToDesktop Builder, navigate to Plugins. Click on the Explore button for "Selected Text" and install the package.

Usage

Gets selected text by synthesizing the keyboard shortcut "CommandOrControl+c" then reading text from the clipboard

getSelectedText

import { getSelectedText } from "@todesktop/client-selected-text";

getSelectedText().then((selectedText) => console.log(selectedText));

registerShortcut

Registers a global shortcut of accelerator. The callback is called with the selected text when the registered shorcut is pressed by the user

Returns true if the shortcut was registered successfully

import { registerShortcut } from "@todesktop/client-selected-text";

const isRegistered = registerShortcut("F6", (selectedText) =>
  console.log(selectedText)
);

unregisterShortcut

Unregisters a global shortcut of accelerator and is equivalent to electron.globalShortcut.unregister

import { unregisterShortcut } from "@todesktop/client-selected-text";

unregisterShortcut("F6"); // void

Readme

Keywords

none

Package Sidebar

Install

npm i @todesktop/plugin-selected-text

Weekly Downloads

5

Version

0.17.0

License

ISC

Unpacked Size

6.79 kB

Total Files

9

Last publish

Collaborators

  • isaacaderogba
  • megahertz
  • davej