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

CommandOrControl+` not working on mac #108

Open
walterdolce opened this issue Apr 1, 2024 · 3 comments
Open

CommandOrControl+` not working on mac #108

walterdolce opened this issue Apr 1, 2024 · 3 comments

Comments

@walterdolce
Copy link

Using this for the first time. The code below does not work on a mac:

electronLocalshortcut.register( 'CmdOrCtrl+`', () => {
    console.log(12123123);
});

I suspect the issue is somewhere around here:

# index.js -> L129 ...

	const event = _normalizeEvent(input);

	debug(`before-input-event: ${input} is translated to: ${event}`);
	for (const {eventStamp, callback} of shortcutsOfWindow) {
		console.log(equals(eventStamp, event), eventStamp, event);
		**if (equals(eventStamp, event)) {**
			debug(`eventStamp: ${eventStamp} match`);
			callback();

			return;
		}

Console output:

false { metaKey: true, key: '`', code: 'Backquote' } {
  code: 'MetaLeft',
  key: 'Meta',
  altKey: false,
  shiftKey: false,
  metaKey: true,
  ctrlKey: false
}
@walterdolce
Copy link
Author

walterdolce commented Apr 1, 2024

The input var contains this:

{
  type: 'keyDown',
  key: 'Meta',
  code: 'MetaLeft',
  isAutoRepeat: false,
  isComposing: false,
  shift: false,
  control: false,
  alt: false,
  meta: true,
  location: 1,
  _modifiers: 2056,
  modifiers: [ 'left', 'meta' ]
}

@walterdolce
Copy link
Author

Worth mentioning Ctrl+` works. Output from the console.log as per above code:

false
EventStamp:  { ctrlKey: true, key: '`', code: 'Backquote' }
Event:  {
  code: 'ControlLeft',
  key: 'Control',
  altKey: false,
  shiftKey: false,
  metaKey: false,
  ctrlKey: true
}
Input:  {
  type: 'keyDown',
  key: 'Control',
  code: 'ControlLeft',
  isAutoRepeat: false,
  isComposing: false,
  shift: false,
  control: true,
  alt: false,
  meta: false,
  location: 1,
  _modifiers: 2050,
  modifiers: [ 'control', 'left' ]
}
true
EventStamp:  { ctrlKey: true, key: '`', code: 'Backquote' }
Event:  {
  code: 'Backquote',
  key: '`',
  altKey: false,
  shiftKey: false,
  metaKey: false,
  ctrlKey: true
}
Input:  {
  type: 'keyDown',
  key: '`',
  code: 'Backquote',
  isAutoRepeat: false,
  isComposing: false,
  shift: false,
  control: true,
  alt: false,
  meta: false,
  location: 0,
  _modifiers: 2,
  modifiers: [ 'control' ]
}
12123123
false
EventStamp:  { ctrlKey: true, key: '`', code: 'Backquote' }
Event:  {
  code: 'MetaLeft',
  key: 'Meta',
  altKey: false,
  shiftKey: false,
  metaKey: true,
  ctrlKey: false
}
Input:  {
  type: 'keyDown',
  key: 'Meta',
  code: 'MetaLeft',
  isAutoRepeat: false,
  isComposing: false,
  shift: false,
  control: false,
  alt: false,
  meta: true,
  location: 1,
  _modifiers: 2056,
  modifiers: [ 'left', 'meta' ]
}

@walterdolce
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant