Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix key handling for CTRL and CMD keys #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main/store/runAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ export const performAction = async (action: NextAction) => {
case 'key':
const keyMap = {
Return: Key.Enter,
ctrl: Key.LeftControl,
cmd: Key.LeftSuper,
};
const keys = action.text.split('+').map((key) => {
const mappedKey = keyMap[key as keyof typeof keyMap];
Expand Down Expand Up @@ -246,6 +248,12 @@ export const runAgent = async (
if (!getState().running) {
break;
}

// Replace 'ctrl' with 'cmd' for Mac OS
if (process.platform === 'darwin' && action.type === 'key') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should happen in the key mapping on line 183 I think?

action.text = action.text.replace('ctrl', 'cmd');
}

performAction(action);

await new Promise((resolve) => setTimeout(resolve, 500));
Expand Down