Skip to content

Commit

Permalink
Add new "paste link to" action and improve reliability of homophones …
Browse files Browse the repository at this point in the history
…command.
  • Loading branch information
wolfmanstout committed Feb 17, 2024
1 parent 5d2b61a commit d8e26f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gaze_ocr.talon
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ replace [{user.ocr_modifiers}] [seen | scene] <user.prose_range> with <user.pros
user.insert_adjacent_to_text(timestamped_prose, "before", prose)
[go] after <user.timestamped_prose> say <user.prose>$:
user.insert_adjacent_to_text(timestamped_prose, "after", prose)
phones (seen | scene) <user.timestamped_prose>$:
phones [word] (seen | scene) <user.timestamped_prose>$:
user.change_text_homophone(timestamped_prose)

ocr tracker on: user.connect_ocr_eye_tracker()
Expand Down
10 changes: 9 additions & 1 deletion gaze_ocr_talon.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"copy": "copy",
"carve": "cut",
"paste to": "paste",
"paste link to": "paste_link",
"clear": "delete",
"change": "delete",
"delete": "delete_with_whitespace",
Expand Down Expand Up @@ -496,6 +497,10 @@ def perform_ocr_action_generator(
actions.edit.cut()
elif ocr_action == "paste":
actions.edit.paste()
elif ocr_action == "paste_link":
actions.user.hyperlink()
actions.sleep("100ms")
actions.edit.paste()
elif ocr_action in ("delete", "delete_with_whitespace"):
actions.key("backspace")
elif ocr_action == "capitalize":
Expand Down Expand Up @@ -806,7 +811,10 @@ def change_text_homophone(text: TimestampedText):
"""Switch the on-screen text to a different homophone."""

def run():
yield from select_text_generator(text)
# Use click instead of selection because it is more reliable.
yield from move_cursor_to_word_generator(text)
actions.mouse_click(0)
actions.edit.select_word()
actions.user.homophones_show_selection()

begin_generator(run())

0 comments on commit d8e26f2

Please sign in to comment.