Ejemplo n.º 1
0
    def switcher_launch(path: str):
        """Launch a new application by path"""
        if app.platform == "windows":
            is_valid_path = False
            try:
                current_path = Path(path)
                is_valid_path = current_path.is_file()
                # print("valid path: {}".format(is_valid_path))

            except:
                # print("invalid path")
                is_valid_path = False

            if is_valid_path:
                # print("path: " + path)
                ui.launch(path=path)

            else:
                # print("envelop")
                actions.key("super-s")
                actions.sleep("300ms")
                actions.insert("apps: {}".format(path))
                actions.sleep("150ms")
                actions.key("enter")

        else:
            ui.launch(path=path)
Ejemplo n.º 2
0
def launch_app(m, name=None):
    if name is None:
        name = str(m['switcher.launch'][0])

    path = launch.get(name)
    if path:
        ui.launch(path=path)
Ejemplo n.º 3
0
def launch_app(m):
    name = str(m['switcher.launch'][0])
    ##  Helpful for debugging:
    # clip.set(name)
    # app.notify('Function name:', body=name)
    path = launch.get(name)
    if path:
        ui.launch(path=path)
Ejemplo n.º 4
0
def launch_app(m=None, name=None):
    if m:
        name = str(m["switcher.launch"][0])
    elif not name:
        raise ValueError("must provide name or m")

    path = launch.get(name)
    if path:
        ui.launch(path=path)
Ejemplo n.º 5
0
 def switcher_launch(path: str):
     """Launch a new application by path"""
     if app.platform == "windows":
         if "." not in path:
             actions.key("super-s")
             actions.sleep("300ms")
             actions.insert("apps: {}".format(path))
             actions.sleep("150ms")
             actions.key("enter")
         else:
             # print("path: " + path)
             os.startfile(path)
     else:
         ui.launch(path=path)
Ejemplo n.º 6
0
 def switcher_launch(path: str):
     """Launch a new application by path (all OSes), or AppUserModel_ID path on Windows"""
     if app.platform != "windows":
         ui.launch(path=path)
     else:
         is_valid_path = False
         try:
             current_path = Path(path)
             is_valid_path = current_path.is_file()
         except:
             is_valid_path = False
         if is_valid_path:
             ui.launch(path=path)
         else:
             cmd = "explorer.exe shell:AppsFolder\\{}".format(path)
             subprocess.Popen(cmd, shell=False)
Ejemplo n.º 7
0
def sleep_hotkey(typ, e):
    # print(e)
    if e == 'cmd-alt-ctrl-shift-tab' and e.down:
        speech.set_enabled(not speech.talon.enabled)
        if speech.talon.enabled:
            if microphone.manager.active_mic() is None:
                utils.use_mic("krisp microphone")
            utils.mic_uses_volume({
                "Plantronics Blackwire 435": 100,
                "ATR2USB": 80,
                "AndreaMA": 35,
            })
            if not engine.endpoint:
                ui.launch(bundle="com.dragon.dictate")
        else:
            utils.set_input_volume(
                0)  # Fallback, only override with present mic.
        e.block()
    return True
