init commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
from talon import Module
|
||||
|
||||
# --- App definition ---
|
||||
mod = Module()
|
||||
mod.apps.adobe_acrobat_reader_dc = r"""
|
||||
os: windows
|
||||
and app.name: Adobe Acrobat DC
|
||||
os: windows
|
||||
and app.exe: /^acrobat\.exe$/i
|
||||
os: windows
|
||||
and app.name: Adobe Acrobat Reader DC
|
||||
os: windows
|
||||
and app.exe: /^acrord32\.exe$/i
|
||||
"""
|
||||
# TODO: mac context and implementation
|
||||
@@ -0,0 +1,5 @@
|
||||
app: adobe_acrobat_reader_dc
|
||||
-
|
||||
# Set tags
|
||||
tag(): user.tabs
|
||||
tag(): user.pages
|
||||
@@ -0,0 +1,61 @@
|
||||
from talon import Context, actions
|
||||
|
||||
# Context matching
|
||||
ctx = Context()
|
||||
ctx.matches = """
|
||||
os: windows
|
||||
app: adobe_acrobat_reader_dc
|
||||
"""
|
||||
|
||||
|
||||
# --- Implement actions ---
|
||||
@ctx.action_class("app")
|
||||
class AppActions:
|
||||
# app.tabs
|
||||
def tab_next():
|
||||
actions.key("ctrl-tab")
|
||||
|
||||
def tab_previous():
|
||||
actions.key("ctrl-shift-tab")
|
||||
|
||||
|
||||
@ctx.action_class("edit")
|
||||
class EditActions:
|
||||
def zoom_in():
|
||||
actions.key("ctrl-0") # in german version
|
||||
|
||||
def zoom_out():
|
||||
actions.key("ctrl-1") # in german version TODO: differentiate languages
|
||||
|
||||
def zoom_reset():
|
||||
actions.key("ctrl-2")
|
||||
|
||||
|
||||
@ctx.action_class("user")
|
||||
class UserActions:
|
||||
# user.pages
|
||||
def page_current():
|
||||
actions.key("ctrl-shift-n")
|
||||
page = actions.edit.selected_text()
|
||||
actions.key("tab:2 enter")
|
||||
return int(page)
|
||||
|
||||
def page_next():
|
||||
actions.key("ctrl-pagedown")
|
||||
|
||||
def page_previous():
|
||||
actions.key("ctrl-pageup")
|
||||
|
||||
def page_jump(number: int):
|
||||
actions.key("ctrl-shift-n")
|
||||
actions.insert(str(number))
|
||||
actions.key("enter")
|
||||
|
||||
def page_final():
|
||||
actions.key("end")
|
||||
|
||||
def page_rotate_right():
|
||||
actions.key("shift-ctrl-0")
|
||||
|
||||
def page_rotate_left():
|
||||
actions.key("shift-ctrl-1")
|
||||
Reference in New Issue
Block a user