Skip to content

Commit c191bee

Browse files
Add Claude Computer Use key mappings (#21)
* fix(computer-use): missing page_up, page_down, and cmd mappings * fix(computer-use): missing minus, equal, and plus key mappings --------- Co-authored-by: Matt Marangoni <[email protected]>
1 parent 70b4b0f commit c191bee

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

templates/python/computer-use/tools/computer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
MODIFIER_KEY_MAP = {
2323
'ctrl': 'Control',
2424
'alt': 'Alt',
25+
'cmd': 'Meta',
2526
'command': 'Meta',
2627
'win': 'Meta',
2728
}
@@ -37,7 +38,9 @@
3738
'home': 'Home',
3839
'end': 'End',
3940
'pageup': 'PageUp',
41+
'page_up': 'PageUp',
4042
'pagedown': 'PageDown',
43+
'page_down': 'PageDown',
4144
'delete': 'Delete',
4245
'backspace': 'Backspace',
4346
'tab': 'Tab',
@@ -57,6 +60,9 @@
5760
'f10': 'F10',
5861
'f11': 'F11',
5962
'f12': 'F12',
63+
'minus': '-',
64+
'equal': '=',
65+
'plus': '+',
6066
}
6167

6268
Action_20241022 = Literal[

templates/typescript/computer-use/tools/utils/keyboard.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export class KeyboardUtils {
33
private static readonly modifierKeyMap: Record<string, string> = {
44
'ctrl': 'Control',
55
'alt': 'Alt',
6+
'cmd': 'Meta',
67
'command': 'Meta',
78
'win': 'Meta',
89
};
@@ -18,7 +19,9 @@ export class KeyboardUtils {
1819
'home': 'Home',
1920
'end': 'End',
2021
'pageup': 'PageUp',
22+
'page_up': 'PageUp',
2123
'pagedown': 'PageDown',
24+
'page_down': 'PageDown',
2225
'delete': 'Delete',
2326
'backspace': 'Backspace',
2427
'tab': 'Tab',
@@ -38,7 +41,10 @@ export class KeyboardUtils {
3841
'f10': 'F10',
3942
'f11': 'F11',
4043
'f12': 'F12',
41-
};
44+
'minus': '-',
45+
'equal': '=',
46+
'plus': '+',
47+
};
4248

4349
static isModifierKey(key: string | undefined): boolean {
4450
if (!key) return false;

0 commit comments

Comments
 (0)