예제 #1
0
    def switcher_focus(name: str):
        """Focus a new application by  name"""

        wanted_app = name

        # we should use the capture result directly if it's already in the
        # list of running applications
        # otherwise, name is from <user.text> and we can be a bit fuzzier
        if name not in running_application_dict:

            # don't process silly things like "focus i"
            if len(name) < 3:
                print("switcher_focus skipped: len({}) < 3".format(name))
                return

            running = ctx.lists["self.running"]
            wanted_app = None

            for running_name in running.keys():

                if running_name == name or running_name.lower().startswith(
                    name.lower()
                ):
                    wanted_app = running[running_name]
                    break

            if wanted_app is None:
                return

        for cur_app in ui.apps():
            if cur_app.name == wanted_app and not cur_app.background:
                cur_app.focus()

                # there is currently only a reliable way to do this on mac
                if app.platform == "mac":
                    while cur_app != ui.active_app():
                        time.sleep(0.1)

                break
예제 #2
0
def copy_bundle(m):
    bundle = ui.active_app().bundle
    clip.set(bundle)
    app.notify('Copied app bundle', body='{}'.format(bundle))
예제 #3
0
 def switcher_focus(name: str):
     """Focus a new application by name"""
     global last_focused_app
     last_focused_app = ui.active_app()
     app = actions.user.get_running_app(name)
     actions.user.switcher_focus_app(app)
예제 #4
0
def copy_bundle(_):
    bundle = ui.active_app().bundle
    clip.set(bundle)
    app.notify("Copied app bundle", body="{}".format(bundle))
예제 #5
0
    if event in ("app_activate", "app_launch", "app_close", "win_open",
                 "win_close"):
        global last_app
        global last_win
        current_app = ui.active_app()
        try:
            current_win = ui.active_window()
        except:
            current_win = None
        # Make sure the window has changed: prevents random toggles when using affected apps
        if (last_app, last_win) != (current_app, current_win):
            (last_app, last_win) = (current_app, current_win)
            auto_toggle(current_app, current_win)


last_app = ui.active_app()
# last_win = ui.active_window()
last_win = None

ui.register("", ui_event)

###########
# The following voice commands might better belong in misc/mouse.py, but are
# included here to be more self-contained.
###########

# from talon.voice import Context, Key # moved to top

ctx1 = Context("hiss_to_scroll")
ctx1.keymap({
    '(toggle hiss | hissy)': [toggle_enabled(), set_speed(1)],
예제 #6
0
 def tKeyM(m):
     if is_tridactyl(active_app(), None):
         return Key("shift-escape " + key + " shift-escape")(m)
     else:
         return Key(key)(m)
예제 #7
0
    '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)
})
예제 #8
0
 def copy_bundle():
     """Copy application bundle"""
     bundle = ui.active_app().bundle
     clip.set(bundle)
     app.notify("Copied app bundle", body="{}".format(bundle))
예제 #9
0
from talon import clip, ui
from talon.voice import Context

context = Context("bundle")

context.keymap(
    {"copy [app] bundle": lambda m: clip.set(ui.active_app().bundle)})