Add restart command
This commit is contained in:
parent
ced53a8732
commit
6c39f41077
|
@ -38,9 +38,9 @@ const openPath = (event, path) => {
|
|||
else shell.openPath(path);
|
||||
};
|
||||
|
||||
const relaunch = () => {
|
||||
const relaunch = (event, args = []) => {
|
||||
app.relaunch({args: process.argv.slice(1).concat(Array.isArray(args) ? args : [args])});
|
||||
app.quit();
|
||||
app.relaunch();
|
||||
};
|
||||
|
||||
const runScript = async (event, script) => {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Builtin from "@structs/builtin";
|
||||
import buildAddonCommand from "./addons";
|
||||
import DebugCommand from "./debug";
|
||||
import RestartCommand from "./restart";
|
||||
|
||||
|
||||
export default new class DefaultCommands extends Builtin {
|
||||
|
@ -12,7 +13,8 @@ export default new class DefaultCommands extends Builtin {
|
|||
this.addCommands(
|
||||
buildAddonCommand("plugin"),
|
||||
buildAddonCommand("theme"),
|
||||
DebugCommand
|
||||
DebugCommand,
|
||||
RestartCommand
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
import {OptionTypes} from "@modules/commandmanager";
|
||||
import ipc from "@modules/ipc";
|
||||
|
||||
|
||||
export default {
|
||||
id: "restart",
|
||||
name: "restart",
|
||||
description: "Restart Discord with or without BetterDiscord",
|
||||
options: [
|
||||
{
|
||||
type: OptionTypes.BOOLEAN,
|
||||
name: "vanilla",
|
||||
description: "Should Discord be relaunched without BetterDiscord?",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
execute: async (data) => {
|
||||
const vanilla = data.find(o => o.name === "vanilla").value;
|
||||
ipc.relaunch(vanilla ? ["--vanilla"] : []);
|
||||
}
|
||||
};
|
|
@ -25,8 +25,8 @@ export default new class IPCRenderer {
|
|||
return ipc.send(IPCEvents.TOGGLE_DEVTOOLS);
|
||||
}
|
||||
|
||||
relaunch() {
|
||||
return ipc.send(IPCEvents.RELAUNCH);
|
||||
relaunch(args) {
|
||||
return ipc.send(IPCEvents.RELAUNCH, args);
|
||||
}
|
||||
|
||||
runScript(script) {
|
||||
|
|
Loading…
Reference in New Issue