termux-app icon indicating copy to clipboard operation
termux-app copied to clipboard

Add support for apps supporting PROCESS_TEXT intents.

Open caarmen opened this issue 2 years ago • 1 comments

In the context menu that appears when a user selects text, add a new submenu which includes third-party activities which handle the PROCESS_TEXT intent. This will allow processing the selected text in other apps.

Some links about this type of interaction with other apps:

  • Manifest config required to work on Android 30+: https://developer.android.com/training/package-visibility/use-cases
  • PROCESS_TEXT intent action: https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT
  • Blog post by Ian Lake on how to make an app appear in the system text selection menu: https://medium.com/androiddevelopers/custom-text-selection-actions-with-action-process-text-191f792d2999

Since the text selection menu is customized in termux, if we want the text selection menu to include this functionality, we have to add it ourselves (this PR :) ).

Here's a demo of selecting text, and opening it in Google Translate, then in Wikipedia:

process_text.webm

caarmen avatar Dec 02 '23 21:12 caarmen

Thanks for the pull, this looks good and mergable in essence. Will have to test it and will merge with the others before next release.

agnostic-apollo avatar Dec 12 '23 00:12 agnostic-apollo