Skip to content

Commit

Permalink
Remove dependency on talon_plugins (#1657)
Browse files Browse the repository at this point in the history
`talon_plugins` has been removed in the latest beta. As far as I know
there is no replacement to check if we are zoomed in or not.

Fixes #1637

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
AndreasArvidsson and pre-commit-ci[bot] authored Dec 28, 2024
1 parent 45195f4 commit 3e0ca4f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
1 change: 1 addition & 0 deletions BREAKING_CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and when the change was applied given the delay between changes being
submitted and the time they were reviewed and merged.

---
* 2024-12-26 Deprecated action `user.zoom_close` in favor of `tracking.zoom_cancel`.
* 2024-11-24 Deprecated a bunch of symbol commands to insert delimited pairs
("", '', []) in favor of the new `delimiter_pair` Talon list file.
* 2024-09-07 Removed `get_list_from_csv` from `user_settings.py`. Please
Expand Down
7 changes: 5 additions & 2 deletions core/deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,21 @@ def deprecate_capture(time_deprecated: str, name: str):
)
warnings.warn(msg, DeprecationWarning, stacklevel=3)

def deprecate_action(time_deprecated: str, name: str):
def deprecate_action(time_deprecated: str, name: str, replacement: str = ""):
"""
Notify the user that the given action is deprecated and should
not be used into the future.
not be used into the future; the action `replacement` should be used
instead.
"""

id = f"action.{name}.{time_deprecated}"

deprecate_notify(id, f"The `{name}` action is deprecated. See log for more.")
replacement_msg = f' Instead, use: "{replacement}".' if replacement else ""

msg = (
f"The `{name}` action is deprecated since {time_deprecated}."
f"{replacement_msg}"
f' See {os.path.join(REPO_DIR, "BREAKING_CHANGES.txt")}'
f"{calculate_rule_info()}"
)
Expand Down
9 changes: 6 additions & 3 deletions plugin/mouse/mouse.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from talon import Context, Module, actions, ctrl, settings, ui
from talon_plugins import eye_zoom_mouse

mod = Module()
ctx = Context()
Expand Down Expand Up @@ -38,8 +37,12 @@
class Actions:
def zoom_close():
"""Closes an in-progress zoom. Talon will move the cursor position but not click."""
if eye_zoom_mouse.zoom_mouse.state == eye_zoom_mouse.STATE_OVERLAY:
actions.tracking.zoom_cancel()
actions.user.deprecate_action(
"2024-12-26",
"user.zoom_close",
"tracking.zoom_cancel",
)
actions.tracking.zoom_cancel()

def mouse_wake():
"""Enable control mouse, zoom mouse, and disables cursor"""
Expand Down
18 changes: 9 additions & 9 deletions plugin/mouse/mouse.talon
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ camera overlay: tracking.control_debug_toggle()
run calibration: tracking.calibrate()
touch:
# close zoom if open
user.zoom_close()
tracking.zoom_cancel()
mouse_click(0)
# close the mouse grid if open
user.grid_close()
Expand All @@ -15,14 +15,14 @@ touch:

righty:
# close zoom if open
user.zoom_close()
tracking.zoom_cancel()
mouse_click(1)
# close the mouse grid if open
user.grid_close()

mid click:
# close zoom if open
user.zoom_close()
tracking.zoom_cancel()
mouse_click(2)
# close the mouse grid
user.grid_close()
Expand All @@ -36,44 +36,44 @@ mid click:
#super = windows key
<user.modifiers> touch:
# close zoom if open
user.zoom_close()
tracking.zoom_cancel()
key("{modifiers}:down")
mouse_click(0)
key("{modifiers}:up")
# close the mouse grid
user.grid_close()
<user.modifiers> righty:
# close zoom if open
user.zoom_close()
tracking.zoom_cancel()
key("{modifiers}:down")
mouse_click(1)
key("{modifiers}:up")
# close the mouse grid
user.grid_close()
(dub click | duke):
# close zoom if open
user.zoom_close()
tracking.zoom_cancel()
mouse_click()
mouse_click()
# close the mouse grid
user.grid_close()
(trip click | trip lick):
# close zoom if open
user.zoom_close()
tracking.zoom_cancel()
mouse_click()
mouse_click()
mouse_click()
# close the mouse grid
user.grid_close()
left drag | drag | drag start:
# close zoom if open
user.zoom_close()
tracking.zoom_cancel()
user.mouse_drag(0)
# close the mouse grid
user.grid_close()
right drag | righty drag:
# close zoom if open
user.zoom_close()
tracking.zoom_cancel()
user.mouse_drag(1)
# close the mouse grid
user.grid_close()
Expand Down
7 changes: 0 additions & 7 deletions plugin/mouse/mouse_scroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Literal

from talon import Context, Module, actions, app, cron, ctrl, imgui, settings, ui
from talon_plugins import eye_zoom_mouse

continuous_scroll_mode = ""
scroll_job = None
Expand Down Expand Up @@ -96,9 +95,6 @@ def mouse_gaze_scroll():
"""Starts gaze scroll"""
global gaze_job, continuous_scroll_mode, control_mouse_forced

if eye_zoom_mouse.zoom_mouse.state != eye_zoom_mouse.STATE_IDLE:
return

continuous_scroll_mode = "gaze scroll"
gaze_job = cron.interval("16ms", scroll_gaze_helper)

Expand Down Expand Up @@ -169,9 +165,6 @@ def noise_trigger_hiss(active: bool):
def mouse_scroll_continuous(new_scroll_dir: Literal[-1, 1]):
global scroll_job, scroll_dir, scroll_start_ts, continuous_scroll_mode

if eye_zoom_mouse.zoom_mouse.state != eye_zoom_mouse.STATE_IDLE:
return

if scroll_job:
# Issuing a scroll in the same direction aborts scrolling
if scroll_dir == new_scroll_dir:
Expand Down

0 comments on commit 3e0ca4f

Please sign in to comment.