Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

added mappings for modifier keys

Dillon DuPontea31cc634084
diff --git a/libs/computer/computer/interface/models.py b/libs/computer/computer/interface/models.py
index b586a9f7de..c09a092cd6 100644
--- a/libs/computer/computer/interface/models.py
+++ b/libs/computer/computer/interface/models.py
@@ -7,6 +7,9 @@ NavigationKey = Literal['pagedown', 'pageup', 'home', 'end', 'left', 'right', 'u
# Special key literals
SpecialKey = Literal['enter', 'esc', 'tab', 'space', 'backspace', 'del']
+# Modifier key literals
+ModifierKey = Literal['ctrl', 'shift', 'win', 'command', 'option']
+
# Function key literals
FunctionKey = Literal['f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12']
@@ -35,6 +38,13 @@ class Key(Enum):
BACKSPACE = 'backspace'
DELETE = 'del'
+ # Modifier keys
+ CTRL = 'ctrl'
+ SHIFT = 'shift'
+ WIN = 'win'
+ COMMAND = 'command'
+ OPTION = 'option'
+
# Function keys
F1 = 'f1'
F2 = 'f2'
@@ -73,14 +83,26 @@ class Key(Enum):
'escape': cls.ESCAPE,
'esc': cls.ESC,
'delete': cls.DELETE,
- 'del': cls.DELETE
+ 'del': cls.DELETE,
+ # Modifier key mappings
+ 'ctrl': cls.CTRL,
+ 'control': cls.CTRL,
+ 'shift': cls.SHIFT,
+ 'win': cls.WIN,
+ 'windows': cls.WIN,
+ 'command': cls.COMMAND,
+ 'cmd': cls.COMMAND,
+ '⌘': cls.COMMAND,
+ 'option': cls.OPTION,
+ 'alt': cls.OPTION,
+ '⌥': cls.OPTION,
}
normalized = key.lower().strip()
return key_mapping.get(normalized, key)
# Combined key type
-KeyType = Union[Key, NavigationKey, SpecialKey, FunctionKey, str]
+KeyType = Union[Key, NavigationKey, SpecialKey, ModifierKey, FunctionKey, str]
class AccessibilityWindow(TypedDict):
"""Information about a window in the accessibility tree."""