shift while clicking to extend a selection, holding ctrl while clicking multiple files, or holding alt while scrolling to trigger an alternate gesture.
The key action supports an optional down parameter that controls whether the key is pressed, held, or released. Pair a down=true call with a later down=false call on the same key so the key never ends up stuck in the pressed state.
The down parameter
down is tri-state:
down value | Behavior |
|---|---|
| omitted (default) | Full press: press the key down and release it immediately. Backwards-compatible with the normal key action. |
true | Press the key down and hold it without releasing. |
false | Release a key that was previously held with down=true. |
down only applies to the key action. It is ignored for type and every other action.Basic usage pattern
To hold a key while performing another action:Press the key down and hold
Call
key with the key chord and down=true. The key stays pressed until you release it.Example: shift-click to extend a selection
Example: ctrl-click to toggle multi-select
Example: ctrl-scroll to zoom
Guidelines
- Always pair
down=truewith a matchingdown=false. If you hold a modifier and forget to release it, every subsequent action in the workflow will be affected, and downstream typing or shortcuts will behave unexpectedly. - Release the same key you pressed. If you pressed
shiftdown, releaseshift, notlshiftorshiftleft. - Avoid key chords with
down=true.downis designed for simple modifier keys likeshift,ctrl,alt, andwin. Do not use it with chords such asctrl+shift. - Prefer the default full-press form when you don’t need to hold. If you just need
ctrl+aas a one-shot, useaction="key"withtext="ctrl+a"and nodownparameter. That’s the normal behavior. - Take a screenshot after releasing if you need to verify the result. The screenshot after a
down=truecall shows the screen while the key is held, which is usually not what you want to verify against.
Comparison with modifier-click shortcuts
For simple modifier combinations likectrl+a (select all), ctrl+c (copy), or alt+tab (switch window), keep using the default key action with the chord directly:
down parameter when the held key has to span another action, such as a click, a mouse move, or a scroll.