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 backtick mapping for macOS symbol layer #113

Merged
merged 2 commits into from
Dec 5, 2023
Merged

Conversation

JoyceZhu
Copy link
Contributor

@JoyceZhu JoyceZhu commented Dec 5, 2023

This was mapped to the tilde (~), which is Shift + Backtick on US-English QWERTY layouts; Alt + Backtick is actually a Mac dead key for inputting accents, so we'll map the backtick to itself.

This was mapped to the tilde (~), which is Shift + ` (backtick) on US-English QWERTY layouts; Alt + ` is actually a Mac dead key for inputting accents, so we'll map the backtick to itself.
@JoyceZhu JoyceZhu requested a review from iansan5653 December 5, 2023 04:48
@JoyceZhu JoyceZhu requested a review from a team as a code owner December 5, 2023 04:48
@JoyceZhu JoyceZhu requested a review from jfuchs December 5, 2023 04:48
Copy link
Member

@iansan5653 iansan5653 left a comment

Choose a reason for hiding this comment

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

This should definitely fix the immediate bug and I think it's the right change, but maybe to guard against future cases where these keys might overlap, we should consider only using this map if Alt is pressed. It would be pretty easy to update the logic where this is used (hotkey/src/hotkey.ts#50) to add this check:

- const nonOptionPlaneKey = matchApplePlatform.test(platform) ? macosSymbolLayerKeys[key] ?? key : key
+ const nonOptionPlaneKey = hotkeyString.includes('Alt') && matchApplePlatform.test(platform) ? macosSymbolLayerKeys[key] ?? key : key

This would help prevent any future bugs in case an alt-key overlaps with a non-alt-key.

@@ -16,7 +16,7 @@ export const macosSymbolLayerKeys: Record<string, string> = {
['º']: '0',
['–']: '-',
['≠']: '=',
['`']: '~',
['`']: '`',
Copy link
Member

Choose a reason for hiding this comment

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

We should be able to just delete this line, since the default is to use the key itself:

const nonOptionPlaneKey = matchApplePlatform.test(platform) ? macosSymbolLayerKeys[key] ?? key : key

Suggested change
['`']: '`',

@JoyceZhu JoyceZhu merged commit 13f3419 into main Dec 5, 2023
@JoyceZhu JoyceZhu deleted the JoyceZhu-patch-1 branch December 5, 2023 15:38
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

Successfully merging this pull request may close these issues.

2 participants