Skip to content

Commit ddad45f

Browse files
author
Ives van Hoorne
committed
Set different defaults for windows
1 parent 63ae78f commit ddad45f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/app/src/app/store/preferences/keybindings.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import {
77
workspaceHiddenSelector,
88
} from '../view/selectors';
99

10+
const isMac = !!navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i);
11+
const metaKey = isMac ? 'Meta' : 'Ctrl';
12+
1013
export const KEYBINDINGS = {
1114
'editor.workspace': {
1215
title: 'Toggle Sidebar',
@@ -19,31 +22,31 @@ export const KEYBINDINGS = {
1922

2023
'editor.editor-mode': {
2124
title: 'Editor View',
22-
bindings: [['Meta', 'K', 'E']],
25+
bindings: [[metaKey, 'K', 'E']],
2326
action: ({ id }) => (dispatch: Function) => {
2427
dispatch(sandboxActions.setViewMode(id, true, false));
2528
},
2629
},
2730

2831
'editor.preview-mode': {
2932
title: 'Preview View',
30-
bindings: [['Meta', 'K', 'P']],
33+
bindings: [[metaKey, 'K', 'P']],
3134
action: ({ id }) => (dispatch: Function) => {
3235
dispatch(sandboxActions.setViewMode(id, false, true));
3336
},
3437
},
3538

3639
'editor.split-mode': {
3740
title: 'Split View',
38-
bindings: [['Meta', 'K', 'S']],
41+
bindings: [[metaKey, 'K', 'S']],
3942
action: ({ id }) => (dispatch: Function) => {
4043
dispatch(sandboxActions.setViewMode(id, true, true));
4144
},
4245
},
4346

4447
'editor.zen-mode': {
4548
title: 'Zen Mode',
46-
bindings: [['Meta', 'K', 'Z']],
49+
bindings: [[metaKey, 'K', 'Z']],
4750
action: () => (dispatch: Function, getState: Function) => {
4851
const currentZenMode = preferencesSelector(getState()).zenMode;
4952
dispatch(
@@ -56,7 +59,7 @@ export const KEYBINDINGS = {
5659

5760
'editor.toggle-console': {
5861
title: 'Toggle Console',
59-
bindings: [['Meta', 'K', 'D']],
62+
bindings: [[metaKey, 'K', 'D']],
6063
action: () => (dispatch: Function, getState: Function) => {
6164
const devToolsOpen = devToolsOpenSelector(getState());
6265
dispatch(viewActions.setDevToolsOpen(!devToolsOpen));

0 commit comments

Comments
 (0)