Skip to content

Commit

Permalink
Allow editing config (advanced)
Browse files Browse the repository at this point in the history
  • Loading branch information
th-ch committed Dec 3, 2020
1 parent a5130c1 commit f4fe5c2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
1 change: 1 addition & 0 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ const get = (key) => {
module.exports = {
get,
set,
edit: () => store.openInEditor(),
plugins,
};
42 changes: 29 additions & 13 deletions menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,29 @@ const config = require("./config");
const mainMenuTemplate = (win) => [
{
label: "Plugins",
submenu: getAllPlugins().map((plugin) => {
return {
label: plugin,
type: "checkbox",
checked: config.plugins.isEnabled(plugin),
click: (item) => {
if (item.checked) {
config.plugins.enable(plugin);
} else {
config.plugins.disable(plugin);
}
submenu: [
...getAllPlugins().map((plugin) => {
return {
label: plugin,
type: "checkbox",
checked: config.plugins.isEnabled(plugin),
click: (item) => {
if (item.checked) {
config.plugins.enable(plugin);
} else {
config.plugins.disable(plugin);
}
},
};
}),
{ type: "separator" },
{
label: "Advanced options",
click: () => {
config.edit();
},
};
}),
},
],
},
{
label: "Options",
Expand Down Expand Up @@ -101,6 +110,7 @@ const mainMenuTemplate = (win) => [
},
],
},
{ type: "separator" },
{
label: "Toggle DevTools",
// Cannot use "toggleDevTools" role in MacOS
Expand All @@ -114,6 +124,12 @@ const mainMenuTemplate = (win) => [
}
},
},
{
label: "Advanced options",
click: () => {
config.edit();
},
},
],
},
];
Expand Down

0 comments on commit f4fe5c2

Please sign in to comment.