Contexts

Contexts are specific states that LipSurf can enter, which limit the scope of commands that are valid. By default, if a command does not have a context, it is in the "default" context where most other commands work.

Use cases include:

  • Allowing certain commands only in certain situations.
    • eg. slower and faster for auto scroll only makes sense after the user has said auto scroll.
  • Limiting which commands are valid.
    • eg. In the "Dictation" context, we don't want "youtube" to take us to youtube.com, we want it to literally write "youtube" where we're composing our text.

To make a context, simply designate a context as a part of an ICommand's context or enterContext property

-or-

for more advanced cases, declare the context in a plugin's context's property.


You can use PluginBase.util.enterContext to programmatically enter a context. To exit the context, simply enter the 'default' context.

NOTE

The first use case has a context that extends the default context, because in the "Auto Scroll" context, it is still valid to use other commands eg. for clicking links.

On the other hand, the second use case involves a context that does not extend the default context, so only commands specified in the context will work.

Last updated: 11/8/2019, 1:57:56 AM