mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
Add option to disable hardware acceleration
This commit is contained in:
7
index.js
7
index.js
@ -8,6 +8,7 @@ const { autoUpdater } = require("electron-updater");
|
||||
const { setApplicationMenu } = require("./menu");
|
||||
const {
|
||||
autoUpdate,
|
||||
disableHardwareAcceleration,
|
||||
getEnabledPlugins,
|
||||
hideMenu,
|
||||
isAppVisible,
|
||||
@ -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")();
|
||||
|
||||
9
menu.js
9
menu.js
@ -12,6 +12,7 @@ const {
|
||||
isTrayEnabled,
|
||||
setOptions,
|
||||
startAtLogin,
|
||||
disableHardwareAcceleration,
|
||||
} = require("./store");
|
||||
|
||||
const mainMenuTemplate = (win) => [
|
||||
@ -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()
|
||||
? [
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@ const store = new Store({
|
||||
autoUpdates: true,
|
||||
hideMenu: false,
|
||||
startAtLogin: false,
|
||||
disableHardwareAcceleration: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -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"),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user