Skip to content

Commit

Permalink
Merge pull request #77 from th-ch/disable-hardware-acceleration
Browse files Browse the repository at this point in the history
Add option to disable hardware acceleration
  • Loading branch information
th-ch authored Dec 2, 2020
2 parents 8f3e165 + ef9cd8c commit 6e42b09
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const { autoUpdater } = require("electron-updater");
const { setApplicationMenu } = require("./menu");
const {
autoUpdate,
disableHardwareAcceleration,
getEnabledPlugins,
hideMenu,
isAppVisible,
Expand All @@ -27,6 +28,12 @@ app.commandLine.appendSwitch(
"--experimental-wasm-threads --experimental-wasm-bulk-memory"
);
app.allowRendererProcessReuse = true; // https://github.com/electron/electron/issues/18397
if (disableHardwareAcceleration()) {
if (is.dev()) {
console.log("Disabling hardware acceleration");
}
app.disableHardwareAcceleration();
}

// Adds debug features like hotkeys for triggering dev tools and reload
require("electron-debug")();
Expand Down
9 changes: 9 additions & 0 deletions menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const {
isTrayEnabled,
setOptions,
startAtLogin,
disableHardwareAcceleration,
} = require("./store");

const mainMenuTemplate = (win) => [
Expand Down Expand Up @@ -43,6 +44,14 @@ const mainMenuTemplate = (win) => [
setOptions({ autoUpdates: item.checked });
},
},
{
label: "Disable hardware acceleration",
type: "checkbox",
checked: disableHardwareAcceleration(),
click: (item) => {
setOptions({ disableHardwareAcceleration: item.checked });
},
},
...(is.windows() || is.linux()
? [
{
Expand Down
3 changes: 3 additions & 0 deletions store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const store = new Store({
autoUpdates: true,
hideMenu: false,
startAtLogin: false,
disableHardwareAcceleration: false,
},
},
});
Expand All @@ -34,4 +35,6 @@ module.exports = {
autoUpdate: () => store.get("options.autoUpdates"),
hideMenu: () => store.get("options.hideMenu"),
startAtLogin: () => store.get("options.startAtLogin"),
disableHardwareAcceleration: () =>
store.get("options.disableHardwareAcceleration"),
};

0 comments on commit 6e42b09

Please sign in to comment.