from talon.voice import Context, Key, Str, press
from talon import clip
import time

ctx = Context("clipboard")


def get_selection():
    with clip.capture() as s:
        press("cmd-c", wait=0)
    return s.get()


def apply_to_line(fn):
    def wrap(m):
        press("shift-alt-left")
        time.sleep(0.1)
        sel = get_selection()
        time.sleep(0.05)
        Str(fn(sel))(None)

    return wrap


ctx.keymap(
    {
        "run caps": apply_to_line(lambda s: s.capitalize()),
        "run yeller": apply_to_line(lambda s: s.upper()),
    }
)

a05412be4df18ae40910a4d0ba4d3bcb26f2fea3
<mask token>


def get_selection():
    with clip.capture() as s:
        press('cmd-c', wait=0)
    return s.get()


def apply_to_line(fn):

    def wrap(m):
        press('shift-alt-left')
        time.sleep(0.1)
        sel = get_selection()
        time.sleep(0.05)
        Str(fn(sel))(None)
    return wrap


<mask token>

<mask token>


def get_selection():
    with clip.capture() as s:
        press('cmd-c', wait=0)
    return s.get()


def apply_to_line(fn):

    def wrap(m):
        press('shift-alt-left')
        time.sleep(0.1)
        sel = get_selection()
        time.sleep(0.05)
        Str(fn(sel))(None)
    return wrap


ctx.keymap({'run caps': apply_to_line(lambda s: s.capitalize()),
    'run yeller': apply_to_line(lambda s: s.upper())})

<mask token>
ctx = Context('clipboard')


def get_selection():
    with clip.capture() as s:
        press('cmd-c', wait=0)
    return s.get()


def apply_to_line(fn):

    def wrap(m):
        press('shift-alt-left')
        time.sleep(0.1)
        sel = get_selection()
        time.sleep(0.05)
        Str(fn(sel))(None)
    return wrap


ctx.keymap({'run caps': apply_to_line(lambda s: s.capitalize()),
    'run yeller': apply_to_line(lambda s: s.upper())})

from talon.voice import Context, Key, Str, press
from talon import clip
import time
ctx = Context('clipboard')


def get_selection():
    with clip.capture() as s:
        press('cmd-c', wait=0)
    return s.get()


def apply_to_line(fn):

    def wrap(m):
        press('shift-alt-left')
        time.sleep(0.1)
        sel = get_selection()
        time.sleep(0.05)
        Str(fn(sel))(None)
    return wrap


ctx.keymap({'run caps': apply_to_line(lambda s: s.capitalize()),
    'run yeller': apply_to_line(lambda s: s.upper())})

from talon.voice import Context, Key, Str, press
from talon import clip
import time

ctx = Context("clipboard")


def get_selection():
    with clip.capture() as s:
        press("cmd-c", wait=0)
    return s.get()


def apply_to_line(fn):
    def wrap(m):
        press("shift-alt-left")
        time.sleep(0.1)
        sel = get_selection()
        time.sleep(0.05)
        Str(fn(sel))(None)

    return wrap


ctx.keymap(
    {
        "run caps": apply_to_line(lambda s: s.capitalize()),
        "run yeller": apply_to_line(lambda s: s.upper()),
    }
)
