Skip to content

Commit b051120

Browse files
committed
Added view switch, replaced editor icon, updated shortcuts.
Signed-off-by: ubi de feo <[email protected]>
1 parent a019c99 commit b051120

File tree

5 files changed

+44
-17
lines changed

5 files changed

+44
-17
lines changed

backend/menu.js

+22-10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const { app, Menu } = require('electron')
22
const path = require('path')
33
const openAboutWindow = require('about-window').default
44
const shortcuts = require('./shortcuts.js')
5+
const { type } = require('os')
56

67
module.exports = function registerMenu(win, state = {}) {
78
const isMac = process.platform === 'darwin'
@@ -99,6 +100,27 @@ module.exports = function registerMenu(win, state = {}) {
99100
},
100101
{
101102
label: 'View',
103+
submenu: [
104+
{
105+
label: 'Editor',
106+
accelerator: shortcuts.menu.EDITOR_VIEW,
107+
click: () => win.webContents.send('shortcut-cmd', shortcuts.global.EDITOR_VIEW,)
108+
},
109+
{
110+
label: 'Files',
111+
accelerator: shortcuts.menu.FILES_VIEW,
112+
click: () => win.webContents.send('shortcut-cmd', shortcuts.global.FILES_VIEW)
113+
},
114+
{ type: 'separator' },
115+
{ role: 'resetZoom' },
116+
{ role: 'zoomIn' },
117+
{ role: 'zoomOut' },
118+
{ type: 'separator' },
119+
{ role: 'togglefullscreen' },
120+
]
121+
},
122+
{
123+
label: 'Window',
102124
submenu: [
103125
{
104126
label: 'Reload',
@@ -116,16 +138,6 @@ module.exports = function registerMenu(win, state = {}) {
116138
},
117139
{ role: 'toggleDevTools'},
118140
{ type: 'separator' },
119-
{ role: 'resetZoom' },
120-
{ role: 'zoomIn' },
121-
{ role: 'zoomOut' },
122-
{ type: 'separator' },
123-
{ role: 'togglefullscreen' },
124-
]
125-
},
126-
{
127-
label: 'Window',
128-
submenu: [
129141
{ role: 'minimize' },
130142
{ role: 'zoom' },
131143
...(isMac ? [

backend/shortcuts.js

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ module.exports = {
88
STOP: 'CommandOrControl+H',
99
RESET: 'CommandOrControl+Shift+R',
1010
CLEAR_TERMINAL: 'CommandOrControl+L',
11+
EDITOR_VIEW: 'CommandOrControl+Alt+1',
12+
FILES_VIEW: 'CommandOrControl+Alt+2',
1113
ESC: 'Escape'
1214
},
1315
menu: {
@@ -19,5 +21,7 @@ module.exports = {
1921
STOP: 'CmdOrCtrl+H',
2022
RESET: 'CmdOrCtrl+Shift+R',
2123
CLEAR_TERMINAL: 'CmdOrCtrl+L',
24+
EDITOR_VIEW: 'CmdOrCtrl+Alt+1',
25+
FILES_VIEW: 'CmdOrCtrl+Alt+2'
2226
}
2327
}

ui/arduino/media/code.svg

+3
Loading

ui/arduino/store.js

+8
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,14 @@ async function store(state, emitter) {
14441444
if (state.view != 'editor') return
14451445
emitter.emit('save')
14461446
}
1447+
if (key === shortcuts.EDITOR_VIEW) {
1448+
if (state.view != 'file-manager') return
1449+
emitter.emit('change-view', 'editor')
1450+
}
1451+
if (key === shortcuts.FILES_VIEW) {
1452+
if (state.view != 'editor') return
1453+
emitter.emit('change-view', 'file-manager')
1454+
}
14471455
if (key === shortcuts.ESC) {
14481456
if (state.isConnectionDialogOpen) {
14491457
emitter.emit('close-connection-dialog')

ui/arduino/views/components/toolbar.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function Toolbar(state, emit) {
2424
2525
${Button({
2626
icon: 'run.svg',
27-
tooltip: `Run (${metaKeyString}+r)`,
27+
tooltip: `Run (${metaKeyString}+R)`,
2828
disabled: !_canExecute,
2929
onClick: (e) => {
3030
if (e.altKey) {
@@ -36,13 +36,13 @@ function Toolbar(state, emit) {
3636
})}
3737
${Button({
3838
icon: 'stop.svg',
39-
tooltip: `Stop (${metaKeyString}+h)`,
39+
tooltip: `Stop (${metaKeyString}+H)`,
4040
disabled: !_canExecute,
4141
onClick: () => emit('stop')
4242
})}
4343
${Button({
4444
icon: 'reboot.svg',
45-
tooltip: `Reset (${metaKeyString}+Shift+r)`,
45+
tooltip: `Reset (${metaKeyString}+Shift+R)`,
4646
disabled: !_canExecute,
4747
onClick: () => emit('reset')
4848
})}
@@ -51,22 +51,22 @@ function Toolbar(state, emit) {
5151
5252
${Button({
5353
icon: 'save.svg',
54-
tooltip: `Save (${metaKeyString}+s)`,
54+
tooltip: `Save (${metaKeyString}+S)`,
5555
disabled: !_canSave,
5656
onClick: () => emit('save')
5757
})}
5858
5959
<div class="separator"></div>
6060
6161
${Button({
62-
icon: 'editor.svg',
63-
tooltip: 'Editor and REPL',
62+
icon: 'code.svg',
63+
tooltip: `Editor (${metaKeyString}+Alt+1)`,
6464
active: state.view === 'editor',
6565
onClick: () => emit('change-view', 'editor')
6666
})}
6767
${Button({
6868
icon: 'files.svg',
69-
tooltip: 'File Manager',
69+
tooltip: `Files (${metaKeyString}+Alt+2)`,
7070
active: state.view === 'file-manager',
7171
onClick: () => emit('change-view', 'file-manager')
7272
})}

0 commit comments

Comments
 (0)