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 {wsapi} from "./wsapi";
import {AppImageUpdater, NsisUpdater} from "electron-updater"; import {AppImageUpdater, NsisUpdater} from "electron-updater";
import {utils} from './utils'; import {utils} from './utils';
const fileWatcher = require('chokidar'); const fileWatcher = require('chokidar');
const AdmZip = require("adm-zip"); const AdmZip = require("adm-zip");
@ -233,6 +234,7 @@ export class BrowserWindow {
preload: join(utils.getPath('srcPath'), "./preload/cider-preload.js"), preload: join(utils.getPath('srcPath'), "./preload/cider-preload.js"),
}, },
}; };
StartWatcher(path: string) { StartWatcher(path: string) {
var chokidar = require("chokidar"); var chokidar = require("chokidar");
@ -272,6 +274,7 @@ export class BrowserWindow {
// console.log('Raw event info:', event, path, details); // console.log('Raw event info:', event, path, details);
}); });
} }
/** /**
* Creates the browser window * 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) => { ipcMain.on("get-i18n", (event, key) => {
event.returnValue = utils.getLocale(key); event.returnValue = utils.getLocale(key);
}); });

View file

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