Skip to content

Commit 5c33e98

Browse files
authored
Merge pull request #8 from oslabs-beta/staging
gRPC and Electron version update
2 parents f8a1d31 + 1b88e96 commit 5c33e98

File tree

4 files changed

+114
-106
lines changed

4 files changed

+114
-106
lines changed

main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ autoUpdater.logger = log;
4848
autoUpdater.logger.transports.file.level = "info";
4949
log.info("App starting...");
5050

51+
console.log("app.name is ->", app.name)
52+
5153
let mainWindow;
5254

5355
// -----------------------------------------------------------------
@@ -156,6 +158,7 @@ console.log("isDev->", isDev);
156158
// if (isDev === false) console.log("isDev is FALSE");
157159
// Temporary fix broken high-dpi scale factor on Windows (125% scaling)
158160
// info: https://github.com/electron/electron/issues/9691
161+
159162
if (process.platform === "win32") {
160163
// if user is on windows...
161164
app.commandLine.appendSwitch("high-dpi-support", "true");

menu/mainMenu.js

Lines changed: 94 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,190 +1,195 @@
1-
const {Menu} = require('electron')
2-
const electron = require('electron')
3-
const app = electron.app
1+
const { Menu } = require("electron");
2+
const electron = require("electron");
3+
const app = electron.app;
44
// --------------------------------------------------------------------------------------------------
55
// Here we are creating an array of menu tabs. Each menu tab will have its own list items(aka a sub-menu).
66
// This array called template will be our default menu set up
77
// --------------------------------------------------------------------------------------------------
88
const template = [
99
{
10-
label: 'Edit',
10+
label: "Edit",
1111
submenu: [
1212
{
13-
role: 'undo'
13+
role: "undo",
1414
},
1515
{
16-
role: 'redo'
16+
role: "redo",
1717
},
1818
{
19-
type: 'separator'// A dividing line between menu items
19+
type: "separator", // A dividing line between menu items
2020
},
2121
{
22-
role: 'cut'
22+
role: "cut",
2323
},
2424
{
25-
role: 'copy'
25+
role: "copy",
2626
},
2727
{
28-
role: 'paste'
28+
role: "paste",
2929
},
3030
{
31-
role: 'pasteandmatchstyle'
31+
role: "pasteandmatchstyle",
3232
},
3333
{
34-
role: 'delete'
34+
role: "delete",
3535
},
3636
{
37-
role: 'selectall'
38-
}
39-
]
37+
role: "selectall",
38+
},
39+
],
4040
},
4141
{
42-
label: 'View',
42+
label: "View",
4343
submenu: [
4444
{
45-
label: 'Reload',
46-
accelerator: 'CmdOrCtrl+R',//keyboard shortcut that will reload the current window
47-
click (item, focusedWindow) {
48-
if (focusedWindow) focusedWindow.reload()
49-
}
45+
label: "Reload",
46+
accelerator: "CmdOrCtrl+R", //keyboard shortcut that will reload the current window
47+
click(item, focusedWindow) {
48+
if (focusedWindow) focusedWindow.reload();
49+
},
5050
},
5151
{
52-
label: 'Toggle Developer Tools',
53-
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I', // another keyboard shortcut that will be conditionally assigned depending on whether or not user is on macOS
54-
click (item, focusedWindow) {
55-
if (focusedWindow) focusedWindow.webContents.toggleDevTools()
56-
}
52+
label: "Toggle Developer Tools",
53+
accelerator:
54+
process.platform === "darwin" ? "Alt+Command+I" : "Ctrl+Shift+I", // another keyboard shortcut that will be conditionally assigned depending on whether or not user is on macOS
55+
click(item, focusedWindow) {
56+
if (focusedWindow) focusedWindow.webContents.toggleDevTools();
57+
},
5758
},
5859
{
59-
type: 'separator'
60+
type: "separator",
6061
},
6162
{
62-
role: 'resetzoom'
63+
role: "resetzoom",
6364
},
6465
{
65-
role: 'zoomin'
66+
role: "zoomin",
6667
},
6768
{
68-
role: 'zoomout'
69+
role: "zoomout",
6970
},
7071
{
71-
type: 'separator'
72+
type: "separator",
7273
},
7374
{
74-
role: 'togglefullscreen'
75-
}
76-
]
75+
role: "togglefullscreen",
76+
},
77+
],
7778
},
7879
{
79-
role: 'window',
80+
role: "window",
8081
submenu: [
8182
{
82-
role: 'minimize'
83+
role: "minimize",
8384
},
8485
{
85-
role: 'close'
86-
}
87-
]
86+
role: "close",
87+
},
88+
],
8889
},
8990
{
90-
role: 'help',
91+
role: "help",
9192
submenu: [
9293
{
93-
label: 'Learn More',
94-
click () { require('electron').shell.openExternal('http://electron.atom.io') }
95-
}
96-
]
97-
}
98-
]
94+
label: "Learn More",
95+
click() {
96+
require("electron").shell.openExternal("http://electron.atom.io");
97+
},
98+
},
99+
],
100+
},
101+
];
99102
// --------------------------------------------------------------------------------------------------
100103

