repeater
The community/plugin/repeater
directory contains code that adds functionality to repeat commands and phrases in Talon.
The file pop_twice_to_repeat.py
implements a feature that repeats the previous command if the user makes a "pop" noise twice in quick succession. It achieves this by:
- Tracking the time of the last "pop" noise.
- If the current "pop" occurs within the time window configured by the
user.double_pop_speed_minimum
anduser.double_pop_speed_maximum
settings, it callsactions.core.repeat_command()
. This time window is necessary to avoid accidental repeats from two pops that are not intended to be a double pop. - It uses a tag
user.pop_twice_to_repeat
to enable this functionality in command mode. - It ensures that it does not interfere with mouse zoom which also uses the pop noise.
The file repeater.talon
defines Talon commands for repeating actions:
- It enables repeating a command a specified number of times by saying "repeat that <number> times" or "<ordinal number>".
- It provides a "repeat that" or "twice" command for repeating the command once.
- It supports repeating the last spoken phrase using "repeat phrase" or "again" and an optional number of times.
- It calls
actions.core.repeat_command()
for all of the above, using the number of repetitions spoken as an argument, with the spoken number decremented by one to account for the initial action. For example, saying "three times" will causeactions.core.repeat_command(2)
to be called. - It calls
actions.core.repeat_partial_phrase()
to repeat the last spoken phrase a specified number of times.