Syntax
Description
Releases a key or modifier that was previously held down withkey-down. This completes the key press sequence and returns the keyboard to its normal state.
Always pair key-up calls with corresponding key-down calls to avoid leaving modifiers stuck in the pressed state.
Parameters
Key or modifier to release. Must match a previously held key from
key-down. See Key Combo Format below for syntax.Key Combo Format
Single Modifiers
Single Keys
Modifier Combinations
Modifier Aliases
cmd,command→ Command/Windows keyctrl,control→ Control keyalt,option→ Alt/Option keyshift→ Shift key
Response
Success Response
Error Response
Examples
Release Single Modifier
Release Multi-Modifier Combination
Release After Key Hold
Sequential Release
Releasing keys in sequence after holding them individually:Error Codes
| Code | Description |
|---|---|
INVALID_ARGS | Invalid key format or unknown modifier |
ACTION_FAILED | OS rejected the key-up event |
PERM_DENIED | Accessibility permission not granted |
Notes
- Always pair with
key-down: Callingkey-upwithout a priorkey-downis safe but has no effect - Releasing a key that isn’t currently held is a no-op (does not cause an error)
- The command returns immediately after sending the key-up event
- Modifiers affect all input until released, so call
key-uppromptly
Best Practices
Match Your key-down Calls
Release keys in the same format they were pressed:Use Error Handling
Ensurekey-up is called even if an error occurs: