mode_indicator
The community/plugin/mode_indicator directory contains a plugin that displays a graphical indicator showing the current Talon mode. The indicator is a circle with a color that changes based on the active mode (command, dictation, sleep, etc.) and the microphone status.
The core logic resides in mode_indicator.py. This file defines the plugin's behavior using the Talon framework. It manages the indicator's display, position, size, and color. The indicator is drawn on a canvas, and its appearance is controlled by several settings, which can be configured in the mode_indicator.talon file.
Here is how it works:
- The script initializes several settings to control the mode indicator's appearance, such as
mode_indicator_show(whether to show the indicator),mode_indicator_size,mode_indicator_x,mode_indicator_y, and various color settings for different modes and microphone states. - The
on_update_contextsfunction determines the current Talon mode (sleep,dictation,mixed,command, orother) based on the active contexts. When the mode changes, the indicator is updated. - The
poll_microphonefunction checks the active microphone and updates the indicator if the microphone state has changed (e.g., muted). - The
update_indicatorfunction handles showing, hiding, and moving the indicator based on theuser.mode_indicator_showsetting. - The
on_drawfunction is called by the canvas to draw the indicator as a colored circle with a gradient. The colors are determined by the current mode and configured inmode_indicator.talon. - The
move_indicatorfunction calculates the indicator's position based on the user's settings forxandyposition. - The
on_update_settingsis called when the settings are changed and updates the indicator if any of the mode indicator settings changed. - The
on_readyfunction registers callbacks to listen for context and setting changes.
The file mode_indicator.talon provides the default settings for the mode indicator. This is where users can customize the indicator's appearance, including its size, position, transparency, colors for different modes and microphone states. By default the indicator is not shown, the size is 30 pixels, it is centered horizontally, and at the top vertically. The default colors are: black for mute, grey for sleep, gold for dictation, MediumSeaGreen for mixed, CornflowerBlue for command, and GhostWhite for other.
The README.md file provides a basic description of the plugin, example images of the different modes, and a link to a demo video on YouTube: YouTube - Mode indicator demo. It also explains how to enable the plugin by changing the user.mode_indicator_show setting in mode_indicator.talon.