コード例 #1
0
ファイル: repeat.py プロジェクト: lexjacobs/talon-user
import talon
from talon.voice import Word, Context, Str, Rep

from user.utility import text_to_number, optional_numerals


def repeat(m):

    words = m._words

    repeat_count = text_to_number(words[1:])
    print("Repeat! {} {}".format([str(w) for w in words], repeat_count))
    if not repeat_count:
        repeat_count = 1
    repeater = Rep(repeat_count)
    repeater.ctx = m.ctx
    return repeater(None)


ctx = Context("repeaters")
ctx.keymap({"repeat" + optional_numerals: repeat})
コード例 #2
0
ctx.keymap({
    'cd': 'cd ',
    'cd talon home': 'cd {}'.format(TALON_HOME),
    'cd talon user': '******'.format(TALON_USER),
    'cd talon plugins': 'cd {}'.format(TALON_PLUGINS),
    'run make (durr | dear)': 'mkdir ',
    'run get': 'git ',
    'run get (R M | remove)': 'git rm ',
    'run get add': 'git add ',
    'run get branch': 'git branch ',
    'run get checkout': 'git checkout ',
    'run get clone': 'git clone ',
    'run get commit': ['git commit -a -m ""',
                       Key('left')],
    'run get diff': 'git diff ',
    'run get in it': 'git init ',
    'run get merge': 'git merge ',
    'run get move': 'git mv ',
    'run get pull': 'git pull ',
    'run get push': 'git push ',
    'run get status': 'git status ',
    'run (them | vim)': 'vim ',
    'run L S': 'ls\n',
    'dot pie': '.py',
    # 'run make': 'make\n',
    # 'run jobs': 'jobs\n',

    # Tools
    "(grep | grip)": ["grep  .", Key("left left")],
    "gripper": ["grep -r  .", Key("left left")],
    "pee socks": "ps aux ",
    "vi": "vi ",
    # python
    "pip": "pip",
    "pip install": "pip install ",
    "pip install requirements": "pip install -r ",
    "pip install editable": "pip install -e ",
    "pip install this": "pip install -e .",
    "pip install upgrade": "pip install --upgrade ",
    "pip uninstall": "pip uninstall ",
    "pip list": "pip list",
    'open Talon directory': ['cd ~/.talon/user/',
                             Key('Enter')]
})
コード例 #3
0

# TODO: This could be made more intelligent:
#         * Apply a timeout after which the command will not repeat previous actions
#         * Prevent stacking of repetitions upon previous repetitions
def repeat(m):
    repeat_count = parse_words_as_integer(m._words[1:])

    if repeat_count != None and repeat_count >= 2:
        repeater = Rep(repeat_count - 1)
        repeater.ctx = talon
        return repeater(None)


ctx.keymap({
    'wink':
    Rep(1),
    'creek':
    RepPhrase(1),
    'soup':
    Rep(2),
    'trace':
    Rep(3),
    'quarr':
    Rep(4),
    'fypes':
    Rep(5),
    '(repeat | repple) (0 | oh | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)+':
    repeat,
})
コード例 #4
0
        press("-".join(mods + [keys[0]]))
        keys = keys[1:]
    for k in keys:
        press(k)


ctx = Context("basic_keys")
ctx.keymap({
    "(uppercase | ship | sky) {basic_keys.alphabet}+ [(lowercase | sunk)]":
    uppercase_letters,
    "{basic_keys.modifiers}* {basic_keys.alphabet}+":
    press_keys,
    "{basic_keys.modifiers}* {basic_keys.digits}+":
    press_keys,
    "{basic_keys.modifiers}* {basic_keys.keys}+":
    press_keys,
    "(go | {basic_keys.modifiers}+) {basic_keys.arrows}+":
    press_keys,
    "number {basic_keys.digits}+ [over]":
    press_keys,
    "tarsh":
    Key("shift-tab"),
    "tarpy": [Key("tab"), Key("tab")],
})
ctx.set_list("alphabet", alphabet.keys())
ctx.set_list("digits", digits.keys())
ctx.set_list("keys", keys.keys())
ctx.set_list("arrows", arrows.keys())
ctx.set_list("modifiers", modifiers.keys())
ctx.set_list("keymap", keymap.keys())
コード例 #5
0
ファイル: terminal.py プロジェクト: ym-han/talon_community
            "events",
            "deployments",
            "replicasets",
            "",
    ):
        if object:
            object = object + " "
        command = f"{KUBERNETES_PREFIX} {action} {object}"
        typed = f"kubectl {action} {object}"
        keymap.update({command: typed})

keymap.update(
    {"(pain | bang) " + str(i): Key("alt-" + str(i))
     for i in range(10)})

ctx.keymap(keymap)
ctx.set_list("directory_shortcuts", directory_shortcuts.keys())
# ctx.set_list("servers", servers.keys())


def shell_rerun(m):
    # switch_app(name='iTerm2')
    app = ui.apps(bundle="com.googlecode.iterm2")[0]
    ctrl.key_press("c", ctrl=True, app=app)
    time.sleep(0.05)
    ctrl.key_press("up", app=app)
    ctrl.key_press("enter", app=app)


