Skip to content

Commit

Permalink
Merge pull request #17780 from SimonBrandner/fix/space-shortcut-local…
Browse files Browse the repository at this point in the history
…/17776

Fix space shortcuts on layouts with non-English keys in the places of numbers
  • Loading branch information
t3chguy committed Jul 15, 2021
2 parents 8289d69 + 43695fb commit 2635fc9
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions src/vector/platform/ElectronPlatform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -589,24 +589,18 @@ export default class ElectronPlatform extends VectorBasePlatform {
handled = true;
}
break;
}

case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "0":
// ideally we would use SpaceStore.spacesEnabled here but importing SpaceStore in this platform
// breaks skinning as the platform is instantiated prior to the skin being loaded
if (SettingsStore.getValue("feature_spaces") && isOnlyCtrlOrCmdKeyEvent(ev)) {
this.navigateToSpace(parseInt(ev.key, 10));
handled = true;
}
break;
if (!handled &&
// ideally we would use SpaceStore.spacesEnabled here but importing SpaceStore in this platform
// breaks skinning as the platform is instantiated prior to the skin being loaded
SettingsStore.getValue("feature_spaces") &&
ev.code.startsWith("Digit") &&
isOnlyCtrlOrCmdKeyEvent(ev)
) {
const spaceNumber = ev.code.slice(5); // Cut off the first 5 characters - "Digit"
this.navigateToSpace(parseInt(spaceNumber, 10));
handled = true;
}

return handled;
Expand Down

0 comments on commit 2635fc9

Please sign in to comment.