Ejemplo n.º 8
0
ctx = Context("misc")
ctx.vocab = ["Jira"]
ctx.keymap({
    "learn selection":
    learn_selection,
    "(alfred | launch)":
    Key("cmd-space"),
    "(alfred | launch) <dgndictation> [over]":
    [Key("cmd-space"), delay(0.4), text],
    "correct":
    select_last_insert,
    "toggle dark":
    lambda _: subprocess.check_call(
        ["open", "/System/Library/CoreServices/ScreenSaverEngine.app"]),
    "terminal":
    lambda _: [ui.launch(bundle="com.googlecode.iterm2")],
    # "focus GoLand": lambda _: [ui.launch(bundle="com.jetbrains.goland")],
    # "focus PyCharm": lambda _: [ui.launch(bundle="com.jetbrains.pycharm")],
    "go toolbox":
    Key("cmd+shift+ctrl+f1"),
    "password amigo":
    keychain.find("login", "user"),
    "snippet [<dgndictation>]": [  # XXX Doesn't really go here
        Key("cmd-shift-j"),
        delay(0.1),
        text,
    ],
    # "under": delay(0.2),
    # Clipboard
    "clippings [<dgndictation>]": [Key("cmd+ctrl+c"),
                                   delay(0.1), text],
Ejemplo n.º 9
0
 def switcher_launch(path: str):
     """Launch a new application by path"""
     ui.launch(path=path)
Ejemplo n.º 10
0
def launch_app(m):
    name = str(m['switcher.launch'][0])
    path = launch.get(name)
    if path:
        ui.launch(path=path)
from talon.voice import Context, Key, press
from ..utils import time_delay
from talon import ui

context = Context("common_apps")

keymap = {
    "launch chrome":
    lambda m: ui.
    launch(path=
           "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"),
    "launch pycharm":
    lambda m: ui.launch(
        path=
        "C:\\Users\\herse\\AppData\\Local\\JetBrains\\PyCharm Community Edition 2019.2.3\\bin\\pycharm64.exe"
    ),
    "launch slack":
    lambda m: ui.launch(
        path="C:\\Users\\herse\\AppData\\Local\\slack\\app-4.2.0\\slack.exe"),
    "launch vim":
    lambda m: ui.launch(path="C:\\Program Files (x86)\\Vim\\vim82\\gvim.exe"),
    "launch (notepad | note pad)":
    lambda m: ui.launch(path="C:\\WINDOWS\\system32\\notepad.exe"),
    "launch outlook":
    lambda m: ui.launch(
        path="C:\\Program Files\\Microsoft Office\\root\\Office16\\OUTLOOK.EXE"
    ),
    "launch (atom | adam)":
    lambda m: ui.launch(
        path="C:\\Users\\herse\\AppData\\Local\\atom\\app-1.42.0\\atom.exe"),
    "launch kindle":
Ejemplo n.º 12
0
from talon import macos, ui, os
from talon.voice import Context, Key

ctx = Context('aux_keys')
ctx.keymap({
    'brightness down':
    Key('brightness_down'),
    'brightness up':
    Key('brightness_up'),
    'mission control':
    lambda m: macos.dock_notify('com.apple.expose.awake'),
    'apps':
    lambda m: ui.launch(bundle='com.apple.launchpad.launcher'),
    'backlight down':
    Key('backlight_down'),
    'backlight up':
    Key('backlight_up'),
    'rewind':
    Key('rewind'),
    'play | pause':
    Key('play'),
    'fast forward':
    Key('fast_forward'),
    'mute':
    Key('mute'),
    'volume down':
    Key('volume_down'),
    'volume up':
    Key('volume_up'),
    'eff one':
    Key('f1'),
Ejemplo n.º 13
0
ctx = Context("misc")
ctx.vocab = ["Jira"]
ctx.keymap({
    "learn selection":
    learn_selection,
    "(alfred | launch)":
    Key("cmd-space"),
    "(alfred | launch) <dgndictation> [over]":
    [Key("cmd-space"), delay(0.4), text],
    "correct":
    select_last_insert,
    "toggle dark":
    lambda _: subprocess.check_call(
        ["open", "/System/Library/CoreServices/ScreenSaverEngine.app"]),
    "terminal":
    lambda _: [ui.launch(bundle="com.googlecode.iterm2")],
    "focus GoLand":
    lambda _: [ui.launch(bundle="com.jetbrains.goland")],
    "focus PyCharm":
    lambda _: [ui.launch(bundle="com.jetbrains.pycharm")],
    "go toolbox":
    Key("cmd+shift+ctrl+f1"),
    "password amigo":
    keychain.find("login", "user"),
    "snippet [<dgndictation>]": [  # XXX Doesn't really go here
        Key("cmd-shift-j"),
        delay(0.1),
        text,
    ],
    "under":
    delay(0.2),
Ejemplo n.º 14
0
def launch_rstudio(*unneeded):
    path = launch.get('RStudio')
    ui.launch(path=path)
Ejemplo n.º 15
0

def launch_rstudio(*unneeded):
    path = launch.get('RStudio')
    ui.launch(path=path)


ctx = Context("switcher")
ctx.keymap({
    "fox {switcher.running}": switch_app,
    "launch {switcher.launch}": launch_app,
    # # custom switchers here
    # "madam": lambda x: switch_app(x, "Atom"),
    "asked judy": launch_rstudio,
    # "system preferences": lambda x: switch_app(x, "System Preferences"),
    "launch messages": lambda m: ui.launch(bundle='com.apple.iChat'),
    "launch calendar": lambda m: ui.launch(bundle='com.apple.iCal'),
    "launch finder": lambda m: ui.launch(bundle='com.apple.finder'),
    "launch terminal": lambda m: ui.launch(bundle='com.apple.Terminal'),
})

# hardcoded_application_names = {"term": "iTerm2", "ink": "Inkdrop"}


def update_lists():
    global running
    global launch
    new = {}
    for app in ui.apps():
        if app.background and not app.windows():
            continue
Ejemplo n.º 16
0
def launch_app(m):
    name = str(m['switcher.launch'][0])
    path = launch.get(name)
    if path:
        ui.launch(path=path)
    move_mouse_to_center_of_application()
Ejemplo n.º 17
0
 def file_manager_terminal_here():
     actions.key("ctrl-l")
     with clip.capture() as path:
         actions.edit.copy()
     ui.launch(path="gnome-terminal",
               args=[f"--working-directory={path.get()}"])
Ejemplo n.º 18
0
 def launch_app(path: str):
     """Launch a new application by path"""
     ui.launch(path=path)