def shell_new_server(m):
    """
コード例 #6
0
ctx.keymap({
    # tab control
    "((open | new) tab | peach)":
    Key("cmd-t"),
    "(close tab | totch)":
    Key("cmd-w"),
    "([switch] tab (right | next) | goneck)":
    Key("cmd-shift-]"),
    "([switch] tab (left | previous | preev) | gopreev)":
    Key("cmd-shift-["),
    "[switch] tab (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8)":
    jump_tab,
    "[switch] tab (end | rightmost)":
    Key("cmd-9"),
    # zooming
    "zoom in":
    Key("cmd-="),
    "zoom out":
    Key("cmd--"),
    "zoom normal":
    Key("cmd-0"),
    # window control
    "((open | new) window | plum)":
    Key("cmd-n"),
    "window close":
    Key("cmd-shift-w"),
    "([switch] window (next | right) | gibby)":
    Key("cmd-`"),
    "([switch] window (left | previous | preev) | shibby)":
    Key("cmd-shift-`"),
    "[switch] space (right | next)":
    Key("ctrl-right"),
    "[switch] space (left | previous | preev)":
    Key("ctrl-left"),
    "(minimise window | curtail | min win)":
    Key("cmd-m"),
    "show app windows":
    Key("ctrl-down"),
    # application navigation
    "[open] launcher":
    Key("cmd-space"),
    "([switch] app (next | right) | swick)":
    Key("cmd-tab"),
    "[switch] app (left | previous | preev)":
    Key("cmd-shift-tab"),
    "[open] mission control":
    lambda m: system("open -a 'Mission Control'"),
    "quit app | quidditch":
    Key("cmd-q"),
})
コード例 #7
0
    def warps(self):
        try:
            window = ui.active_window()
            bundle = window.app.bundle
            return self.data[bundle].keys()
        except Exception as e:
            print(e)
            return []

    def dump(self):
        with open(warps_file, "w") as f:
            json.dump(self.data, f, indent=2)


mj = MouseWarp()
ctx = Context("warp")
ctx.keymap({
    "mark <dgndictation> [over]": [
        lambda m: mj.mark(utils.join_words(utils.parse_words(m))),
        lambda _: ctx.set_list("warps", mj.warps()),
    ],
    "warp {warp.warps}": [lambda m: mj.warp(m["warp.warps"][0])],
    "list warps": [lambda _: app.notify("Warps:\n" + "\n".join(mj.warps()))],
    "click {warp.warps}": [
        lambda m: mj.warp(m["warp.warps"][0]),
        lambda _: ctrl.mouse_click(button=0),
    ],
})
ctx.set_list("warps", mj.warps())
コード例 #8
0
ファイル: formatters.py プロジェクト: ym-han/talon_community
        for name in reversed(fmt):
            smash, func = formatters[name]
            word = func(i, word, i == len(words) - 1)
        tmp.append(word)

    sep = "" if smash else " "
    insert(sep.join(tmp))
    # if no words, move cursor inside surrounders
    if not words[0]:
        for i in range(len(tmp[0]) // 2):
            press("left")


ctx = Context("formatters")

ctx.keymap({
    "(phrase | say) <dgndictation> [over]":
    text,
    "sentence <dgndictation> [over]":
    sentence_text,
    "(comma | ,) <dgndictation> [over]": [", ", spoken_text],
    "period <dgndictation> [over]": [". ", sentence_text],
    "word <dgnwords>":
    word,
    "(%s)+ [<dgndictation>] [over]" % (" | ".join(formatters)):
    FormatText,
    # to match surrounder command + another command (i.e. not dgndictation)
    "(%s)+" % (" | ".join(surrounders)):
    FormatText,
})
コード例 #9
0
ctx.keymap({
    'say <dgndictation> [over]':
    text,
    'sentence <dgndictation> [over]':
    sentence_text,
    'comma <dgndictation> [over]': [', ', text],
    'period <dgndictation> [over]': ['. ', sentence_text],
    'more <dgndictation> [over]': [' ', text],
    'word <dgnwords>':
    word,
    '(%s)+ [<dgndictation>]' % (' | '.join(formatters)):
    FormatText,
    "prefies":
    Key("cmd-,"),  #preferences

    #punctuation and symbols
    'question [mark]':
    '?',
    '(bang | exclamation point)':
    '!',
    'dollar [sign]':
    '$',
    '(paren | left paren)':
    '(',
    '(rparen | are paren | right paren)':
    ')',
    '(brace | left brace)':
    '{',
    '(rbrace | are brace | right brace)':
    '}',
    '(angle | left angle | less than)':
    '<',
    '(rangle | are angle | right angle | greater than)':
    '>',
    '(star | asterisk)':
    '*',
    '(pound | hash [sign] | octo | thorpe | number sign)':
    '#',
    'percent [sign]':
    '%',
    'caret':
    '^',
    'at sign':
    '@',
    '(and sign | ampersand | amper)':
    '&',

    #PROGRAMMING----
    '(dubquote | double quote)':
    '"',
    'triple quote':
    "'''",
    '(dot dot | dotdot)':
    '..',
    'cd':
    'cd ',
    'cd talon home':
    'cd {}'.format(TALON_HOME),
    'cd talon user':
    '******'.format(TALON_USER),
    'cd talon plugins':
    'cd {}'.format(TALON_PLUGINS),
    'run make (durr | dear)':
    'mkdir ',
    'run get':
    'git ',
    'run get (R M | remove)':
    'git rm ',
    'run get add':
    'git add ',
    'run get bisect':
    'git bisect ',
    'run get branch':
    'git branch ',
    'run get checkout':
    'git checkout ',
    'run get clone':
    'git clone ',
    'run get commit':
    'git commit ',
    'run get diff':
    'git diff ',
    'run get fetch':
    'git fetch ',
    'run get grep':
    'git grep ',
    'run get in it':
    'git init ',
    'run get log':
    'git log ',
    'run get merge':
    'git merge ',
    'run get move':
    'git mv ',
    'run get pull':
    'git pull ',
    'run get push':
    'git push ',
    'run get rebase':
    'git rebase ',
    'run get reset':
    'git reset ',
    'run get show':
    'git show ',
    'run get status':
    'git status ',
    'run get tag':
    'git tag ',
    'run (them | vim)':
    'vim ',
    'run L S':
    'ls\n',
    'dot pie':
    '.py',
    'run make':
    'make\n',
    'run jobs':
    'jobs\n',
    'const':
    'const ',
    'static':
    'static ',
    'tip pent':
    'int ',
    'tip char':
    'char ',
    'tip byte':
    'byte ',
    'tip pent 64':
    'int64_t ',
    'tip you went 64':
    'uint64_t ',
    'tip pent 32':
    'int32_t ',
    'tip you went 32':
    'uint32_t ',
    'tip pent 16':
    'int16_t ',
    'tip you went 16':
    'uint16_t ',
    'tip pent 8':
    'int8_t ',
    'tip you went 8':
    'uint8_t ',
    'tip size':
    'size_t',
    'tip float':
    'float ',
    'tip double':
    'double ',
    'args': ['()', Key('left')],
    'index': ['[]', Key('left')],
    'block': [' {}', Key('left enter enter up tab')],
    'empty array':
    '[]',
    'empty dict':
    '{}',
    'state (def | deaf | deft)':
    'def ',
    'state else if':
    'elif ',
    'state if':
    'if ',
    'state else if': [' else if ()', Key('left')],
    'state while': ['while ()', Key('left')],
    'state for': ['for ()', Key('left')],
    'state for':
    'for ',
    'state switch': ['switch ()', Key('left')],
    'state case': ['case \nbreak;', Key('up')],
    'state goto':
    'goto ',
    'state import':
    'import ',
    'state class':
    'class ',
    'state include':
    '#include ',
    'state include system': ['#include <>', Key('left')],
    'state include local': ['#include ""', Key('left')],
    'state type deaf':
    'typedef ',
    'state type deaf struct': ['typedef struct {\n\n};',
                               Key('up'), '\t'],
    'comment see':
    '// ',
    'comment py':
    '# ',
    'word queue':
    'queue',
    'word eye':
    'eye',
    'word bson':
    'bson',
    'word iter':
    'iter',
    'word no':
    'NULL',
    'word cmd':
    'cmd',
    'word dup':
    'dup',
    'word streak': ['streq()', Key('left')],
    'word printf':
    'printf',
    'word (dickt | dictionary)':
    'dict',
    'word shell':
    'shell',
    'dunder in it':
    '__init__',
    'self taught':
    'self.',
    'dickt in it': ['{}', Key('left')],
    'list in it': ['[]', Key('left')],
    'string utf8':
    "'utf8'",
    'state past':
    'pass',
    'arrow':
    '->',
    'call':
    '()',
    'indirect':
    '&',
    'dereference':
    '*',
    '(op equals | assign)':
    ' = ',
    'op (minus | subtract)':
    ' - ',
    'op (plus | add)':
    ' + ',
    'op (times | multiply)':
    ' * ',
    'op divide':
    ' / ',
    'op mod':
    ' % ',
    '[op] (minus | subtract) equals':
    ' -= ',
    '[op] (plus | add) equals':
    ' += ',
    '[op] (times | multiply) equals':
    ' *= ',
    '[op] divide equals':
    ' /= ',
    '[op] mod equals':
    ' %= ',
    '(op | is) greater [than]':
    ' > ',
    '(op | is) less [than]':
    ' < ',
    '(op | is) equal':
    ' == ',
    '(op | is) not equal':
    ' != ',
    '(op | is) greater [than] or equal':
    ' >= ',
    '(op | is) less [than] or equal':
    ' <= ',
    '(op (power | exponent) | to the power [of])':
    ' ** ',
    'op and':
    ' && ',
    'op or':
    ' || ',
    '[op] (logical | bitwise) and':
    ' & ',
    '[op] (logical | bitwise) or':
    ' | ',
    '(op | logical | bitwise) (ex | exclusive) or':
    ' ^ ',
    '[(op | logical | bitwise)] (left shift | shift left)':
    ' << ',
    '[(op | logical | bitwise)] (right shift | shift right)':
    ' >> ',
    '(op | logical | bitwise) and equals':
    ' &= ',
    '(op | logical | bitwise) or equals':
    ' |= ',
    '(op | logical | bitwise) (ex | exclusive) or equals':
    ' ^= ',
    '[(op | logical | bitwise)] (left shift | shift left) equals':
    ' <<= ',
    '[(op | logical | bitwise)] (right shift | shift right) equals':
    ' >>= ',
    'shebang bash':
    '#!/bin/bash -u\n',
    'copy active bundle':
    copy_bundle,
})
コード例 #10
0
context.keymap({
    "(address bar | focus address | focus url | url | goto address)":
    focus_address_bar,
    "copy url":
    Key("escape y y"),
    "clone tab":
    Key("escape y t"),
    "(go back)":
    back,
    "(go forward | forward)":
    forward,
    "reload":
    Key("cmd-r"),
    "page":
    Key("escape d"),
    # "page reload": Key("cmd-r"),
    # "reload page": Key("cmd-r"),
    "hard reload":
    Key("cmd-shift-r"),
    "new tab":
    Key("cmd-t"),
    # "new tab {global_browser.webpages}": go_to_webpage,
    # "new search {global_browser.searches} [<dgndictation>]": new_search_new_tab,
    # "search {global_browser.searches} [<dgndictation>]": new_search_existing_tab,
    "close tab": [Key("cmd-w"),
                  set_again('cmd-w', "cmd-shift-t")],
    "(reopen | unclose) tab":
    [Key("cmd-shift-t"), set_again('cmd-shift-t', None)],
    "recently closed": [refocus_page, Key("\\x")],
    "close others": [refocus_page, Key('g x x')],
    "(next tab | goneck)":
    Key("cmd-shift-]"),
    "((last | previous | preev) tab | gopreev)":
    Key("cmd-shift-["),
    "tab (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8)":
    jump_tab,
    "(end | rightmost) tab":
    Key("cmd-9"),
    "marco":
    Key("cmd-f"),
    "(marneck)":
    Key("cmd-g"),
    "(last | prevous)":
    Key("cmd-shift-g"),
    "toggle dev tools":
    Key("cmd-alt-i"),
    "edit [current] url": [refocus_page, Key("s U")],
    "edit new url": [refocus_page, Key("s u")],
    "command menu":
    Key("cmd-shift-p"),
    "next panel":
    next_panel,
    "next page": [refocus_page,
                  Key('] ]'),
                  set_again('] ]', '[ [')],
    "(preev | previous) page":
    [refocus_page, Key('[ ['),
     set_again('[ [', '] ]')],
    # reddit comment
    "collapse next": [Key('enter j'),
                      set_again('enter j', 'k enter')],
    "read selected":
    Key('space r'),
    "(top | toop)":
    Key('alt-t'),
    "expand":
    Key('alt-3 alt-9'),
    "comments":
    Key('alt-0'),
    "[open] mark [<dgndictation>]": [Key('`'), utils.text],
    "go mark [<dgndictation>]": [refocus_page,
                                 Key('o m'), utils.text],
    # "remember <dgndictation>": [Key('m'), (False, lambda i, word, _: word.capitalize())],
    "(last | previous) panel":
    last_panel,
    "show application [panel]":
    lambda m: show_panel("Application"),
    "show audit[s] [panel]":
    lambda m: show_panel("Audits"),
    "show (console|consul) [panel]":
    lambda m: show_panel("Console"),
    "show element[s] [panel]":
    lambda m: show_panel("Elements"),
    "show memory [panel]":
    lambda m: show_panel("Memory"),
    "show network [panel]":
    lambda m: show_panel("Network"),
    "show performance [panel]":
    lambda m: show_panel("Performance"),
    "show security [panel]":
    lambda m: show_panel("Security"),
    "show (source[s] | code) [panel]":
    lambda m: show_panel("Sources"),
    "(refocus | focus) page":
    refocus_page,
    "[refocus] dev tools":
    open_focus_devtools,
    "type":
    Key("cmd-;"),
    "vim type": [refocus_page, Key("I")],
    "(find | sip | drink | greps) [<dgndictation>+] [yes]": [
        refocus_page,
        Key("/"), utils.text,
        utils.press_if("enter", "yes$"),
        set_again('n', 'N')
    ],
    # visual mode vim
    "float [<dgndictation>]":
    [refocus_page, Key('f'), utils.text,
     set_again(';', ',')],
    "(unfloat | backflow) [<dgndictation>]":
    [refocus_page, Key('F'), utils.text,
     set_again(';', ',')],
    # Clipboard
    "cut":
    Key("cmd-x"),
    "copy":
    Key("cmd-c"),
    "paste":
    Key("cmd-v"),
    "paste same style":
    Key("cmd-alt-shift-v"),
    # TODO: this should probably be specific to the page
    "submit":
    Key("cmd-enter"),
    "omni next": [Key('ctrl-.'), set_again('ctrl-.', 'ctrl-,')],
    "omni (preev | last)": [Key('ctrl-,'),
                            set_again('ctrl-,'), 'ctrl-.'],
    "omni (remove | delete)":
    Key('ctrl-d'),
    "omni (open)":
    Key('ctrl-enter'),
    # custom button search
    "button [<dgndictation>+] [yes]": [
        Key('alt-shift-f7'),
        utils.delay(0.1),
        utils.text,
        utils.press_if("enter", "yes$"),
    ],
    # zotero
    # "zotero": Key("cmd-shift-z"),
    # rearrange tabs: https://chrome.google.com/webstore/detail/rearrange-tabs/ccnnhhnmpoffieppjjkhdakcoejcpbga
    # "move tab left": Key("ctrl-shift-left"),
    # "move tab right": Key("ctrl-shift-right"),
    # "move tab left way": Key("ctrl-shift-down"),
    # vimium
    # "link": link,
    "move tab left":
    browser.send_to_vimium("<<"),
    "move tab right":
    browser.send_to_vimium(">>"),
    "move tab new window":
    browser.send_to_vimium("W"),
    "tab (named | name | by name)":
    browser.send_to_vimium("T"),
    "tab (named | name | by name) <dgndictation>+": [
        browser.send_to_vimium("T"),
        lambda m: time.sleep(0.3),
        lambda m: utils.paste_text(utils.string_capture(m)),
        lambda m: time.sleep(0.0),
        Key("enter"),
    ],
    "open most recently downloaded file":
    open_most_recently_downloaded_file,
})
コード例 #11
0
from talon.voice import Context, Key

from ..utils import is_filetype, snake_text, caps_text

PREFIX = " "
ctx = Context("spotify", bundle="com.spotify.client")

ctx.keymap({
    PREFIX + " back": Key("cmd-left"),
    PREFIX + " next": Key("cmd-right"),
    PREFIX + " play": Key("space"),
    PREFIX + " more": Key("cmd-up"),
    PREFIX + " less": Key("cmd-down"),
})
コード例 #12
0
            click menu item "DragonPad" of menu of menu item "Help" of menu 1
        end tell
    """)


