mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
fix changing settings when plugin is disabled
This commit is contained in:
12
plugins/precise-volume/back.js
Normal file
12
plugins/precise-volume/back.js
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
this is used to determine if plugin is actually active
|
||||
(not if its only enabled in options)
|
||||
*/
|
||||
let enabled = false;
|
||||
module.exports = (win,options) => {
|
||||
enabled = true;
|
||||
};
|
||||
|
||||
module.exports.enabled = () => {
|
||||
return enabled;
|
||||
};
|
||||
@ -1,10 +1,19 @@
|
||||
const { enabled } = require("./back")
|
||||
const { setOptions } = require("../../config/plugins");
|
||||
|
||||
module.exports = (win, options) => [
|
||||
{
|
||||
label: "Arrowkeys controls",
|
||||
type: "checkbox",
|
||||
checked: !!options.arrowsShortcut,
|
||||
click: (item) => {
|
||||
//dynamically change setting if plugin enabled
|
||||
if (enabled()) {
|
||||
win.webContents.send("setArrowsShortcut", item.checked);
|
||||
} else { //fallback to usual method if disabled
|
||||
options.arrowsShortcut = item.checked;
|
||||
setOptions("precise-volume", options);
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user