Nomnom Pumpernickle Muffins

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

    0.6.0 • Public • Published

    ToDesktop Client Selected Text

    This is the repo for the ToDesktop Selected Text client.

    This is a zero-dependency package for interacting with @todesktop/plugin-selected-text. This package exposes a set of functions for getting 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.

    Usage

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

    import { getSelectedText } from "@todesktop/client-selected-text";
    
    getSelectedText().then((selectedText) => console.log(selectedText));

    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)
    );

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

    import { unregisterShortcut } from "@todesktop/client-selected-text";
    
    unregisterShortcut("F6"); // void

    Architecture

    This package requires the following files:

    • src/index.ts: exposes plugin functionality through strongly-typed, easy-to-use functions.
    • src/generated/plugin.d.ts: automatically generated types from @todesktop/plugin-selected-text's index.ts file.

    Development

    Refer to the root repo for development instructions.

    Keywords

    none

    Install

    npm i @todesktop/client-selected-text

    DownloadsWeekly Downloads

    1

    Version

    0.6.0

    License

    ISC

    Unpacked Size

    9.93 kB

    Total Files

    8

    Last publish

    Collaborators

    • sandeep1995
    • davej
    • isaacaderogba