-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Description
SwiftAutoGUI provides keyDown(KeyCode) and keyUp(KeyCode) methods that allow pressing and releasing individual keys. This enables more advanced keyboard control scenarios that aren't possible with just sendKeyShortcut.
Implementation Details
Add two new tools to the Keyboard category:
keyDown- Press and hold a keykeyUp- Release a held key
Parameters
Both tools accept:
key: The key code to press/release (string representation matching KeyCode enum)
Use Cases
- Holding modifier keys while performing other actions
- Gaming automation requiring sustained key presses
- Complex key combinations beyond simple shortcuts
- Simulating human-like typing patterns
- Accessibility tools requiring precise key control
Example Usage
// Press and hold shift
{
"tool": "keyDown",
"arguments": {
"key": "shift"
}
}
// Perform other actions while shift is held...
// Release shift
{
"tool": "keyUp",
"arguments": {
"key": "shift"
}
}Implementation Notes
- Should validate that the key string maps to a valid KeyCode
- Consider adding safety features to prevent keys from being stuck down
- May want to track pressed keys to ensure proper cleanup
- Error handling for invalid key codes
Priority
Medium - This feature enables advanced automation scenarios but requires careful implementation to avoid leaving keys in a pressed state.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels