mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-28 16:42:47 +08:00
Merge pull request #167 from rubickCenter/feature/settings
Feature/settings
This commit is contained in:
commit
5a038031e7
@ -1,7 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
<div class="slider-bar">
|
<div class="slider-bar">
|
||||||
<a-menu v-model:selectedKeys="active" mode="horizontal" @select="({key}) => changeMenu(key)">
|
<a-menu
|
||||||
|
v-model:selectedKeys="active"
|
||||||
|
mode="horizontal"
|
||||||
|
@select="({ key }) => changeMenu(key)"
|
||||||
|
>
|
||||||
<a-menu-item key="market">
|
<a-menu-item key="market">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<AppstoreOutlined />
|
<AppstoreOutlined />
|
||||||
@ -46,7 +50,7 @@ import {
|
|||||||
UserOutlined,
|
UserOutlined,
|
||||||
AppstoreOutlined,
|
AppstoreOutlined,
|
||||||
SettingOutlined,
|
SettingOutlined,
|
||||||
BugOutlined,
|
BugOutlined
|
||||||
} from "@ant-design/icons-vue";
|
} from "@ant-design/icons-vue";
|
||||||
import { useStore } from "vuex";
|
import { useStore } from "vuex";
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -63,7 +67,6 @@ window.rubick.onPluginEnter(({ code }: { code: string }) => {
|
|||||||
const store = useStore();
|
const store = useStore();
|
||||||
const init = () => store.dispatch("init");
|
const init = () => store.dispatch("init");
|
||||||
init();
|
init();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
* {
|
* {
|
||||||
@ -74,7 +77,7 @@ init();
|
|||||||
.main-container {
|
.main-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
background: #F2EFEF;
|
background: #f2efef;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
.slider-bar {
|
.slider-bar {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rubick",
|
"name": "rubick",
|
||||||
"version": "2.0.4-beta.3",
|
"version": "2.0.5",
|
||||||
"author": "muwoo <2424880409@qq.com>",
|
"author": "muwoo <2424880409@qq.com>",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -2,10 +2,11 @@ import { dialog, Menu, Tray, app, shell, BrowserWindow } from "electron";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import pkg from "../../../package.json";
|
import pkg from "../../../package.json";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
|
import API from "../common/api";
|
||||||
import commonConst from "@/common/utils/commonConst";
|
import commonConst from "@/common/utils/commonConst";
|
||||||
|
|
||||||
function createTray(window: BrowserWindow): Promise<Tray> {
|
function createTray(window: BrowserWindow): Promise<Tray> {
|
||||||
return new Promise((resolve) => {
|
return new Promise(resolve => {
|
||||||
let icon;
|
let icon;
|
||||||
if (commonConst.macOS()) {
|
if (commonConst.macOS()) {
|
||||||
icon = "./icons/icon@3x.png";
|
icon = "./icons/icon@3x.png";
|
||||||
@ -24,6 +25,13 @@ function createTray(window: BrowserWindow): Promise<Tray> {
|
|||||||
return config.perf.shortCut.showAndHidden;
|
return config.perf.shortCut.showAndHidden;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const openSettings = () => {
|
||||||
|
window.webContents.executeJavaScript(
|
||||||
|
`window.rubick && window.rubick.openMenu && window.rubick.openMenu({ code: "settings" })`
|
||||||
|
);
|
||||||
|
window.show();
|
||||||
|
};
|
||||||
|
|
||||||
const createContextMenu = () =>
|
const createContextMenu = () =>
|
||||||
Menu.buildFromTemplate([
|
Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
@ -32,7 +40,7 @@ function createTray(window: BrowserWindow): Promise<Tray> {
|
|||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
shell.openExternal("https://github.com/clouDr-f2e/rubick");
|
shell.openExternal("https://github.com/clouDr-f2e/rubick");
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "意见反馈",
|
label: "意见反馈",
|
||||||
@ -40,7 +48,7 @@ function createTray(window: BrowserWindow): Promise<Tray> {
|
|||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
shell.openExternal("https://github.com/clouDr-f2e/rubick/issues");
|
shell.openExternal("https://github.com/clouDr-f2e/rubick/issues");
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{
|
{
|
||||||
@ -48,19 +56,27 @@ function createTray(window: BrowserWindow): Promise<Tray> {
|
|||||||
accelerator: getShowAndHiddenHotKey(),
|
accelerator: getShowAndHiddenHotKey(),
|
||||||
click() {
|
click() {
|
||||||
window.show();
|
window.show();
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "系统设置",
|
||||||
|
click() {
|
||||||
|
openSettings();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ type: "separator" },
|
||||||
{
|
{
|
||||||
role: "quit",
|
role: "quit",
|
||||||
label: "退出",
|
label: "退出"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "重启",
|
label: "重启",
|
||||||
click() {
|
click() {
|
||||||
app.relaunch();
|
app.relaunch();
|
||||||
app.quit();
|
app.quit();
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{
|
{
|
||||||
label: "关于",
|
label: "关于",
|
||||||
@ -68,10 +84,10 @@ function createTray(window: BrowserWindow): Promise<Tray> {
|
|||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
title: "拉比克",
|
title: "拉比克",
|
||||||
message: "极简、插件化的现代桌面软件",
|
message: "极简、插件化的现代桌面软件",
|
||||||
detail: `Version: ${pkg.version}\nAuthor: muwoo`,
|
detail: `Version: ${pkg.version}\nAuthor: muwoo`
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
]);
|
]);
|
||||||
appIcon.on("click", () => {
|
appIcon.on("click", () => {
|
||||||
appIcon.setContextMenu(createContextMenu());
|
appIcon.setContextMenu(createContextMenu());
|
||||||
|
@ -97,14 +97,17 @@ const changeIndex = index => {
|
|||||||
currentSelect.value = currentSelect.value + index;
|
currentSelect.value = currentSelect.value + index;
|
||||||
};
|
};
|
||||||
|
|
||||||
const openMenu = () => {
|
const openMenu = (ext) => {
|
||||||
openPlugin({
|
openPlugin({
|
||||||
...toRaw(menuPluginInfo.value),
|
...toRaw(menuPluginInfo.value),
|
||||||
feature: menuPluginInfo.value.features[0],
|
feature: menuPluginInfo.value.features[0],
|
||||||
cmd: "插件市场"
|
cmd: "插件市场",
|
||||||
|
ext
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.rubick.openMenu = openMenu
|
||||||
|
|
||||||
const choosePlugin = () => {
|
const choosePlugin = () => {
|
||||||
const currentChoose = options.value[currentSelect.value];
|
const currentChoose = options.value[currentSelect.value];
|
||||||
currentChoose.click();
|
currentChoose.click();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user