#linux #macos #windows

selection

Get the text selected by the cursor

4 stable releases

1.2.0 May 5, 2024
1.1.1 Dec 23, 2023
1.1.0 Nov 14, 2023
1.0.0 Sep 7, 2023
0.1.0 Sep 7, 2023

#1794 in GUI

Download history 79/week @ 2025-11-05 41/week @ 2025-11-12 82/week @ 2025-11-19 87/week @ 2025-11-26 48/week @ 2025-12-03 22/week @ 2025-12-10 12/week @ 2025-12-17 5/week @ 2025-12-24 43/week @ 2025-12-31 32/week @ 2026-01-07 55/week @ 2026-01-14 29/week @ 2026-01-21 28/week @ 2026-01-28 110/week @ 2026-02-04 47/week @ 2026-02-11 172/week @ 2026-02-18

359 downloads per month

GPL-3.0-only

17KB
310 lines

Selection

Get the text selected by the cursor

Example

selection = "1.2.0"
use selection::get_text;

fn main() {
    // Return the selected text on success
    // Otherwise return the empty string
    let text = get_text();
    println!("{}", text);
}

Support Platform

  • Windows
  • MacOS
  • Linux
    • X11
    • Wayland

Implementation details

Windows

  • Automation API
  • Clipboard

MacOS

  • Accessibility API
  • Clipboard

Linux

  • Primary Clipboard
    • X11: x11-clipboard
    • Wayland: wl-clipboard

Dependencies

~0–47MB
~692K SLoC