Skip to content

Commit c7ba815

Browse files
PauliusPaulius
authored andcommitted
For unknown reasons keydown + keyup is more reliable than hotkey
1 parent 8dd63eb commit c7ba815

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/generalagents/macos/computer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ def _scaled(self, coord: Coordinate) -> tuple[int, int]:
5252
def _execute_action(self, action: Action) -> None:
5353
match action:
5454
case ActionKeyPress(kind="key_press", keys=keys) if keys:
55-
pyautogui.hotkey(*keys)
55+
for key in keys:
56+
pyautogui.keyDown(key)
57+
for key in reversed(keys):
58+
pyautogui.keyUp(key)
5659

5760
case ActionType(kind="type", text=text) if text:
5861
pyautogui.write(text)

0 commit comments

Comments
 (0)