Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modes: simplify modes a little bit #1215

Merged
merged 17 commits into from
Oct 29, 2023
29 changes: 29 additions & 0 deletions core/modes/sleep_mode.talon
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,32 @@ settings():
user.mouse_enable_pop_stops_scroll = 0
#enable pop click with 'control mouse' mode
user.mouse_enable_pop_click = 0

#================================================================================
# Commands to wake Talon
#================================================================================

# Note: these have repeaters on them (+) to work around an issue where, in sleep mode,
# you can get into a situation where these commands are difficult to trigger.

# These commands are fully anchored (^ and $), which means that there must be
# silence before and after saying them in order for them to recognize (this reduces
# false positives during normal sleep mode, normally a good thing).

# However, ignored background speech during sleep mode also counts as an utterance.

# Thus, if you say "blah blah blah talon wake", these won't trigger, because "blah
# blah blah" was part of the same utterance. You have to say "blah blah blah" <pause,
# wait for speech timeout>, "talon wake" <pause, wait for speech timeout>.

# Sometimes people would forget the second pause, notice things weren't working, and
# say "talon wake" over and over again before the speech timeout ever gets hit, which
# means that these won't recognize. The (+) handles this case, so if you say
# <pause> "talon wake talon wake" <pause>, it'll still work.

^(welcome back)+$:
user.mouse_wake()
user.history_enable()
user.talon_mode()

^(talon wake)+$: speech.enable()
9 changes: 9 additions & 0 deletions core/modes/sleep_mode_not_dragon.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
mode: sleep
not speech.engine: dragon
-
# We define this *only* if the speech engine isn't Dragon, because if you're using Dragon,
# "wake up" is used to specifically control Dragon, and not affect Talon.
#
# It's a useful and well known command, though, so if you're using any other speech
# engine, this controls Talon.
^(wake up)+$: speech.enable()
26 changes: 26 additions & 0 deletions core/modes/to_sleep_mode.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
mode: command
mode: dictation
-

# The optional <phrase> afterwards allows these to match even if you say arbitrary text
# after this command, without having to wait for the speech timeout.

# This is handy because you often need to put Talon asleep in order to immediately
# talk to humans, and it's annoying to have to say "sleep all", wait for the timeout,
# and then resume your conversation.

# With this, you can say "sleep all hey bob" and Talon will immediately go to
# sleep and ignore "hey bob". Note that subtitles will show "sleep all hey bob",
# because it's part of the rule definition, but "hey bob" will be ignored, because
# we don't do anything with the <phrase> in the body of the command.

^sleep all [<phrase>]$:
user.switcher_hide_running()
user.history_disable()
user.homophones_hide()
user.help_hide()
user.mouse_sleep()
speech.disable()
user.engine_sleep()

^talon sleep [<phrase>]$: speech.disable()
12 changes: 12 additions & 0 deletions core/modes/to_sleep_mode_not_dragon.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
mode: command
mode: dictation
not speech.engine: dragon
-
# We define this *only* if the speech engine isn't Dragon, because if you're using Dragon,
# "go to sleep" is used to specifically control Dragon, and not affect Talon.
#
# It's a useful and well known command, though, so if you're using any other speech
# engine, this controls Talon.
#
# For a note about the optional <phrase>, see to_sleep_mode.talon.
^go to sleep [<phrase>]$: speech.disable()
17 changes: 0 additions & 17 deletions core/modes/wake_and_sleep.talon

This file was deleted.

5 changes: 0 additions & 5 deletions core/modes/wake_and_sleep_wav2letter.talon

This file was deleted.