# def toggle_status_win(val):
#     open_dragon_menubar()
#     applescript.run(f"""
#     tell application "System Events" to tell process "Dragon" to tell (menu bar item 1 of menu bar 2)
#         click (menu item where its name ends with "Status Window") of menu 1
#     end tell
#     """)


def set_status_win(val):
    open_dragon_menubar()
    command = "Show Status Window" if val else "Hide Status Window"
    applescript.run(f"""
    tell application "System Events" to tell process "Dragon" to tell (menu bar item 1 of menu bar 2)
        click menu item "{command}" of menu 1
    end tell
    """)


context.keymap({
    "hide status": lambda m: set_status_win(False),
    "show status": lambda m: set_status_win(True),
    "dragon pad": lambda m: open_dragonpad(),
    # "toggle status": lambda m: toggle_status_win(),
})
context.load()
コード例 #13
0
ファイル: language.py プロジェクト: dwiel/talon-user
ctx.keymap(
    {
        "logical and": i(" and "),
        "logical or": i(" or "),
        "state comment": i("# "),
        "[line] comment <dgndictation> [over]": [
            Key("cmd-right"),
            i("  # "),
            formatted_text(SENTENCE),
        ],
        # "add comment <dgndictation> [over]": [
        #     Key("cmd-right"),
        #     text_with_leading(" # "),
        # ],
        "state (def | deaf | deft)": i("def "),
        "function <dgndictation> [over]": [
            i("def "),
            formatted_text(DOWNSCORE_SEPARATED, JARGON),
            i("():"),
            Key("left left"),
        ],
        "method <dgndictation> [over]": [
            i("def "),
            formatted_text(DOWNSCORE_SEPARATED, JARGON),
            i("(self, ):"),
            Key("left left"),
        ],
        "state else if": i("elif "),
        "state if": i("if "),
        "is not none": i(" is not None"),
        "is none": i(" is None"),
        "if <dgndictation> [over]": [
            i("if "),
            formatted_text(DOWNSCORE_SEPARATED, JARGON),
        ],
        "state while": i("while "),
        "while <dgndictation> [over]": [
            i("while "),
            formatted_text(DOWNSCORE_SEPARATED, JARGON),
        ],
        "state for": i("for "),
        "for <dgndictation> [over]": [
            i("for "),
            formatted_text(DOWNSCORE_SEPARATED, JARGON),
        ],
        "body": [Key("cmd-right : enter")],
        "state import": i("import "),
        "import <dgndictation> [over]": [
            i("for "),
            formatted_text(DOT_SEPARATED, JARGON),
        ],
        "state class": i("class "),
        "class <dgndictation> [over]": [
            i("class "),
            formatted_text(GOLANG_PUBLIC),
            i(":\n"),
        ],
        "state (past | pass)": i("pass"),
        "state true": i("True"),
        "state false": i("False"),
        "state none": i("None"),
        "item <dgndictation> [over]": [
            i(", "),
            formatted_text(DOWNSCORE_SEPARATED, JARGON),
        ],
        "swipe [<dgndictation>] [over]": [
            Key("right"),
            i(", "),
            formatted_text(DOWNSCORE_SEPARATED, JARGON),
        ],
    }
)
コード例 #14
0
def launch_app(m):
    name = str(m["switcher.launch"][0])
    path = launch.get(name)
    if path:
        ui.launch(path=path)


ctx = Context("switcher")
ctx.keymap({
    "focus {switcher.running}": switch_app,
    "launch {switcher.launch}": launch_app,
    # custom switchers here
    "madam": lambda x: switch_app(x, "Atom"),
    "fox chrome": lambda x: switch_app(x, "Google Chrome"),
    "fox outlook": lambda x: switch_app(x, "Outlook"),
    "fox slack": lambda x: switch_app(x, "Slack"),
    "fox iterm": lambda x: switch_app(x, "iTerm2"),
    "fox term": lambda x: switch_app(x, "iTerm2"),
    "fox skype": lambda x: switch_app(x, "Skype for Business"),
    "fox signal": lambda x: switch_app(x, "Signal"),
})


def update_lists():
    global running
    global launch
    new = {}
    for app in ui.apps():
        if app.background and not app.windows():
            continue
コード例 #15
0
import time

from .. import utils
from talon.voice import Context, Key

ctx = Context("sleep")


def sleep(m):
    seconds = extract_num_from_m(m, default=None)
    time.sleep(seconds)


ctx.keymap({"sleep" + utils.numerals: sleep})
コード例 #16
0
ファイル: terminal.py プロジェクト: slin63/talon_community
}

