init commit
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
from talon import Context, Module
|
||||
|
||||
# --- App definitions ---
|
||||
# Main app TODO: mac context
|
||||
mod = Module()
|
||||
mod.apps.thunderbird = r"""
|
||||
os: windows
|
||||
and app.name: Thunderbird
|
||||
os: windows
|
||||
and app.exe: /^thunderbird\.exe$/i
|
||||
"""
|
||||
mod.apps.thunderbird = """
|
||||
os: linux
|
||||
and app.name: Thunderbird
|
||||
"""
|
||||
|
||||
# Inbox tab TODO: also matches emails opened in new tab
|
||||
mod.apps.thunderbird_inbox = """
|
||||
app: thunderbird
|
||||
title: /@/
|
||||
"""
|
||||
|
||||
# Calendar tab (lightning)
|
||||
months = [
|
||||
"January", # English
|
||||
"February",
|
||||
"March",
|
||||
"April",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"August",
|
||||
"September",
|
||||
"October",
|
||||
"November",
|
||||
"December",
|
||||
"Januar", # German
|
||||
"Februar",
|
||||
"März",
|
||||
"Mai",
|
||||
"Juni",
|
||||
"Juli",
|
||||
"Oktober",
|
||||
"Dezember",
|
||||
]
|
||||
mod.apps.thunderbird_calendar = f"""
|
||||
app: thunderbird
|
||||
title: Calendar - Mozilla Thunderbird
|
||||
title: Kalender - Mozilla Thunderbird
|
||||
title: /({"|".join(map(lambda m: m + " ", months))})/
|
||||
"""
|
||||
|
||||
# Tasks tab
|
||||
mod.apps.thunderbird_tasks = """
|
||||
app: thunderbird
|
||||
title: Tasks - Mozilla Thunderbird
|
||||
title: Aufgaben - Mozilla Thunderbird
|
||||
"""
|
||||
|
||||
# Mail composer window
|
||||
mod.apps.thunderbird_composer = """
|
||||
app: thunderbird
|
||||
title: /Write: /
|
||||
title: /Verfassen: /
|
||||
"""
|
||||
|
||||
# Address book popup window
|
||||
mod.apps.thunderbird_contacts = """
|
||||
app: thunderbird
|
||||
title: Address Book
|
||||
title: Adressbuch
|
||||
"""
|
||||
|
||||
# Context matching
|
||||
ctx = Context()
|
||||
ctx.matches = r"""
|
||||
app: thunderbird
|
||||
"""
|
||||
|
||||
|
||||
# --- Define actions ---
|
||||
@mod.action_class
|
||||
class UserActions:
|
||||
def thunderbird_mod(keys: str):
|
||||
"""Press keys with modifier ctrl or cmd"""
|
||||
|
||||
def thunderbird_calendar_view(number: int):
|
||||
"""Select between calendar view tabs"""
|
||||
|
||||
|
||||
# --- Implement actions ---
|
||||
@ctx.action_class("app")
|
||||
class AppActions:
|
||||
# app.tabs
|
||||
# not possible in thunderbird
|
||||
def tab_open():
|
||||
pass
|
||||
@@ -0,0 +1,14 @@
|
||||
app: thunderbird
|
||||
and not app: thunderbird_contacts
|
||||
and not app: thunderbird_composer
|
||||
-
|
||||
# Set tags
|
||||
tag(): user.tabs
|
||||
|
||||
# navigate tabs
|
||||
go (mails | messages | inbox): user.tab_jump(1)
|
||||
go (calendar | lightning): user.thunderbird_mod("shift-c")
|
||||
go tasks: user.thunderbird_mod("shift-d")
|
||||
# open windows
|
||||
(open address [book] | address book | open contacts): user.thunderbird_mod("shift-b")
|
||||
dev tools: user.thunderbird_mod("shift-i")
|
||||
@@ -0,0 +1,13 @@
|
||||
app: thunderbird_calendar
|
||||
-
|
||||
# event/task
|
||||
event new: user.thunderbird_mod("i")
|
||||
task new: user.thunderbird_mod("d")
|
||||
(task | event) delete: key(delete)
|
||||
# layout
|
||||
toggle today: key(f11)
|
||||
view <number_small>: user.thunderbird_calendar_view(number_small)
|
||||
view day: user.thunderbird_calendar_view(1)
|
||||
view week: user.thunderbird_calendar_view(2)
|
||||
view multi [week]: user.thunderbird_calendar_view(3)
|
||||
view month: user.thunderbird_calendar_view(4)
|
||||
@@ -0,0 +1,15 @@
|
||||
app: thunderbird_composer
|
||||
-
|
||||
# mail
|
||||
(draft | mail | message) save: user.thunderbird_mod("s")
|
||||
(draft | mail | message) print: user.thunderbird_mod("p")
|
||||
(draft | mail | message) send: user.thunderbird_mod("enter")
|
||||
# layout
|
||||
toggle contacts: key(f9)
|
||||
# navigation
|
||||
go (inbox | thunderbird | main): user.thunderbird_mod("1")
|
||||
# edit
|
||||
cite paste: user.thunderbird_mod("shift-o")
|
||||
(unformatted | raw) paste: user.thunderbird_mod("shift-v")
|
||||
link new: user.thunderbird_mod("k")
|
||||
link delete: user.thunderbird_mod("shift-k")
|
||||
@@ -0,0 +1,9 @@
|
||||
app: thunderbird_contacts
|
||||
-
|
||||
contact new: user.thunderbird_mod("n")
|
||||
contact edit: user.thunderbird_mod("i")
|
||||
contact delete: key(delete)
|
||||
contact print: user.thunderbird_mod("p")
|
||||
contact message: user.thunderbird_mod("m")
|
||||
contact up: key(up)
|
||||
contact down: key(down)
|
||||
@@ -0,0 +1,29 @@
|
||||
app: thunderbird_inbox
|
||||
-
|
||||
# navigate
|
||||
(mail | message) open: key(enter)
|
||||
(mail | message) (up | last): key(b)
|
||||
(mail | message) (down | next): key(f)
|
||||
unread [mail | message] (up | last): key(p)
|
||||
unread [mail | message] (down | next): key(n)
|
||||
go home: key(alt-home)
|
||||
toggle (mail | message) [pane]: key(f8)
|
||||
# mark
|
||||
(mail | message) (favorite | unfavorite): key(s)
|
||||
(mail | message) (read | unread): key(m)
|
||||
(mail | message) (watch | unwatch): key(w)
|
||||
(mail | message) (ignore | unignore): key(k)
|
||||
(mail | message) suspend: key(c)
|
||||
(mail | message) spam: key(j)
|
||||
# send
|
||||
(mail | message) new: user.thunderbird_mod("n")
|
||||
(mail | message) edit: user.thunderbird_mod("e")
|
||||
(mail | message) reply sender: user.thunderbird_mod("r")
|
||||
(mail | message) reply all: user.thunderbird_mod("shift-r")
|
||||
(mail | message) reply list: user.thunderbird_mod("shift-l")
|
||||
(mail | message) forward: user.thunderbird_mod("l")
|
||||
# organize
|
||||
(mail | message) delete: key(delete)
|
||||
(mail | message) archive: key(a)
|
||||
(mail | message) save: user.thunderbird_mod("s")
|
||||
(mail | message) print: user.thunderbird_mod("p")
|
||||
@@ -0,0 +1,34 @@
|
||||
from talon import Context, actions
|
||||
|
||||
# Context matching
|
||||
ctx = Context()
|
||||
ctx.matches = r"""
|
||||
os: linux
|
||||
app: thunderbird
|
||||
"""
|
||||
|
||||
|
||||
# --- Implement actions ---
|
||||
@ctx.action_class("app")
|
||||
class AppActions:
|
||||
# app.tabs
|
||||
def tab_reopen():
|
||||
actions.key("ctrl-shift-t") # only works from inbox tab
|
||||
|
||||
|
||||
@ctx.action_class("user")
|
||||
class UserActions:
|
||||
# user.tabs
|
||||
def tab_jump(number: int):
|
||||
if number <= 9:
|
||||
actions.key(f"alt-{number}")
|
||||
|
||||
def tab_final():
|
||||
actions.key("alt-9")
|
||||
|
||||
# custom actions
|
||||
def thunderbird_mod(keys: str):
|
||||
actions.key(f"ctrl-{keys}")
|
||||
|
||||
def thunderbird_calendar_view(number: int):
|
||||
actions.key(f"ctrl-{number}")
|
||||
@@ -0,0 +1,34 @@
|
||||
from talon import Context, actions
|
||||
|
||||
# Context matching
|
||||
ctx = Context()
|
||||
ctx.matches = r"""
|
||||
os: mac
|
||||
app: thunderbird
|
||||
"""
|
||||
|
||||
|
||||
# --- Implement actions ---
|
||||
@ctx.action_class("app")
|
||||
class AppActions:
|
||||
# app.tabs
|
||||
def tab_reopen():
|
||||
actions.key("cmd-shift-t") # only works from inbox tab
|
||||
|
||||
|
||||
@ctx.action_class("user")
|
||||
class UserActions:
|
||||
# user.tabs
|
||||
def tab_jump(number: int):
|
||||
if number <= 9:
|
||||
actions.key(f"cmd-{number}")
|
||||
|
||||
def tab_final():
|
||||
actions.key("cmd-9")
|
||||
|
||||
# custom actions
|
||||
def thunderbird_mod(keys: str):
|
||||
actions.key(f"cmd-{keys}")
|
||||
|
||||
def thunderbird_calendar_view(number: int):
|
||||
actions.key(f"alt-{number}")
|
||||
@@ -0,0 +1,8 @@
|
||||
app: thunderbird_tasks
|
||||
-
|
||||
# event/task
|
||||
event new: user.thunderbird_mod("i")
|
||||
task new: user.thunderbird_mod("d")
|
||||
(task | event) delete: key(delete)
|
||||
# layout
|
||||
toggle today: key(f11)
|
||||
@@ -0,0 +1,34 @@
|
||||
from talon import Context, actions
|
||||
|
||||
# Context matching
|
||||
ctx = Context()
|
||||
ctx.matches = r"""
|
||||
os: windows
|
||||
app: thunderbird
|
||||
"""
|
||||
|
||||
|
||||
# --- Implement actions ---
|
||||
@ctx.action_class("app")
|
||||
class AppActions:
|
||||
# app.tabs
|
||||
def tab_reopen():
|
||||
actions.key("ctrl-shift-t") # only works from inbox tab
|
||||
|
||||
|
||||
@ctx.action_class("user")
|
||||
class UserActions:
|
||||
# user.tabs
|
||||
def tab_jump(number: int):
|
||||
if number <= 9:
|
||||
actions.key(f"ctrl-{number}")
|
||||
|
||||
def tab_final():
|
||||
actions.key("ctrl-9")
|
||||
|
||||
# custom actions
|
||||
def thunderbird_mod(keys: str):
|
||||
actions.key(f"ctrl-{keys}")
|
||||
|
||||
def thunderbird_calendar_view(number: int):
|
||||
actions.key(f"alt-{number}")
|
||||
Reference in New Issue
Block a user