diff --git a/plugin/mouse/mouse.py b/plugin/mouse/mouse.py index b4c6502f7e..2b9ccab902 100644 --- a/plugin/mouse/mouse.py +++ b/plugin/mouse/mouse.py @@ -172,4 +172,4 @@ def noise_trigger_pop(): ) if should_click: - ctrl.mouse_click(button=0, hold=16000) + actions.mouse_click() diff --git a/plugin/mouse/mouse_click_with_hold.py b/plugin/mouse/mouse_click_with_hold.py new file mode 100644 index 0000000000..eb741d5afb --- /dev/null +++ b/plugin/mouse/mouse_click_with_hold.py @@ -0,0 +1,23 @@ +from talon import Context, Module, actions, ctrl, settings + +mod = Module() + +mod.setting( + "mouse_click_hold", + type=int, + default=0, + desc="Duration to hold mouse clicks in milliseconds", +) + +ctx = Context() + + +@ctx.action_class("main") +class MainActions: + def mouse_click(button: int = 0): + hold_duration = settings.get("user.mouse_click_hold") + + if hold_duration < 1: + actions.next(button) + else: + ctrl.mouse_click(button=button, hold=hold_duration * 1000) diff --git a/settings.talon b/settings.talon index 92011eebab..ee075509f8 100644 --- a/settings.talon +++ b/settings.talon @@ -61,6 +61,12 @@ settings(): # Set the amount to scroll left/right user.mouse_wheel_horizontal_amount = 40 + # Set the duration to hold mouse clicks in milliseconds. 0 means no hold. + # In some full-screen applications, particularly games, mouse clicks may not + # be recognized unless held for a short duration. If this occurs, try + # starting with a setting of 16. + user.mouse_click_hold = 0 + # If `true`, start mouse grid numbering on the bottom left (vs. top left) user.grids_put_one_bottom_left = true