init commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
from talon import Context, Module, actions
|
||||
|
||||
# --- App definition ---
|
||||
mod = Module()
|
||||
mod.apps.okular = r"""
|
||||
os: windows
|
||||
and app.name: okular.exe
|
||||
os: windows
|
||||
and app.exe: /^okular\.exe$/i
|
||||
"""
|
||||
mod.apps.okular = """
|
||||
os: linux
|
||||
and app.name: okular
|
||||
"""
|
||||
# TODO: mac context and implementation
|
||||
|
||||
# Context matching
|
||||
ctx = Context()
|
||||
ctx.matches = """
|
||||
os: windows
|
||||
os: linux
|
||||
app: okular
|
||||
"""
|
||||
|
||||
|
||||
# --- Implement actions ---
|
||||
@ctx.action_class("user")
|
||||
class UserActions:
|
||||
# user.pages
|
||||
def page_current():
|
||||
actions.key("ctrl-g")
|
||||
page = actions.edit.selected_text()
|
||||
actions.key("escape")
|
||||
return int(page)
|
||||
|
||||
def page_next():
|
||||
actions.key("l")
|
||||
|
||||
def page_previous():
|
||||
actions.key("h")
|
||||
|
||||
def page_jump(number: int):
|
||||
actions.key("ctrl-g")
|
||||
actions.sleep("100ms")
|
||||
actions.insert(str(number))
|
||||
actions.key("enter")
|
||||
|
||||
def page_final():
|
||||
actions.key("ctrl-end")
|
||||
@@ -0,0 +1,4 @@
|
||||
app: okular
|
||||
-
|
||||
# Set tags
|
||||
tag(): user.pages
|
||||
Reference in New Issue
Block a user