Skip to content

Commit

Permalink
Support for Foxit Reader for PDFs (#1403)
Browse files Browse the repository at this point in the history
Adds basic support for the foxit reader on windows.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jeff Knaus <knaus.jeff@gmail.com>
  • Loading branch information
3 people authored Apr 14, 2024
1 parent 679bdfb commit 5e1e579
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
64 changes: 64 additions & 0 deletions apps/foxit_reader/foxit_reader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
from talon import Context, Module, actions

mod = Module()
ctx = Context()

# --- App definition ---
mod.apps.foxit_reader = r"""
os: windows
and app.name: /^Foxit Reader/
os: windows
and app.exe: /^foxitreader\.exe$/i
os: windows
and app.name: Foxit PDF Reader
os: windows
and app.exe: /^foxitpdfreader\.exe$/i
"""
# Context matching
ctx.matches = """
app: foxit_reader
"""


@ctx.action_class("app")
class AppActions:
# app.tabs
def tab_open():
actions.key("ctrl-o")

def tab_reopen():
actions.app.notify("Foxit does not support this action.")


@ctx.action_class("user")
class UserActions:
# user.tabs
def tab_jump(number):
actions.app.notify("Foxit does not support this action.")

def tab_final():
actions.app.notify("Foxit does not support this action.")

def tab_duplicate():
actions.app.notify("Foxit does not support this action.")

# user.pages
def page_current() -> int:
actions.key("ctrl-g")
page = actions.edit.selected_text()
return int(page)

def page_next():
actions.key("right")

def page_previous():
actions.key("left")

def page_jump(number: int):
actions.key("ctrl-g")
actions.insert(str(number))
actions.key("enter")

def page_final():
# actions.key("fn-right")
actions.key("end")
11 changes: 11 additions & 0 deletions apps/foxit_reader/foxit_reader.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
app: foxit_reader
-
tag(): user.tabs
tag(): user.pages

tab close all: key(ctrl-shift-w)

[page] rotate right: key("shift-ctrl-keypad_equals")
[page] rotate left: key("shift-ctrl-keypad_minus")

go back: key(alt-left)

0 comments on commit 5e1e579

Please sign in to comment.