added open themes folder button

This commit is contained in:
booploops 2022-02-28 22:12:38 -08:00
parent f46826d696
commit b4de904cd0
2 changed files with 47 additions and 21 deletions

View file

@ -12,6 +12,7 @@ import fetch from 'electron-fetch'
import {wsapi} from "./wsapi";
import {AppImageUpdater, NsisUpdater} from "electron-updater";
import {utils} from './utils';
const fileWatcher = require('chokidar');
const AdmZip = require("adm-zip");
@ -233,6 +234,7 @@ export class BrowserWindow {
preload: join(utils.getPath('srcPath'), "./preload/cider-preload.js"),
},
};
StartWatcher(path: string) {
var chokidar = require("chokidar");
@ -272,6 +274,7 @@ export class BrowserWindow {
// console.log('Raw event info:', event, path, details);
});
}
/**
* Creates the browser window
*/
@ -678,6 +681,21 @@ export class BrowserWindow {
}
});
ipcMain.handle("open-path", async (event, path) => {
switch(path) {
default:
case "plugins":
shell.openPath(utils.getPath("plugins"));
break;
case "userdata":
shell.openPath(app.getPath("userData"));
break;
case "themes":
shell.openPath(utils.getPath("themes"));
break;
}
});
ipcMain.on("get-i18n", (event, key) => {
event.returnValue = utils.getLocale(key);
});

View file

@ -12,6 +12,11 @@
<option v-for="theme in themes" :value="theme.file">{{ theme.name }}</option>
</select>
</div>
<div class="col-auto flex-center">
<button class="md-btn md-btn-small md-btn-block" @click="openThemesFolder()">
Open Themes Folder
</button>
</div>
<div class="col-auto nopadding flex-center">
<button class="md-btn md-btn-small md-btn-block" @click="installThemeURL()">
{{$root.getLz('settings.option.visual.theme.github.download')}}
@ -99,6 +104,9 @@
this.getInstalledThemes();
},
methods: {
openThemesFolder() {
ipcRenderer.invoke("open-path", "themes")
},
getInstalledThemes() {
let self = this
const themes = ipcRenderer.sendSync("get-themes")