Skip to content

Commit

Permalink
Merge branch 'knausj85-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
nsaphra committed Mar 22, 2022
2 parents 2f01422 + 4182692 commit 3980979
Show file tree
Hide file tree
Showing 247 changed files with 8,846 additions and 2,757 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Dev stuff
__pycache__
*.sw?
# Locally generated
/settings
.vscode/settings.json
136 changes: 76 additions & 60 deletions README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions apps/1password/mac.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from talon import Context, actions
ctx = Context()

#i don't see a need to restrict the app here, this just defines the actions
#each app can support appropriate voice commands as needed
#the below are for 1password, redefine as needed
ctx.matches = r"""
os: mac
"""
@ctx.action_class('user')
class UserActions:
def password_fill():
actions.key('cmd-\\')
def password_show():
actions.key('cmd-alt-\\')
def password_new():
actions.key('cmd-i')
def password_duplicate():
actions.key('cmd-d')
def password_edit():
actions.key('cmd-e')
def password_delete():
actions.key('cmd-backspace')
24 changes: 0 additions & 24 deletions apps/1password/password_manager.mac.talon

This file was deleted.

24 changes: 0 additions & 24 deletions apps/1password/password_manager.win.talon

This file was deleted.

24 changes: 24 additions & 0 deletions apps/1password/win.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from talon import Context, actions
ctx = Context()

#i don't see a need to restrict the app here, this just defines the actions
#each app can support appropriate voice commands as needed
#the below are for 1password, redefine as needed
ctx.matches = r"""
os: windows
"""

@ctx.action_class('user')
class UserActions:
def password_fill():
actions.key('ctrl-\\\\')
def password_show():
actions.key('alt-ctrl-\\\\')
def password_new():
actions.key('ctrl-n')
def password_duplicate():
actions.key('ctrl-d')
def password_edit():
actions.key('ctrl-e')
def password_delete():
actions.key('ctrl-delete')
15 changes: 15 additions & 0 deletions apps/adobe/adobe_acrobat_reader_dc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from talon import Module

# --- App definition ---
mod = Module()
mod.apps.adobe_acrobat_reader_dc = """
os: windows
and app.name: Adobe Acrobat DC
os: windows
and app.exe: Acrobat.exe
os: windows
and app.name: Adobe Acrobat Reader DC
os: windows
and app.exe: AcroRd32.exe
"""
# TODO: mac context and implementation
5 changes: 5 additions & 0 deletions apps/adobe/adobe_acrobat_reader_dc.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
app: adobe_acrobat_reader_dc
-
# Set tags
tag(): user.tabs
tag(): user.pages
40 changes: 40 additions & 0 deletions apps/adobe/win.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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")
19 changes: 19 additions & 0 deletions apps/calibre/calibre.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from talon import Module

# --- App definition ---
mod = Module()
mod.apps.calibre = """
os: windows
and app.name: calibre.exe
os: windows
and app.exe: calibre.exe
os: windows
and app.name: calibre-parallel.exe
os: windows
and app.exe: calibre-parallel.exe
"""
mod.apps.calibre = """
os: linux
app.name: calibre
"""
# TODO: mac context
30 changes: 30 additions & 0 deletions apps/calibre/calibre_viewer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from talon import Module, Context, actions

# --- App definition ---
mod = Module()
mod.apps.calibre_viewer = """
app: calibre
title: /E-book viewer$/
title: /eBook-Betrachter$/
"""

# Context matching
ctx = Context()
ctx.matches = """
os: windows
os: linux
app: calibre_viewer
"""
# TODO: mac implementation


# --- Implement actions ---
@ctx.action_class("user")
class UserActions:
# user.pages
def page_next(): actions.key("pagedown")
def page_previous(): actions.key("pageup")
def page_final(): actions.key("ctrl-end")
# user.chapters
def chapter_next(): actions.key("ctrl-pagedown")
def chapter_previous(): actions.key("ctrl-pageup")
5 changes: 5 additions & 0 deletions apps/calibre/calibre_viewer.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
app: calibre_viewer
-
# Set tags
tag(): user.pages
tag(): user.chapters
68 changes: 0 additions & 68 deletions apps/chrome/chrome.mac.talon

This file was deleted.

28 changes: 25 additions & 3 deletions apps/chrome/chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,29 @@
mod.apps.chrome = "app.name: Google Chrome"
mod.apps.chrome = """
os: windows
and app.name: Google Chrome
os: windows
and app.exe: chrome.exe
"""
mod.apps.chrome = """
os: mac
and app.bundle: com.google.Chrome
"""
mod.apps.chrome = """
os: mac
and app.bundle: org.chromium.Chromium
"""
mod.apps.chrome = """
os: linux
app.exe: chrome
app.exe: chromium-browser
"""
mod.apps.chrome = """
os: linux
and app.name: Google-chrome
"""
ctx.matches = r"""
app: chrome
"""


@ctx.action_class("user")
class user_actions:
def tab_jump(number: int):
Expand All @@ -34,6 +44,18 @@ def tab_final():
else:
actions.key("ctrl-9")

def tab_close_wrapper():
actions.sleep("180ms")
actions.app.tab_close()

def tab_duplicate():
"""Limitation: this will not work if the text in your address bar has been manually edited.
Long-term we want a better shortcut from browsers.
"""
actions.browser.focus_address()
actions.sleep("180ms")
actions.key("alt-enter")


@ctx.action_class("browser")
class browser_actions:
Expand Down
Loading

0 comments on commit 3980979

Please sign in to comment.