Selected Text

from talon import Module, actions

mod = Module()

@mod.action_class
class Actions:
    def print_selected_text():
        """Print the currently selected text in the active application"""
        selected = actions.edit.selected_text()
        if selected:
            print(f"Selected text: {selected}")
        else:
            print("No text is currently selected")