From 3a47c6e773ad98370f8761b2309fd2c57582e002 Mon Sep 17 00:00:00 2001 From: NLCas8 Date: Sun, 13 Jul 2025 19:17:53 +0200 Subject: [PATCH 1/6] Add Shortcat functions --- apps/shortcat/shortcat.py | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 apps/shortcat/shortcat.py diff --git a/apps/shortcat/shortcat.py b/apps/shortcat/shortcat.py new file mode 100644 index 0000000000..8582aa9eca --- /dev/null +++ b/apps/shortcat/shortcat.py @@ -0,0 +1,40 @@ +from talon import Module, actions + +mod = Module() + +# Hotkey that is configured to activate Shortcat +SHORTCAT_HOTKEY = "cmd-shift-alt-]" +# Delay to wait for Shortcat to show the shortcuts +SHORTCUTS_DELAY = "500ms" + + +@mod.action_class +class Actions: + def shortcat_hover(text: str): + "Hover over a button using shortcat" + actions.key(SHORTCAT_HOTKEY) + actions.sleep(SHORTCUTS_DELAY) + actions.insert(text) + + def shortcat_click(text: str, click_delay: str = "0ms"): + "Click a button using shortcat" + actions.user.shortcat_hover(text) + actions.sleep(click_delay) + actions.key("enter") + actions.sleep("100ms") + actions.mouse_click(0) + + def shortcat_double_click(text: str, click_delay: str = "0ms"): + "Double click a button using shortcat" + actions.user.shortcat_hover(text) + actions.sleep(click_delay) + actions.key("enter") + actions.sleep("100ms") + actions.mouse_click(0) + actions.mouse_click(0) + + def shortcat_right(text: str, click_delay: str = "0ms"): + "Right click a button using shortcat" + actions.user.shortcat_hover(text) + actions.sleep(click_delay) + actions.key("ctrl-enter") From 61bc6f2469134f6b4c54bce39cfc7ae1466da18d Mon Sep 17 00:00:00 2001 From: NLCas8 Date: Sun, 13 Jul 2025 19:18:09 +0200 Subject: [PATCH 2/6] Add Shortcat commands --- apps/shortcat/shortcat.talon | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 apps/shortcat/shortcat.talon diff --git a/apps/shortcat/shortcat.talon b/apps/shortcat/shortcat.talon new file mode 100644 index 0000000000..18d61d6da0 --- /dev/null +++ b/apps/shortcat/shortcat.talon @@ -0,0 +1,14 @@ +^(shot|sot) []: + user.shortcat_hover(text or "") + +^(shot|sot) click []: + # Add some delay to cancel click if needed + user.shortcat_click(text or "", "1500ms") + +^(shot|sot) right []: + # Add some delay to cancel right-click if needed + user.shortcat_right(text or "", "1500ms") + +^(shot|sot) dub []: + # Add some delay to cancel double-click if needed + user.shortcat_double_click(text or "", "1500ms") \ No newline at end of file From f550022b258ad77610ca19d378f6bea1d91c24a0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 13 Jul 2025 18:16:23 +0000 Subject: [PATCH 3/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- apps/shortcat/shortcat.talon | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/shortcat/shortcat.talon b/apps/shortcat/shortcat.talon index 18d61d6da0..ebb0ffd0fa 100644 --- a/apps/shortcat/shortcat.talon +++ b/apps/shortcat/shortcat.talon @@ -1,14 +1,13 @@ -^(shot|sot) []: - user.shortcat_hover(text or "") +^(shot | sot) []: user.shortcat_hover(text or "") -^(shot|sot) click []: +^(shot | sot) click []: # Add some delay to cancel click if needed user.shortcat_click(text or "", "1500ms") -^(shot|sot) right []: +^(shot | sot) right []: # Add some delay to cancel right-click if needed user.shortcat_right(text or "", "1500ms") -^(shot|sot) dub []: +^(shot | sot) dub []: # Add some delay to cancel double-click if needed - user.shortcat_double_click(text or "", "1500ms") \ No newline at end of file + user.shortcat_double_click(text or "", "1500ms") From 4a27a2f117e46046a3b2789c667eb58781142af6 Mon Sep 17 00:00:00 2001 From: NLCas8 Date: Mon, 14 Jul 2025 09:09:47 +0200 Subject: [PATCH 4/6] Set Shortcat hotkey to default --- apps/shortcat/shortcat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/shortcat/shortcat.py b/apps/shortcat/shortcat.py index 8582aa9eca..c8a4eb5bdc 100644 --- a/apps/shortcat/shortcat.py +++ b/apps/shortcat/shortcat.py @@ -3,7 +3,7 @@ mod = Module() # Hotkey that is configured to activate Shortcat -SHORTCAT_HOTKEY = "cmd-shift-alt-]" +SHORTCAT_HOTKEY = "cmd-shift-space" # Delay to wait for Shortcat to show the shortcuts SHORTCUTS_DELAY = "500ms" From 2ea8caf665146c4f7ca746366fe6acef2ddee9de Mon Sep 17 00:00:00 2001 From: NLCas8 Date: Mon, 14 Jul 2025 11:31:17 +0200 Subject: [PATCH 5/6] Replace constants with settings --- apps/shortcat/shortcat.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/shortcat/shortcat.py b/apps/shortcat/shortcat.py index c8a4eb5bdc..86ea02605f 100644 --- a/apps/shortcat/shortcat.py +++ b/apps/shortcat/shortcat.py @@ -1,19 +1,27 @@ -from talon import Module, actions +from talon import Module, actions, settings mod = Module() -# Hotkey that is configured to activate Shortcat -SHORTCAT_HOTKEY = "cmd-shift-space" -# Delay to wait for Shortcat to show the shortcuts -SHORTCUTS_DELAY = "500ms" +mod.setting( + "shortcat_hotkey", + type=str, + default="cmd-shift-space", + desc="Hotkey that is configured to activate Shortcat", +) +mod.setting( + "shortcat_click_delay", + type=str, + default="500ms", + desc="Delay to wait for Shortcat to show the shortcuts before clicking", +) @mod.action_class class Actions: def shortcat_hover(text: str): "Hover over a button using shortcat" - actions.key(SHORTCAT_HOTKEY) - actions.sleep(SHORTCUTS_DELAY) + actions.key(settings.get("user.shortcat_hotkey")) + actions.sleep(settings.get("user.shortcat_click_delay")) actions.insert(text) def shortcat_click(text: str, click_delay: str = "0ms"): From 3fdee194d3fd4f233201f04cfff2be892fb96825 Mon Sep 17 00:00:00 2001 From: NLCas8 Date: Mon, 14 Jul 2025 11:39:43 +0200 Subject: [PATCH 6/6] Limit to mac only --- apps/shortcat/shortcat.talon | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/shortcat/shortcat.talon b/apps/shortcat/shortcat.talon index ebb0ffd0fa..f22af05772 100644 --- a/apps/shortcat/shortcat.talon +++ b/apps/shortcat/shortcat.talon @@ -1,3 +1,6 @@ +os: mac +- + ^(shot | sot) []: user.shortcat_hover(text or "") ^(shot | sot) click []: