25 lines
561 B
Python
25 lines
561 B
Python
import logging
|
|
|
|
from talon import Context, Module, actions, settings
|
|
|
|
mod = Module()
|
|
ctx = Context()
|
|
|
|
mod.setting(
|
|
"paste_to_insert_threshold",
|
|
type=int,
|
|
default=-1,
|
|
desc="""Use paste to insert text longer than this many characters.
|
|
Zero means always paste; -1 means never paste.
|
|
""",
|
|
)
|
|
|
|
|
|
@ctx.action_class("main")
|
|
class MainActions:
|
|
def insert(text):
|
|
threshold = settings.get("user.paste_to_insert_threshold")
|
|
if 0 <= threshold < len(text):
|
|
actions.user.paste(text)
|
|
return
|
|
actions.next(text)
|