Skip to content

tisfeng/SelectedTextKit

Repository files navigation

SelectedTextKit

This is a macOS library that allows you to easily get the selected text.

It's a part of Easydict.

Features

  • Get selected text via AXUI
  • Get selected text by menu bar action copy
  • Get selected text by shortcut key cmd + c

Usage

import SelectedTextKit

// Get selected text via AXUI, if fails, it will try to get text by menu bar action copy.
let text = try await getSelectedText()

// Get selected text by menu bar action copy
let text = try await getSelectedTextByMenuBarActionCopy()

Thanks

Get selected text by menu bar action copy is inspired by Copi, thanks for s1ntoneli's work.

About

This is a macOS library that allows you to easily get the selected text.

Resources

License

Stars

Watchers

Forks

Languages