for action in ("get", "delete", "describe"):
    for object in ("nodes", "jobs", "pods", "namespaces", "services", "events",
                   ""):
        if object:
            object = object + " "
        command = f"{KUBERNETES_PREFIX} {action} {object}"
        typed = f"kubectl {action} {object}"
        keymap.update({command: typed})

keymap.update(
    {"(pain | bang) " + str(i): Key("alt-" + str(i))
     for i in range(10)})

ctx.keymap(keymap)


def shell_rerun(m):
    # switch_app(name='iTerm2')
    app = ui.apps(bundle="com.googlecode.iterm2")[0]
    ctrl.key_press("c", ctrl=True, app=app)
    time.sleep(0.05)
    ctrl.key_press("up", app=app)
    ctrl.key_press("enter", app=app)


global_ctx = Context("global_terminal")
global_ctx.keymap({
    "SHE rerun": shell_rerun,
    "SHE server {global_terminal.servers}": name_servers
コード例 #17
0
ファイル: repeat.py プロジェクト: ym-han/talon-configs

def flip_agains(m):
    global glob_again, glob_back, again_phrase
    flip_label = " - flipped"
    temp_again = glob_again
    glob_again = glob_back
    glob_back = temp_again
    if again_phrase.endswith(flip_label):
        again_phrase = again_phrase[0:-len(flip_label)]
    else:
        again_phrase = again_phrase + flip_label


ctx.keymap({
    # ordinals from 2shea
    # 2nd / 4th / 11th after any command
    # "{repeater.ordinals}": repeat_ordinal,
    utils.numerals + '(times | ok)':
    repeat,
    "(repeat | wink) [" + utils.numerals + ']':
    repeat,
    "(again | extend | xtend | shizzle | yarp) [" + utils.numerals + ']':
    again_action,
    "(bench | back | reduce | reduck | fizzle) [" + utils.numerals + ']':
    back_action,
    # again phrase
    "flip again[s]":
    flip_agains,
})
コード例 #18
0
ファイル: git.py プロジェクト: davidulander/talon
ctx.keymap({
    PREFIX + "add [<dgndictation>]": ["git add ", text],
    PREFIX + "add all":
    "git add .\n",
    PREFIX + "add partial [<dgndictation>]": ["git add -p ", text],
    PREFIX + "bisect":
    "git bisect ",
    PREFIX + "branch":
    "git branch ",
    PREFIX + "branch set up stream to [<dgndictation>]": [
        "git branch --set-upstream-to=",
        text,
    ],
    PREFIX + "branch delete [<dgndictation>]": ["git branch -D ", text],
    PREFIX + "branch all [<dgndictation>]": ["git branch -a ", text],
    PREFIX + "clone [<dgndictation>]": ["git clone ", text],
    PREFIX + "checkout master":
    "git checkout master \n",
    PREFIX + "checkout [<dgndictation>]": ["git checkout ", text],
    PREFIX + "checkout branch [<dgndictation>]": ["git checkout -B ", text],
    PREFIX + "cherry pick [<dgndictation>]": ["git cherry-pick ", text],
    PREFIX + "commit [<dgndictation>]":
    ['git commit -m ""', Key("left"), text],
    PREFIX + "simple commit":
    'git add . && git commit -m "Update" \n',
    PREFIX + "commit no": [
        'git commit -m "" -n',
        Key("left"),
        Key("left"),
        Key("left"),
        Key("left")
    ],
    PREFIX + "commit amend [<dgndictation>]": [
        'git commit --amend -m ""',
        Key("left"),
        text,
    ],
    PREFIX + "commit all [<dgndictation>]":
    ['git commit -a -m ""', Key("left"), text],
    PREFIX + "commit ticket [number]":
    ['git commit -m "[#]"', Key("left"),
     Key("left")],
    PREFIX + "config [<dgndictation>]": ["git config ", text],
    PREFIX + "config list [<dgndictation>]": ["git config --list ", text],
    PREFIX + "diff [<dgndictation>]": ["git diff ", text],
    PREFIX + "diff staged":
    "git diff --staged ",
    PREFIX + "fetch":
    "git fetch \n",
    PREFIX + "history":
    "git hist ",
    PREFIX + "grep":
    "git grep ",
    PREFIX + "(in it | init | initialize)":
    "git init ",
    PREFIX + "log":
    "glog \n",
    PREFIX + "merge [<dgndictation>]": ["git merge ", text],
    PREFIX + "move [<dgndictation>]": ["git mv ", text],
    PREFIX + "pull [<dgndictation>]": ["git pull ", text, "\n"],
    PREFIX + "pull (base | re-base | rebase | re base) [<dgndictation>]": [
        "git pull --rebase ",
        text,
    ],
    PREFIX + "push [<dgndictation>]": ["git push ", text, "\n"],
    PREFIX + "push force [<dgndictation>]": ["git push --force ", text],
    PREFIX + "push force lease [<dgndictation>]":
    ["git push --force-with-lease ", text],
    PREFIX + "push set up stream [<dgndictation>]":
    ["git push --set-upstream ", text],
    PREFIX + "push set up new branch":
    "git push --set-upstream origin HEAD",
    PREFIX + "rebase continue":
    "git rebase --continue",
    PREFIX + "rebase [<dgndictation>]": ["git rebase ", text],
    PREFIX + "remote add [<dgndictation>]": ["git remote add ", text],
    PREFIX + "(remove | R M) [<dgndictation>]": ["git rm ", text],
    PREFIX + "reset [<dgndictation>]": ["git reset ", text],
    PREFIX + "reset one commit":
    "git reset HEAD~1 \n",
    PREFIX + "reset hard":
    "git reset --hard ",
    PREFIX + "reset one commit hard":
    "git reset HEAD~1 --hard \n",
    PREFIX + "revert [<dgndictation>]": ["git revert ", text],
    PREFIX + "show":
    "git show ",
    PREFIX + "stash":
    "git stash ",
    PREFIX + "stash apply":
    "git stash apply \n",
    PREFIX + "stash pop":
    "git stash pop \n",
    PREFIX + "status":
    "git status \n",
    PREFIX + "submodule":
    "git submodule ",
    PREFIX + "submodule add":
    "git submodule add ",
    PREFIX + "submodule in it":
    "git submodule init",
    PREFIX + "submodule update":
    "git submodule update \n",
    PREFIX + "tag":
    "git tag ",
    PREFIX + "add commit": ["git add  && git commit"] + ([Key("left")] * 14),
})
コード例 #19
0
ctx.keymap({
    "(new slide | slide new)":
    Key("ctrl+m"),
    "(duplicate slide | slide duplicate)":
    [Key('cmd-alt-shift-f'), Key("cmd+d")],
    "undo":
    Key("cmd+z"),
    "redo":
    Key("cmd+y"),
    "copy":
    Key("cmd+c"),
    "cut":
    Key("cmd+x"),
    "paste":
    Key("cmd+v"),
    "copy formatting of the selected text or shape":
    Key("cmd+alt+c"),
    "paste formatting of the selected text or shape":
    Key("cmd+alt+v"),
    "insert or edit link":
    Key("cmd+k"),
    "open link":
    Key("alt+enter"),
    "delete":
    Key("delete"),
    "select all":
    Key("cmd+a"),
    "select none":
    Key("cmd+shift+a"),
    "find":
    Key("cmd+f"),
    "find and replace":
    Key("cmd+shift+h"),
    "find again":
    Key("cmd+g"),
    "find previous":
    Key("cmd+shift+g"),
    "open":
    Key("cmd+o"),
    "print":
    Key("cmd+p"),
    "save":
    Key("cmd+s"),
    "show common keyboard shortcuts":
    Key("cmd+/"),
    "search the menus":
    Key("alt+/"),
    "hide or show menus ":
    Key("ctrl+shift+f"),
    "(move to previous slide | slide previous | slide prev)":
    Key('pageup'),
    "(move to next slide | slide next)":
    Key("pagedown"),
    "move focus to first slide":
    Key("home"),
    "move focus to last slide":
    Key("end"),
    "move slide up":
    Key("cmd+up"),
    "move slide down":
    Key("cmd+down"),
    "move slide to beginning":
    Key("cmd+shift+up"),
    "move slide to end":
    Key("cmd+shift+down"),
    "select previous slide":
    Key("shift+up"),
    "select next slide":
    Key("shift+down"),
    "select first slide":
    Key("shift+home"),
    "select last slide":
    Key("shift+end"),
    "zoom in":
    Key("cmd+altand +"),
    "zoom out":
    Key("cmd+altand-"),
    "move to filmstrip":
    Key("cmd+alt+shift+f"),
    "move to canvas":
    Key("cmd+alt+shift+c"),
    "open speaker notes panel":
    Key("cmd+alt+shift+s"),
    "change to html view of presentation":
    Key("cmd+alt+shift+p"),
    "open animations panel":
    Key("cmd+alt+shift+b"),
    "continue in animation preview":
    Key("enter"),
    "open explore tool":
    Key("cmd+alt+shift+i"),
    "define selected word in explore tool":
    Key("cmd+shift+y"),
    "go to side panel":
    Key("cmd+alt+."),
    "open revision history panel":
    Key("cmd+alt+shift+h"),
    "open cell border selection ":
    lambda m: (
        ctrl.key_press("cmd", ctrl=True, cmd=True, down=True),
        press("e"),
        press("p"),
        ctrl.key_press("cmd", ctrl=True, cmd=True, up=True),
    ),
    "play the selected video":
    Key("enter"),
    "present slides":
    Key("cmd+enter"),
    "present slides from beginning":
    Key("cmd+shift+enter"),
    "exit the current mode":
    Key("esc"),
    "context menu":
    Key("cmd+shift+\\"),
    "file menu":
    Key("ctrl+alt+f"),
    "edit menu":
    Key("ctrl+alt+e"),
    "view menu":
    Key("ctrl+alt+v"),
    "insert menu":
    Key("ctrl+alt+i"),
    "slide menu":
    Key("ctrl+alt+s"),
    "format menu":
    Key("ctrl+alt+o"),
    "arrange menu":
    Key("ctrl+alt+r"),
    "tools menu":
    Key("ctrl+alt+t"),
    "help menu":
    Key("ctrl+alt+h"),
    "input tools menu":
    Key("cmd+alt+shift+k"),
    "toggle input controls":
    Key("cmd+shift+k"),
    "insert comment":
    Key("cmd+alt+m"),
    "enter current comment":
    Key("ctrl+enter"),
    "move to next comment":
    lambda m: (
        ctrl.key_press("cmd", ctrl=True, cmd=True, down=True),
        press("n"),
        press("c"),
        ctrl.key_press("cmd", ctrl=True, cmd=True, up=True),
    ),
    "move to previous comment":
    lambda m: (
        ctrl.key_press("cmd", ctrl=True, cmd=True, down=True),
        press("p"),
        press("c"),
        ctrl.key_press("cmd", ctrl=True, cmd=True, up=True),
    ),
    ## these are duplicates that only work if you have a comment selected
    # 'move to next comment': Key('j'),
    # 'move to previous comment': Key('k'),
    "reply to comment":
    Key("r"),
    "resolve comment":
    Key("e"),
    "open comment discussion thread":
    Key("cmd+alt+shift+a"),
    "bold":
    Key("cmd+b"),
    "italic":
    Key("cmd+i"),
    "underline":
    Key("cmd+u"),
    "subscript":
    Key("cmd+,"),
    "superscript":
    Key("cmd+."),
    "strikethrough":
    Key("cmd+shift+x"),
    "clear formatting":
    Key("cmd+\\"),
    "increase font size":
    Key("cmd+shift+>"),
    "decrease font size":
    Key("cmd+shift+<"),
    "left align":
    Key("cmd+shift+l"),
    "right align":
    Key("cmd+shift+r"),
    "center align":
    Key("cmd+shift+e"),
    "justify":
    Key("cmd+shift+j"),
    "select paragraph above":
    Key("alt+shift+up"),
    "select paragraph below":
    Key("alt+shift+down"),
    "increase indent":
    Key("cmd+]"),
    "decrease indent":
    Key("cmd+["),
    "bulleted list":
    Key("cmd+shift+8"),
    "numbered list":
    Key("cmd+shift+7"),
    "select list item":
    lambda m: (
        ctrl.key_press("shift", ctrl=True, cmd=True, shift=True, down=True),
        press("e"),
        press("i"),
        ctrl.key_press("shift", ctrl=True, cmd=True, shift=True, up=True),
    ),
    "select list items at current level":
    lambda m: (
        ctrl.key_press("shift", ctrl=True, cmd=True, shift=True, down=True),
        press("e"),
        press("o"),
        ctrl.key_press("shift", ctrl=True, cmd=True, shift=True, up=True),
    ),
    "move to next text formatting change":
    lambda m: (
        ctrl.key_press("cmd", ctrl=True, cmd=True, down=True),
        press("n"),
        press("w"),
        ctrl.key_press("cmd", ctrl=True, cmd=True, up=True),
    ),
    "move to previous text formatting change":
    lambda m: (
        ctrl.key_press("cmd", ctrl=True, cmd=True, down=True),
        press("p"),
        press("w"),
        ctrl.key_press("cmd", ctrl=True, cmd=True, up=True),
    ),
    "move to next misspelling":
    Key("cmd+'"),
    "move to previous misspelling":
    Key("cmd+;"),
    "duplicate":
    Key("cmd+d"),
    "group":
    Key("cmd+alt+g"),
    "ungroup":
    Key("cmd+ alt+shift+g"),
    "send backward":
    Key("cmd+down"),
    "bring forward":
    Key("cmd+up"),
    "send to back":
    Key("cmd+shift+down"),
    "bring to front":
    Key("cmd+shift+up"),
    "select next shape":
    Key("tab"),
    "select previous shape":
    Key("shift+tab"),
    # "nudge up, down, left, or right": Key("keys"),
    # "nudge one pixel at a time": Key("shift+keys"),
    "rotate counterclockwise by 1 degree":
    Key("alt+shift+left"),
    "rotate clockwise by 1 degree":
    Key("alt+shift+right"),
    "rotate counterclockwise by 15 degree":
    Key("alt+left"),
    "rotate clockwise by 15 degree":
    Key("alt+right"),
    "resize larger horizontally":
    Key("cmd+ctrl+b"),
    "resize larger vertically":
    Key("cmd+ctrl+i"),
    "resize smaller":
    Key("cmd+ctrl+j"),
    "resize larger":
    Key("cmd+ctrl+k"),
    "resize smaller horizontally":
    Key("cmd+ctrl+w"),
    "exit crop mode":
    Key("enter"),
    "speak selection":
    Key("ctrl+cmd+x"),
    "enable screen reader support":
    Key("alt+cmd+z"),
    "speak from cursor location":
    Key("ctrl+cmd+r"),
    "announce formatting at cursor location":
    lambda m: (
        ctrl.key_press("cmd", ctrl=True, cmd=True, down=True),
        press("a"),
        press("f"),
        ctrl.key_press("cmd", ctrl=True, cmd=True, up=True),
    ),
})
コード例 #20
0
ファイル: chrome.py プロジェクト: ym-han/talon_community
context.keymap({
    "(address bar | focus address | focus url | url)":
    focus_address_bar,
    "copy url":
    Key("escape y y"),
    "go back":
    back,
    "go forward":
    forward,
    "page reload":
    Key("cmd-r"),
    "reload page":
    Key("cmd-r"),
    "hard reload":
    Key("cmd-shift-r"),
    "new tab":
    Key("cmd-t"),
    "new tab {global_browser.webpages}":
    go_to_webpage,
    "new search {global_browser.searches} [<dgndictation>]":
    new_search_new_tab,
    "search {global_browser.searches} [<dgndictation>]":
    new_search_existing_tab,
    "close tab":
    Key("cmd-w"),
    "(reopen | unclose) tab":
    Key("cmd-shift-t"),
    "(next tab | goneck)":
    Key("cmd-shift-]"),
    "((last | previous | preev) tab | gopreev)":
    Key("cmd-shift-["),
    "tab (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8)":
    jump_tab,
    "(end | rightmost) tab":
    Key("cmd-9"),
    "marco":
    Key("cmd-f"),
    "marneck":
    Key("cmd-g"),
    "(last | prevous)":
    Key("cmd-shift-g"),
    "toggle dev tools":
    Key("cmd-alt-i"),
    "command menu":
    Key("cmd-shift-p"),
    "next panel":
    next_panel,
    "(last | previous) panel":
    last_panel,
    "show application [panel]":
    lambda m: show_panel("Application"),
    "show audit[s] [panel]":
    lambda m: show_panel("Audits"),
    "show console [panel]":
    lambda m: show_panel("Console"),
    "show element[s] [panel]":
    lambda m: show_panel("Elements"),
    "show memory [panel]":
    lambda m: show_panel("Memory"),
    "show network [panel]":
    lambda m: show_panel("Network"),
    "show performance [panel]":
    lambda m: show_panel("Performance"),
    "show security [panel]":
    lambda m: show_panel("Security"),
    "show source[s] [panel]":
    lambda m: show_panel("Sources"),
    "(refocus | focus) page":
    refocus_page,
    "[refocus] dev tools":
    open_focus_devtools,
    # Clipboard
    "cut":
    Key("cmd-x"),
    "copy":
    Key("cmd-c"),
    "paste":
    Key("cmd-v"),
    "paste same style":
    Key("cmd-alt-shift-v"),
    # "mendeley": Key("cmd-shift-m"),
    "(add | save) to mendeley":
    mendeley,
    # TODO: this should probably be specific to the page
    "submit":
    Key("cmd-enter"),
    # zotero
    "zotero":
    Key("cmd-shift-z"),
    # rearrange tabs: https://chrome.google.com/webstore/detail/rearrange-tabs/ccnnhhnmpoffieppjjkhdakcoejcpbga
    # "move tab left": Key("ctrl-shift-left"),
    # "move tab right": Key("ctrl-shift-right"),
    # "move tab left way": Key("ctrl-shift-down"),
    # vimium
    "link":
    link,
    "move tab left":
    browser.send_to_vimium("<<"),
    "move tab right":
    browser.send_to_vimium(">>"),
    "move tab new window":
    browser.send_to_vimium("W"),
    "tab (named | name | by name)":
    browser.send_to_vimium("T"),
    "tab (named | name | by name) <dgndictation>": [
        browser.send_to_vimium("T"),
        lambda m: time.sleep(0.3),
        lambda m: utils.paste_text(utils.string_capture(m)),
        lambda m: time.sleep(0.0),
        Key("enter"),
    ],
    "open most recently downloaded file":
    open_most_recently_downloaded_file,
})
コード例 #21
0
ctx.keymap({
    # working with text
    'word left': Key('alt-left'),
    'word right': Key('alt-right'),
    'words (left | right) (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)': word_travel,
    'grab left': Key('alt-shift-left'),
    'grab right': Key('alt-shift-right'),
    'cover (up | down) (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)': grab_lines,
    'killer': [Key('backspace')] * 2,
    'copy': Key('cmd-c'),
    'paste': Key('cmd-v'),
    'cut': Key('cmd-x'),
    'big dash': '–',
    'bigger dash': '—',
    'start paragraph': [Key('enter')] * 2,
    'clap': Key('cmd-right'),
    'klapper | clapper': Key('cmd-left'),
    'emoticon': Key('ctrl-cmd-space'),

    # used for textexpander
    'special': '§',

    # navigation
    'flask': Key('cmd-tab'),
    'alley': Key('alt-space'),
    'clipper': Key('alt-cmd-c'),

    # browsers
    'refresh': Key('cmd-shift-r'),

    # global
    'file save': Key('cmd-s'),
    'undo': Key('cmd-z'),
    'search': Key('cmd-f'),
    'mission': Key('ctrl-up'),
    'left (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)': multi_arrow,
    'up (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)': multi_arrow,
    'right (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)': multi_arrow,
    'down (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)': multi_arrow,
    'trooper': [Key('up')] * 9,
    'cooper': [Key('down')] * 9,

    # code
    # 'state far': 'var ',
    # 'op arrow': ' => ',
    'indent': Key('cmd-]'),
    'outdent': Key('cmd-['),
    'terminate': [Key('cmd-right'), ';'],
    'terminate comma': [Key('cmd-right'), ','],
    'terminate colon': [Key('cmd-right'), ':'],
    'terminate prop': [Key('cmd-right'), ': '],
    'plug-in': 'plugin',
    'in-line': 'inline',
    'panhandle': ['<?php  ?>'] + ([Key('left')] * 3),
    'echolocation': ['<?=  ?>'] + ([Key('left')] * 3),
    'purana | piranha': ['(  )'] + ([Key('left')] * 2),
    'spacer': ['  '] + [Key('left')],

    # termmnal
    'pseudo': 'sudo ',
    'get pull': 'git pull',
    'get push': 'git push',
    'get status': 'git status',
    'get add': 'git add ',
    'get add all': 'git add *',
    'get commit <dgndictation>': git_commit,
    'CD': 'cd ',
    'lister': 'ls',
    'list la': 'ls -la',
    'runner <dgndictation>': npm_run,

    # troublesome words
    'e-mail | e mail': 'email',

    # controlling spotify with silicio
    'spot play': Key('ctrl-cmd-shift-p'),
    'spot last': Key('ctrl-cmd-left'),
    'spot next': Key('ctrl-cmd-right'),

    # get the current bundle id
    'talon get bundle': clip.set(ui.active_app().bundle)
})
コード例 #22
0
from talon.voice import Key, Context, Str, press
from talon import ctrl, tap

ctx = Context('Notes', bundle='com.apple.Notes')


def click_mouse(xPos, yPos):
    def click_mouse_function(m):
        ctrl.mouse_move(xPos, yPos)
        ctrl.mouse_click()

    return click_mouse_function


ctx.keymap({
    'navigate': [Key('cmd-1')] * 2,
    'navigate big': click_mouse(98, 98),
})
コード例 #23
0
ctx.keymap({
    # TODO: remove duplication between the two groups of commands as we really
    # only need one set of commands (eg by completing github issue #40 (use a
    # more comprehensive git grammar))
    # git commands originally from std.py
    # git commands originally from terminal.py
    # PREFIX + "[<dgndictation>]": ["git ", text],
    PREFIX + "add [<dgndictation>]": ["git add ", text],
    PREFIX + "add partial [<dgndictation>]": ["git add -p ", text],
    PREFIX + "bisect":
    "git bisect ",
    PREFIX + "branch":
    "git branch ",
    PREFIX + "branch set up stream to [<dgndictation>]": [
        "git branch --set-upstream-to=",
        text,
    ],
    PREFIX + "branch delete [<dgndictation>]": ["git branch -D ", text],
    PREFIX + "branch all [<dgndictation>]": ["git branch -a ", text],
    PREFIX + "clone [<dgndictation>]": ["git clone ", text],
    PREFIX + "checkout master":
    "git checkout master",
    PREFIX + "checkout [<dgndictation>]": ["git checkout ", text],
    PREFIX + "checkout branch [<dgndictation>]": ["git checkout -B ", text],
    PREFIX + "cherry pick [<dgndictation>]": ["git cherry-pick ", text],
    PREFIX + "commit [<dgndictation>]":
    ['git commit -m ""', Key("left"), text],
    PREFIX + "commit amend [<dgndictation>]": [
        'git commit --amend -m ""',
        Key("left"),
        text,
    ],
    PREFIX + "commit all [<dgndictation>]":
    ['git commit -a -m ""', Key("left"), text],
    PREFIX + "config [<dgndictation>]": ["git config ", text],
    PREFIX + "config list [<dgndictation>]": ["git config --list ", text],
    PREFIX + "diff [<dgndictation>]": ["git diff ", text],
    PREFIX + "fetch":
    "git fetch ",
    PREFIX + "history":
    "git hist ",
    PREFIX + "grep":
    "git grep ",
    PREFIX + "(in it | init | initialize)":
    "git init ",
    PREFIX + "log":
    "git log ",
    PREFIX + "merge [<dgndictation>]": ["git merge ", text],
    PREFIX + "move [<dgndictation>]": ["git mv ", text],
    PREFIX + "pull [<dgndictation>]": ["git pull ", text],
    PREFIX + "pull (base | re-base | rebase | re base) [<dgndictation>]": [
        "git pull --rebase ",
        text,
    ],
    PREFIX + "push [<dgndictation>]": ["git push ", text],
    PREFIX + "push force [<dgndictation>]": ["git push --force ", text],
    PREFIX + "push force lease [<dgndictation>]":
    ["git push --force-with-lease ", text],
    PREFIX + "push set up stream [<dgndictation>]":
    ["git push --set-upstream ", text],
    PREFIX + "push set up new branch":
    "git push --set-upstream origin HEAD",
    PREFIX + "rebase continue":
    "git rebase --continue",
    PREFIX + "rebase [<dgndictation>]": ["git rebase ", text],
    PREFIX + "(remove | R M) [<dgndictation>]": ["git rm ", text],
    PREFIX + "reset [<dgndictation>]": ["git reset ", text],
    PREFIX + "reset hard":
    "git reset --hard ",
    PREFIX + "revert [<dgndictation>]": ["git revert ", text],
    PREFIX + "show":
    "git show ",
    PREFIX + "stash":
    "git stash ",
    PREFIX + "stash apply":
    "git stash apply ",
    PREFIX + "stash pop":
    "git stash pop ",
    PREFIX + "status":
    "git status ",
    PREFIX + "tag":
    "git tag ",
})
コード例 #24
0
ctx.keymap({
    'copy': Key('cmd+c'),
    'cut': Key('cmd+x'),
    'paste': Key('cmd+v'),
    'paste without formatting': Key('cmd+shift+v'),
    'undo': Key('cmd+z'),
    'redo': Key('cmd+shift+z'),
    'insert or edit link': Key('cmd+k'),
    'open link': Key('alt+enter'),
    'show common keyboard shortcuts': Key('cmd+/'),
    'save every change is automatically saved in drive': Key('cmd+s'),
    'print': Key('cmd+p'),
    'open': Key('cmd+o'),
    'find': Key('cmd+f'),
    'find and replace': Key('cmd+shift+h'),
    'find again': Key('cmd+g'),
    'find previous': Key('cmd+shift+g'),
    'hide the menus ': Key('ctrl+shift+f'),
    'insert page break': Key('cmd+enter'),
    'search the menus': Key('alt+/'),
    'bold': Key('cmd+b'),
    'italicize': Key('cmd+i'),
    'underline': Key('cmd+u'),
    'strikethrough': Key('cmd+shift+x'),
    'superscript': Key('cmd+.'),
    'subscript': Key('cmd+,'),
    'copy text formatting': Key('cmd+alt+c'),
    'paste text formatting': Key('cmd+alt+v'),
    'clear text formatting': Key('cmd+\\'),
    'increase font size': Key('cmd+shift+>'),
    'decrease font size': Key('cmd+shift+<'),
    'increase paragraph indentation': Key('cmd+]'),
    'decrease paragraph indentation': Key('cmd+['),
    'apply normal text style': Key('cmd+alt+o'),
    'apply heading style 1': Key('cmd+alt+1'),
    'apply heading style 2': Key('cmd+alt+2'),
    'apply heading style 3': Key('cmd+alt+3'),
    'apply heading style 4': Key('cmd+alt+4'),
    'apply heading style 5': Key('cmd+alt+5'),
    'apply heading style 6': Key('cmd+alt+6'),
    'left align': Key('cmd+shift+l'),
    'center align': Key('cmd+shift+e'),
    'right align': Key('cmd+shift+r'),
    'justify': Key('cmd+shift+j'),
    'numbered list': Key('cmd+shift+7'),
    'bulleted list': Key('cmd+shift+8'),
    'resize larger': Key('cmd+ctrl+k'),
    'resize larger horizontally': Key('cmd+ctrl+b'),
    'resize larger vertically': Key('cmd+ctrl+i'),
    'resize smaller': Key('cmd+ctrl+j'),
    'resize smaller horizontally': Key('cmd+ctrl+w'),
    'resize smaller vertically': Key('cmd+ctrl+q'),
    'rotate clockwise by 15 degree': Key('alt+right'),
    'rotate counterclockwise by 15 degree': Key('alt+left'),
    'rotate counterclockwise by 1 degree': Key('alt+shift+left'),
    'rotate clockwise by 1 degree': Key('alt+shift+right'),
    'close drawing editor': Key('cmd+esc'),
    'insert comment': Key('cmd+alt+m'),
    'open discussion thread': Key('cmd+alt+shift+a'),
    'enter current comment': Key('ctrl+enter'),
    'insert footnote': Key('cmd+alt+f'),
    'move to current footnote': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('e'), press('f'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next footnote': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('f'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous footnote': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('f'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'context menu': Key('cmd+shift+\\'),
    'file menu': Key('ctrl+alt+f'),
    'edit menu': Key('ctrl+alt+e'),
    'view menu': Key('ctrl+alt+v'),
    'insert menu': Key('ctrl+alt+i'),
    'format menu': Key('ctrl+alt+o'),
    'tools menu': Key('ctrl+alt+t'),
    'table menu': Key('ctrl+alt+b'),
    'help menu': Key('ctrl+alt+h'),
    'accessibility menu': Key('ctrl+alt+a'),
    'input tools menu': Key('cmd+alt+shift+k'),
    'toggle input controls': Key('cmd+shift+k'),
    'select all': Key('cmd+a'),
    'extend selection one character left': Key('shift+left'),
    'extend selection one character right': Key('shift+right'),
    'extend selection one line up': Key('shift+up'),
    'extend selection one line down': Key('shift+down'),
    'extend selection to the beginning of the line': Key('shift+home'),
    'extend selection one paragraph up': Key('alt+shift+up'),
    'extend selection one paragraph down': Key('alt+shift+down'),
    'extend selection to the end of the line': Key('shift+end'),
    'extend selection to the beginning of the document': Key('cmd+shift+up'),
    'extend selection to the end of the document': Key('cmd+shift+down'),
    'select current list item': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('e'), press('i'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'select all list items at current level': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('e'), press('o'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'enable screen reader supportlearn more about using google docs with a screen reader': Key('alt+cmd+z'),
    'speak selection': Key('ctrl+cmd+x'),
    'speak from cursor location': Key('ctrl+cmd+r'),
    'announce cursor location': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('a'), press('l'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'announce formatting at cursor location': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('a'), press('f'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'speak the table column and row header': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('h'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'speak the table cell location': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('n'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'speak the table row header': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('r'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'speak the table column header': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('c'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to next heading': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('h'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous heading': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('h'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next heading 1': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('1'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next heading 2': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('2'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next heading 3': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('3'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next heading 4': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('4'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next heading 5': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('5'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next heading 6': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('6'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous heading 1': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('1'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous heading 2': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('2'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous heading 3': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('3'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous heading 4': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('4'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous heading 5': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('5'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous heading 6': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('6'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next media': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('g'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous media': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('g'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next list': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('o'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous list': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('o'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next item in the current list': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('i'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous item in the current list': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('i'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next link': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('l'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous link': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('l'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next bookmark': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('b'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous bookmark': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('b'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to next formatting change': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('w'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to previous formatting change': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('w'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to the next edit': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('n'), press('r'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to the previous edit': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('p'), press('r'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move to the start of the table': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('s'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to the end of the table': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('d'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to the start of the table column': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('i'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to the end of the table column': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('k'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to the next table column': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('b'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to the previous table column': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('v'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to the start of the table row': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('j'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to the end of the table row': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('l'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to the next table row': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('m'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to the previous table row': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('g'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'exit table': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('t'), press('e'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to the next table': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('n'), press('t'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'move to the previous table': lambda m: (
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, down=True),
        press('p'), press('t'),
        ctrl.key_press('shift', ctrl=True, cmd=True, shift=True, up=True),
    ),
    'open revision history': Key('cmd+alt+shift+h'),
    'open explore tool': Key('cmd+alt+shift+i'),
    'open dictionary': Key('cmd+shift+y'),
    'word count': Key('cmd+shift+c'),
    'start voice typing': Key('cmd+shift+s'),
    'page up': Key('pageup'),
    'page down': Key('pagedown'),
    'move to next misspelling': Key('cmd+\''),
    'move to previous misspelling': Key('cmd+;'),
    'insert or move to header': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('o'), press('h'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'insert or move to footer': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('o'), press('f'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move focus to popup': lambda m: (
        ctrl.key_press('cmd', ctrl=True, cmd=True, down=True),
        press('e'), press('p'),
        ctrl.key_press('cmd', ctrl=True, cmd=True, up=True),
    ),
    'move focus out of document text': Key('cmd+alt+shift+m'),
    'return focus to document text': Key('esc'),
    'focus containing webpage': Key('ctrl+shift+esc'),
})
コード例 #25
0
ファイル: slack.py プロジェクト: ym-han/talon-user
    for t in translated:
        Str(f"+{t}\n")(m)
        time.sleep(0.7)


ctx = Context("slack", bundle="com.tinyspeck.slackmacgap")
ctx.keymap(
    {
        "next": [Key("f6")],
        "jump [<dgndictation>]": [Key("cmd-k"), text],
        "go (dm's | direct messages | messages)": Key("cmd-shift-k"),
        "go (and read | unread)": Key("cmd-shift-a"),
        "go (threads | thread)": Key("cmd-shift-t"),
        "go activity": Key("cmd-shift-m"),
        "go channel info": Key("cmd-shift-i"),
        "go status": Key("cmd-shift-y"),
        "go (star | stars | starred)": Key("cmd-shift-s"),
        "react [<dgndictation>]": ["+:", text],
        "emote [<dgndictation>]": [":", text],
        "toggle sidebar": Key("cmd-."),
        "go last unread": Key("alt-shift-up"),
        "go next unread": Key("alt-shift-down"),
        "annoying <dgndictation> [over]": emoji_formatter,
        "annoying reaction <dgndictation> [over]": emoji_reaction_formatter,
    }
)


def toggle_slack_dnd(amount=""):
    def _toggle_slack_dnd(m):
        window = ui.active_window()
        # Open a slack window to yourself in a browser, scrape these values out of it.
コード例 #26
0
ファイル: speech_toggle.py プロジェクト: sharonzhou/examples
    else:
        talon.disable()
        app.icon_color(1, 0, 0, 1)
    lib.menu_check(b'!Enable Speech Recognition', enable)


def on_menu(item):
    if item == '!Enable Speech Recognition':
        set_enabled(not talon.enabled)


app.register('menu', on_menu)
set_enabled(talon.enabled)

sleep_group = ContextGroup('sleepy')
sleepy = Context('sleepy', group=sleep_group)

sleepy.keymap({
    'talon sleep':
    lambda m: set_enabled(False),
    'talon wake':
    lambda m: set_enabled(True),
    'dragon mode':
    [lambda m: set_enabled(False), lambda m: engine.mimic('wake up'.split())],
    'talon mode': [
        lambda m: set_enabled(True),
        lambda m: engine.mimic('go to sleep'.split())
    ],
})
sleep_group.load()
コード例 #27
0
def press_keys(m):
    mods = get_modifiers(m)
    keys = get_keys(m)
    if mods:
        press("-".join(mods + [keys[0]]))
        keys = keys[1:]
    for k in keys:
        press(k)


ctx = Context("basic_keys")
ctx.keymap({
    "(uppercase | ship | sky) {basic_keys.alphabet}+ [(lowercase | sunk)]":
    uppercase_letters,
    "{basic_keys.modifiers}* {basic_keys.alphabet}+":
    press_keys,
    "{basic_keys.modifiers}* {basic_keys.digits}+":
    press_keys,
    "{basic_keys.modifiers}* {basic_keys.keys}+":
    press_keys,
    "(go | {basic_keys.modifiers}+) {basic_keys.arrows}+":
    press_keys,
})
ctx.set_list("alphabet", alphabet.keys())
ctx.set_list("digits", digits.keys())
ctx.set_list("keys", keys.keys())
ctx.set_list("arrows", arrows.keys())
ctx.set_list("modifiers", modifiers.keys())
ctx.set_list("keymap", keymap.keys())
コード例 #28
0
ctx.keymap({
    "say <dgndictation> [over]": text,
    "sentence <dgndictation> [over]": sentence_text,
    "comma <dgndictation> [over]": [", ", text],
    "period <dgndictation> [over]": [". ", sentence_text],
    "more <dgndictation> [over]": [" ", text],
    "word <dgnwords>": word,
    "slap": [Key("cmd-right enter")],
    "question [mark]": "?",
    "tilde": "~",
    "(bang | exclamation point)": "!",
    "dollar [sign]": "$",
    "downscore": "_",
    "colon": ":",
    "(paren | left paren)": "(",
    "(rparen | are paren | right paren)": ")",
    "(brace | left brace)": "{",
    "(rbrace | are brace | right brace)": "}",
    "(angle | left angle | less than)": "<",
    "(rangle | are angle | right angle | greater than)": ">",
    "(star | asterisk)": "*",
    "(pound | hash [sign] | octo | thorpe | number sign)": "#",
    "percent [sign]": "%",
    "caret": "^",
    "at sign": "@",
    "(and sign | ampersand | amper)": "&",
    "pipe": "|",
    "(dubquote | double quote)": '"',
    "triple quote": "'''",
    "swipe": ", ",
    "(space | skoosh)": " ",
    # "(dot dot | dotdot)": "..",
    # "cd": "cd ",
    # "cd talon home": "cd {}".format(TALON_HOME),
    # "cd talon user": "******".format(TALON_USER),
    # "cd talon plugins": "cd {}".format(TALON_PLUGINS),
    # "run make (durr | dear)": "mkdir ",
    # "run git": "git ",
    # "run git clone": "git clone ",
    # "run git diff": "git diff ",
    # "run git commit": "git commit ",
    # "run git push": "git push ",
    # "run git pull": "git pull ",
    # "run git status": "git status ",
    # "run git add": "git add ",
    # "run (them | vim)": "vim ",
    # "run ellis": "ls\n",
    # "dot pie": ".py",
    # "run make": "make\n",
    # "run jobs": "jobs\n",
    # "const": "const ",
    # "static": "static ",
    "(args | arguments)": ["()", Key("left")],
    "index": ["[]", Key("left")],
    "block": [" {}", Key("left enter enter up")],
    "empty array": "[]",
    "(empty dict | empty dictionary)": "{}",
    "plus": "+",
    "arrow": "->",
    "call": "()",
    "indirect": "&",
    "dereference": "*",
    "(op equals | assign)": " = ",
    "set to": " := ",
    "op (minus | subtract)": " - ",
    "op (plus | add)": " + ",
    "op (times | multiply)": " * ",
    "op divide": " / ",
    "op mod": " % ",
    "[op] (minus | subtract) equals": " -= ",
    "[op] (plus | add) equals": " += ",
    "[op] (times | multiply) equals": " *= ",
    "[op] divide equals": " /= ",
    "[op] mod equals": " %= ",
    "(op | is) greater [than]": " > ",
    "(op | is) less [than]": " < ",
    "(op | is) equal": " == ",
    "(op | is) not equal": " != ",
    "(op | is) greater [than] or equal": " >= ",
    "(op | is) less [than] or equal": " <= ",
    "(op (power | exponent) | to the power [of])": " ** ",
    "op and": " && ",
    "op or": " || ",
    "[op] (logical | bitwise) and": " & ",
    "[op] (logical | bitwise) or": " | ",
    "(op | logical | bitwise) (ex | exclusive) or": " ^ ",
    "[(op | logical | bitwise)] (left shift | shift left)": " << ",
    "[(op | logical | bitwise)] (right shift | shift right)": " >> ",
    "(op | logical | bitwise) and equals": " &= ",
    "(op | logical | bitwise) or equals": " |= ",
    "(op | logical | bitwise) (ex | exclusive) or equals": " ^= ",
    "[(op | logical | bitwise)] (left shift | shift left) equals": " <<= ",
    "[(op | logical | bitwise)] (right shift | shift right) equals": " >>= ",
    "new window": Key("cmd-n"),
    "next window": Key("cmd-`"),
    "(last | previous) window": Key("cmd-shift-`"),
    "(next app | swick)": Key("cmd-tab"),
    "(last | previous) app": Key("cmd-shift-tab"),
    "next tab": Key("ctrl-tab"),
    "new tab": Key("cmd-t"),
    "(dizzle | undo)": Key("cmd-z"),
    "last tab": Key("ctrl-shift-tab"),
    "next space": Key("cmd-alt-ctrl-right"),
    "(last | previous) space": Key("cmd-alt-ctrl-left"),
    'copy active bundle': copy_bundle,
})
コード例 #29
0
ファイル: emoji.py プロジェクト: mattsolo1/talon_user
        time.sleep(0.25)
        press('cmd-c', wait=2000)
        time.sleep(0.25)
        old_text = clip.get()

        utils.insert('+' + emojis[key])
        press('enter', wait=2000)

        print(old_text)
        print(old_clipboard)
        if old_clipboard != old_text:
            press('cmd-a', wait=2000)
            time.sleep(0.25)
            utils.insert(old_text)
    finally:
        clip.set(old_clipboard)


keymap = {
    'emo {}'.format(name): representation
    for name, representation in emojis.items()
}
keymap.update({
    'react {}'.format(utils.select_single(emojis.keys())): react,
    # 'react {}'.format(name): ['+'+representation]
    # for name, representation in emojis.items()
})

print(keymap)
ctx.keymap(keymap)
コード例 #30
0
ctx.keymap({
    "(address bar | focus address | focus url | url)":
    focus_address_bar,
    "copy url":
    Key("escape y y"),
    "back[ward]":
    back,
    "forward":
    forward,
    "reload":
    Key("cmd-r"),
    "hard reload":
    Key("cmd-shift-r"),
    "new tab":
    Key("cmd-t"),
    "close tab":
    Key("cmd-w"),
    "(reopen | unclose) tab":
    Key("cmd-shift-t"),
    "(next tab | gonext)":
    Key("cmd-shift-]"),
    "((last | prevous | preev) tab | gopreev)":
    Key("cmd-shift-["),
    "tab (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8)":
    jump_tab,
    "(end | rightmost) tab":
    Key("cmd-9"),
    "marco":
    Key("cmd-f"),
    "marneck":
    Key("cmd-g"),
    "(last | prevous)":
    Key("cmd-shift-g"),
    "developer tools":
    Key("cmd-alt-i"),
    "command menu":
    Key("cmd-shift-p"),
    # "next panel": next_panel,
    # "(last | prevous) panel": last_panel,
    # "show application [panel]": lambda m: show_panel("Application"),
    # "show audit[s] [panel]": lambda m: show_panel("Audits"),
    # "show console [panel]": lambda m: show_panel("Console"),
    # "show element[s] [panel]": lambda m: show_panel("Elements"),
    # "show memory [panel]": lambda m: show_panel("Memory"),
    # "show network [panel]": lambda m: show_panel("Network"),
    # "show performance [panel]": lambda m: show_panel("Performance"),
    # "show security [panel]": lambda m: show_panel("Security"),
    # "show source[s] [panel]": lambda m: show_panel("Sources"),
    "(refocus | focus) page":
    refocus_page,
    # "[refocus] dev tools": open_focus_devtools,
    # Clipboard
    "cut":
    Key("cmd-x"),
    "copy":
    Key("cmd-c"),
    "paste":
    Key("cmd-v"),
    "paste same style":
    Key("cmd-alt-shift-v"),
    # extensions
    # TODO: this should probably bem specific to the page
    "submit":
    Key("cmd-enter"),
    # t
    "switch mode":
    Key("ctrl-alt-escape"),
    # last pass
    # tridactyl
    "new personal tab":
    command_line('tabopen -c personal'),
    "(switch to personal [container] | personal container)":
    command_line('composite get_current_url | tabopen -c personal'),
    "show add-ons":
    Key('cmd-shift-a'),
})