init commit
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
from talon import Context, Module, actions, app
|
||||
|
||||
ctx = Context()
|
||||
mod = Module()
|
||||
apps = mod.apps
|
||||
apps.firefox = "app.name: Firefox"
|
||||
apps.firefox = "app.name: Firefox Developer Edition"
|
||||
apps.firefox = "app.name: firefox"
|
||||
apps.firefox = "app.name: org.mozilla.firefox"
|
||||
apps.firefox = "app.name: Firefox-esr"
|
||||
apps.firefox = "app.name: firefox-esr"
|
||||
apps.firefox = "app.name: LibreWolf"
|
||||
apps.firefox = "app.name: waterfox"
|
||||
apps.firefox = r"""
|
||||
os: windows
|
||||
and app.name: Firefox
|
||||
os: windows
|
||||
and app.exe: /^firefox\.exe$/i
|
||||
"""
|
||||
apps.firefox = """
|
||||
os: mac
|
||||
and app.bundle: org.mozilla.firefox
|
||||
"""
|
||||
|
||||
# Make the context match more specifically than anything else. This is important, eg. to
|
||||
# override the browser.go_home() implementation in tags/browser/browser_mac.py.
|
||||
ctx.matches = r"""
|
||||
os: windows
|
||||
os: linux
|
||||
os: mac
|
||||
tag: browser
|
||||
app: firefox
|
||||
"""
|
||||
|
||||
|
||||
@mod.action_class
|
||||
class Actions:
|
||||
def firefox_bookmarks_sidebar():
|
||||
"""Toggles the Firefox bookmark sidebar"""
|
||||
|
||||
def firefox_history_sidebar():
|
||||
"""Toggles the Firefox history sidebar"""
|
||||
|
||||
|
||||
@ctx.action_class("user")
|
||||
class UserActions:
|
||||
def tab_close_wrapper():
|
||||
actions.sleep("180ms")
|
||||
actions.app.tab_close()
|
||||
|
||||
|
||||
@ctx.action_class("browser")
|
||||
class BrowserActions:
|
||||
def focus_page():
|
||||
actions.browser.focus_address()
|
||||
actions.edit.find()
|
||||
actions.sleep("180ms")
|
||||
actions.key("escape")
|
||||
|
||||
def go_home():
|
||||
actions.key("alt-home")
|
||||
@@ -0,0 +1,15 @@
|
||||
app: firefox
|
||||
-
|
||||
tag(): browser
|
||||
tag(): user.tabs
|
||||
|
||||
tab search:
|
||||
browser.focus_address()
|
||||
insert("% ")
|
||||
tab search <user.text>$:
|
||||
browser.focus_address()
|
||||
insert("% {text}")
|
||||
key(down)
|
||||
|
||||
(sidebar | panel) bookmarks: user.firefox_bookmarks_sidebar()
|
||||
(sidebar | panel) history: user.firefox_history_sidebar()
|
||||
@@ -0,0 +1,33 @@
|
||||
from talon import Context, actions
|
||||
|
||||
ctx = Context()
|
||||
|
||||
ctx.matches = r"""
|
||||
os: mac
|
||||
tag: browser
|
||||
app: firefox
|
||||
"""
|
||||
|
||||
|
||||
@ctx.action_class("user")
|
||||
class UserActions:
|
||||
def firefox_bookmarks_sidebar():
|
||||
actions.key("cmd-b")
|
||||
|
||||
def firefox_history_sidebar():
|
||||
actions.key("cmd-shift-h")
|
||||
|
||||
|
||||
@ctx.action_class("browser")
|
||||
class BrowserActions:
|
||||
def bookmarks():
|
||||
actions.key("cmd-shift-o")
|
||||
|
||||
def open_private_window():
|
||||
actions.key("cmd-shift-p")
|
||||
|
||||
def show_downloads():
|
||||
actions.key("cmd-j")
|
||||
|
||||
def show_extensions():
|
||||
actions.key("cmd-shift-a")
|
||||
@@ -0,0 +1,44 @@
|
||||
from talon import Context, actions, app
|
||||
|
||||
ctx = Context()
|
||||
|
||||
ctx.matches = r"""
|
||||
os: windows
|
||||
os: linux
|
||||
tag: browser
|
||||
app: firefox
|
||||
"""
|
||||
|
||||
|
||||
@ctx.action_class("user")
|
||||
class UserActions:
|
||||
def firefox_bookmarks_sidebar():
|
||||
actions.key("ctrl-b")
|
||||
|
||||
def firefox_history_sidebar():
|
||||
actions.key("ctrl-h")
|
||||
|
||||
|
||||
@ctx.action_class("browser")
|
||||
class BrowserActions:
|
||||
def focus_address():
|
||||
# Only using "ctrl-l" might fail and clear the console if the user
|
||||
# is focused in the devtools
|
||||
actions.key("f6")
|
||||
actions.sleep("100ms")
|
||||
actions.key("ctrl-l")
|
||||
|
||||
def open_private_window():
|
||||
actions.key("ctrl-shift-p")
|
||||
|
||||
def show_downloads():
|
||||
if app.platform == "linux":
|
||||
actions.key("ctrl-shift-y")
|
||||
else:
|
||||
actions.key("ctrl-j")
|
||||
|
||||
def show_extensions():
|
||||
actions.key("ctrl-shift-a")
|
||||
|
||||
def show_history():
|
||||
actions.key("ctrl-shift-h")
|
||||
Reference in New Issue
Block a user