Skip to content

Commit

Permalink
fix: window switch on all keyboard layouts (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwyywm authored Sep 6, 2023
1 parent 9349b13 commit 3191d72
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/renderer/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,17 @@ export default function Layout() {
const isCmdOrCtrl = event.metaKey || event.ctrlKey;
const isShift = event.shiftKey;
console.debug('keydown', event.key, isCmdOrCtrl, event);
if (isCmdOrCtrl && !isShift && event.key in paneShortcutKeys) {
if (paneShortcutKeys[event.key] === null) {
if (
isCmdOrCtrl &&
(event.key in paneShortcutKeys ||
(event.code.match(/Digit[1-9]/) &&
event.code[event.code.length - 1] in paneShortcutKeys))
) {
const digit = +event.key || +event.code[event.code.length - 1];
if (paneShortcutKeys[digit] === null) {
window.electron.browserWindow.reload(); // this is a hack; setSizes by itself does not seem to update the splits, seems like a bug, but we dont have a choice here
} else {
setOpenPreviewPane(+event.key);
setOpenPreviewPane(digit);
}
} else if (isCmdOrCtrl && isShift && event.key.toLowerCase() === 'a') {
window.electron.browserWindow.reload();
Expand Down

0 comments on commit 3191d72

Please sign in to comment.