update prompt version and lint

This commit is contained in:
Araxeus
2021-05-05 02:53:05 +03:00
parent 98c00f7a60
commit 5cee331abe
4 changed files with 35 additions and 34 deletions

View File

@ -37,25 +37,6 @@ const customTitlebarPath = path.join(app.getAppPath(), "plugins", "in-app-menu",
// Helper function for globalShortcuts prompt
const kb = (label_, value_, default_) => { return { value: value_, label: label_, default: default_ || undefined }; };
function setupPromptOptions(options) {
// TODO Custom titlebar needs testing on macOS
if (is.macOS()) {
Object.assign(options, {
customStylesheet: "dark",
icon: iconPath
});
} else {
Object.assign(options, {
customStylesheet: "dark",
icon: iconPath,
// The following are used for custom titlebar
frame: false,
customScript: customTitlebarPath,
enableRemoteModule: true
});
}
}
function promptVolumeSteps(win, options) {
const promptOptions = {
title: "Volume Steps",
@ -67,12 +48,13 @@ function promptVolumeSteps(win, options) {
setupPromptOptions(promptOptions);
prompt(promptOptions, win).then(input => {
if (input || input === 0) { // 0 is somehow valid
options.steps = input;
setOptions("precise-volume", options);
}
}).catch(console.error);
prompt(promptOptions, win)
.then(output => {
if (output || output === 0) { // 0 is somehow valid
options.steps = output;
setOptions("precise-volume", options);
}
}).catch(console.error);
}
function promptGlobalShortcuts(win, options, item) {
@ -106,3 +88,22 @@ function promptGlobalShortcuts(win, options, item) {
})
.catch(console.error);
}
function setupPromptOptions(options) {
// TODO Custom titlebar needs testing on macOS
if (is.macOS()) {
Object.assign(options, {
customStylesheet: "dark",
icon: iconPath
});
} else {
Object.assign(options, {
customStylesheet: "dark",
icon: iconPath,
// The following are used for custom titlebar
frame: false,
customScript: customTitlebarPath,
enableRemoteModule: true
});
}
}