init commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
from talon import Context, Module, actions, app
|
||||
|
||||
ctx = Context()
|
||||
mod = Module()
|
||||
|
||||
mod.apps.chrome = "app.name: Google Chrome"
|
||||
mod.apps.chrome = r"""
|
||||
os: windows
|
||||
and app.exe: /^chrome\.exe$/i
|
||||
"""
|
||||
mod.apps.chrome = """
|
||||
os: mac
|
||||
app.bundle: com.google.Chrome
|
||||
app.bundle: com.google.Chrome.canary
|
||||
app.bundle: org.chromium.Chromium
|
||||
"""
|
||||
mod.apps.chrome = """
|
||||
os: linux
|
||||
app.exe: chrome
|
||||
app.exe: chromium-browser
|
||||
app.exe: chromium
|
||||
"""
|
||||
mod.apps.chrome = """
|
||||
os: linux
|
||||
and app.name: Google-chrome
|
||||
"""
|
||||
|
||||
ctx.matches = r"""
|
||||
app: chrome
|
||||
"""
|
||||
|
||||
|
||||
@mod.action_class
|
||||
class Actions:
|
||||
def chrome_mod(key: str):
|
||||
"""Press the specified key with the correct modifier key for the OS"""
|
||||
if app.platform == "mac":
|
||||
actions.key(f"cmd-{key}")
|
||||
else:
|
||||
actions.key(f"ctrl-{key}")
|
||||
|
||||
|
||||
@ctx.action_class("user")
|
||||
class UserActions:
|
||||
def tab_close_wrapper():
|
||||
actions.sleep("180ms")
|
||||
actions.app.tab_close()
|
||||
|
||||
|
||||
@ctx.action_class("browser")
|
||||
class BrowserActions:
|
||||
def show_extensions():
|
||||
actions.app.tab_open()
|
||||
actions.browser.go("chrome://extensions")
|
||||
@@ -0,0 +1,14 @@
|
||||
app: chrome
|
||||
-
|
||||
tag(): browser
|
||||
tag(): user.tabs
|
||||
|
||||
profile switch: user.chrome_mod("shift-m")
|
||||
|
||||
tab search: user.chrome_mod("shift-a")
|
||||
|
||||
tab search <user.text>$:
|
||||
user.chrome_mod("shift-a")
|
||||
sleep(200ms)
|
||||
insert("{text}")
|
||||
key(down)
|
||||
Reference in New Issue
Block a user