101-
102-
103104
// --------------------------------------------------------------------------------------------------
104105
// If the user is on mac create an extra menu tab that will be labeled as the name of your app
105106
// This new tab will have submenu features that windows and linux users will not have access to
106107
// --------------------------------------------------------------------------------------------------
107-
if (process.platform === 'darwin') {// if user is on mac...
108-
const name = app.getName()
109-
template.unshift({// add on these new menu items
108+
if (process.platform === "darwin") {
109+
// if user is on mac...
110+
const name = app.name;
111+
template.unshift({
112+
// add on these new menu items
110113
label: name,
111114
submenu: [
112115
{
113-
role: 'about'
116+
role: "about",
114117
},
115118
{
116-
type: 'separator'
119+
type: "separator",
117120
},
118121
{
119-
role: 'services',
120-
submenu: []
122+
role: "services",
123+
submenu: [],
121124
},
122125
{
123-
type: 'separator'
126+
type: "separator",
124127
},
125128
{
126-
role: 'hide'
129+
role: "hide",
127130
},
128131
{
129-
role: 'hideothers'
132+
role: "hideothers",
130133
},
131134
{
132-
role: 'unhide'
135+
role: "unhide",
133136
},
134137
{
135-
type: 'separator'
138+
type: "separator",
136139
},
137140
{
138-
role: 'quit'
139-
}
140-
]
141-
})
142-
// template[1] refers to the Edit menu.
143-
template[1].submenu.push(// If user is on macOS also provide speech based submenu items in addition to the edit menu's other submenu items that were set earlier
141+
role: "quit",
142+
},
143+
],
144+
});
145+
// template[1] refers to the Edit menu.
146+
template[1].submenu.push(
147+
// If user is on macOS also provide speech based submenu items in addition to the edit menu's other submenu items that were set earlier
144148
{
145-
type: 'separator'
149+
type: "separator",
146150
},
147151
{
148-
label: 'Speech',
152+
label: "Speech",
149153
submenu: [
150154
{
151-
role: 'startspeaking'
155+
role: "startspeaking",
152156
},
153157
{
154-
role: 'stopspeaking'
155-
}
156-
]
158+
role: "stopspeaking",
159+
},
160+
],
157161
}
158-
)
162+
);
159163
//template[3] refers to the Window menu.
160-
template[3].submenu = [ // if user is on macOS replace the Window menu that we created earlier with the submenu below
164+
template[3].submenu = [
165+
// if user is on macOS replace the Window menu that we created earlier with the submenu below
161166
{
162-
label: 'Close',
163-
accelerator: 'CmdOrCtrl+W',
164-
role: 'close'
167+
label: "Close",
168+
accelerator: "CmdOrCtrl+W",
169+
role: "close",
165170
},
166171
{
167-
label: 'Minimize',
168-
accelerator: 'CmdOrCtrl+M',
169-
role: 'minimize'
172+
label: "Minimize",
173+
accelerator: "CmdOrCtrl+M",
174+
role: "minimize",
170175
},
171176
{
172-
label: 'Zoom',
173-
role: 'zoom'
177+
label: "Zoom",
178+
role: "zoom",
174179
},
175180
{
176-
type: 'separator'
181+
type: "separator",
177182
},
178183
{
179-
label: 'Bring All to Front',
180-
role: 'front'
181-
}
182-
]
184+
label: "Bring All to Front",
185+
role: "front",
186+
},
187+
];
183188
}
184189
// create our menu with the Menu module imported from electron,
185190
// use its built in method buildFromTemplate
186191
// and pass in the template we've just created
187-
const menu = Menu.buildFromTemplate(template)
192+
const menu = Menu.buildFromTemplate(template);
188193

189194
// append our newly created menu to our app
190-
Menu.setApplicationMenu(menu)
195+
Menu.setApplicationMenu(menu);

0 commit comments

Comments
 (0)