forked from talonhub/community
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into main_january25
- Loading branch information
Showing
163 changed files
with
3,345 additions
and
1,901 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from pathlib import Path | ||
from typing import Optional | ||
|
||
from talon import Context, Module, actions, clip, ui | ||
|
||
ctx = Context() | ||
mod = Module() | ||
|
||
ctx.matches = """ | ||
os: mac | ||
""" | ||
|
||
|
||
@mod.action_class | ||
class Actions: | ||
def dock_send_notification(notification: str): | ||
"""Send a CoreDock notification to the macOS Dock using SPI""" | ||
|
||
def dock_app_expose(app: Optional[ui.App] = None): | ||
"""Activate macOS app Exposé via its Dock item (for the frontmost app if not specified)""" | ||
|
||
|
||
@ctx.action_class("user") | ||
class UserActions: | ||
def dock_app_expose(app=None): | ||
if app is None: | ||
app = ui.active_app() | ||
|
||
app_name = Path(app.path).stem | ||
dock_items = ui.apps(bundle="com.apple.dock")[0].children.find( | ||
AXSubrole="AXApplicationDockItem", AXTitle=app_name, max_depth=1 | ||
) | ||
match len(dock_items): | ||
case 1: | ||
dock_items[0].perform("AXShowExpose") | ||
case 0: | ||
actions.app.notify( | ||
body=f"No dock icon for “{app_name}”", | ||
title="Unable to activate App Exposé", | ||
) | ||
case _: | ||
actions.app.notify( | ||
body=f"Multiple dock icons for “{app_name}”", | ||
title="Unable to activate App Exposé", | ||
) | ||
|
||
def dock_send_notification(notification: str): | ||
from talon.mac.dock import dock_notify | ||
|
||
dock_notify(notification) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
os: mac | ||
- | ||
^desktop$: user.dock_send_notification("com.apple.showdesktop.awake") | ||
^window$: user.dock_app_expose() | ||
^launch pad$: user.dock_send_notification("com.apple.launchpad.toggle") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.