diff --git a/src/main/common/common.js b/src/main/common/common.js
index 9a96fd2..64c8cdd 100644
--- a/src/main/common/common.js
+++ b/src/main/common/common.js
@@ -1,6 +1,7 @@
-import {app} from 'electron';
-import './config';
-import Listener from './listener';
+import { app } from "electron";
+import "./config";
+import Listener from "./listener";
+import { remote } from "electron";
export default function init(mainWindow) {
const listener = new Listener();
@@ -16,11 +17,11 @@ export default function init(mainWindow) {
}
});
- // 打包后,失焦隐藏
- mainWindow.on('blur', () => {
- app.isPackaged && mainWindow.hide();
+ // 判断失焦是否隐藏
+ mainWindow.on("blur", () => {
+ const config = { ...opConfig.get() };
+ if (config.perf.common.hideOnBlur) {
+ mainWindow.hide();
+ }
});
-
}
-
-
diff --git a/src/main/common/config.js b/src/main/common/config.js
index 0ff3c4e..99b190e 100644
--- a/src/main/common/config.js
+++ b/src/main/common/config.js
@@ -2,6 +2,7 @@ import path from "path";
import fs from "fs";
import { getLocalDataFile } from "./utils";
import os from "os";
+import { app } from "electron";
const configPath = path.join(getLocalDataFile(), "./rubick-config.json");
@@ -16,6 +17,8 @@ const defaultConfigForAnyPlatform = {
common: {
start: true,
space: true,
+ // 是否失焦隐藏。默认在dev环境不隐藏,在打包后隐藏。
+ hideOnBlur: app.isPackaged,
},
local: {
search: true,
diff --git a/src/renderer/App.vue b/src/renderer/App.vue
index 8920358..7707e65 100644
--- a/src/renderer/App.vue
+++ b/src/renderer/App.vue
@@ -59,6 +59,14 @@
+
+
+
{
this.commonUpdate({
@@ -147,7 +154,6 @@ export default {
});
};
},
-
mounted() {
ipcRenderer.on("init-rubick", this.closeTag);
ipcRenderer.on("new-window", this.newWindow);
@@ -319,10 +325,14 @@ export default {
}
},
changePath({ key }) {
- this.$router.push({ path: `/home/${key}` });
- this.commonUpdate({
- current: [key],
- });
+ const path = `/home/${key}`;
+ // 避免重复点击导致跳转相同路由而爆红
+ if (this.$router.history.current.fullPath != path) {
+ this.$router.push({ path });
+ this.commonUpdate({
+ current: [key],
+ });
+ }
},
closeTag(v) {
this.commonUpdate({
@@ -396,6 +406,11 @@ export default {
ipcRenderer.send("window-move");
}
},
+ changeHideOnBlur(e) {
+ let cfg = { ...this.config };
+ cfg.perf.common.hideOnBlur = !cfg.perf.common.hideOnBlur;
+ this.config = cfg;
+ },
},
computed: {
...mapState("main", [
@@ -410,7 +425,7 @@ export default {
"pluginLoading",
]),
showOptions() {
- // 有选项值,且不在显示主页
+ // 有选项值,且不在显示主页。(即出现下方选项框)
if (this.options.length && !this.showMain) {
return true;
}
@@ -419,6 +434,17 @@ export default {
return this.pluginInfo.searchType ? "subWindow" : "";
},
},
+ watch: {
+ config: {
+ deep: true,
+ handler() {
+ opConfig.set("perf", this.config.perf);
+ opConfig.set("superPanel", this.config.superPanel);
+ opConfig.set("global", this.config.global);
+ ipcRenderer.send("re-register");
+ },
+ },
+ },
};
diff --git a/src/renderer/pages/search/subpages/settings.vue b/src/renderer/pages/search/subpages/settings.vue
index 0a2fc79..c19aaba 100644
--- a/src/renderer/pages/search/subpages/settings.vue
+++ b/src/renderer/pages/search/subpages/settings.vue
@@ -1,7 +1,11 @@
-
+
偏好设置
@@ -15,40 +19,72 @@
-
快捷键(需要使用 option/ctrl/shift/command 键修饰)
+
+ 快捷键(需要使用 option/ctrl/shift/command 键修饰)
+
显示/隐藏快捷键
-
changeShortCut(e, 'showAndHidden')">{{ config.perf.shortCut.showAndHidden }}
+
changeShortCut(e, 'showAndHidden')"
+ >
+ {{ config.perf.shortCut.showAndHidden }}
+
插件分离快捷键
-
changeShortCut(e, 'separate')">{{ config.perf.shortCut.separate }}
+
changeShortCut(e, 'separate')"
+ >
+ {{ config.perf.shortCut.separate }}
+
返回主界面
-
changeShortCut(e, 'quit')">{{ config.perf.shortCut.quit }}
+
changeShortCut(e, 'quit')"
+ >
+ {{ config.perf.shortCut.quit }}
+
-
+
- 按下快捷键,自动搜索对应关键字,当关键字结果完全匹配,且结果唯一时,会直接指向该功能。
+
+ 按下快捷键,自动搜索对应关键字,当关键字结果完全匹配,且结果唯一时,会直接指向该功能。
+
示例
-
+
{{ item.title }}
@@ -82,80 +123,81 @@
快捷键
- 先按功能键(Ctrl、Shift、Alt、Option、Command),再按其他普通键。或按 F1-F12 单键
+ 先按功能键(Ctrl、Shift、Alt、Option、Command),再按其他普通键。或按
+ F1-F12 单键
changeGlobalKey(e, index)"
+ v-for="(item, index) in config.global"
+ class="value"
+ tabIndex="-1"
+ @keyup="(e) => changeGlobalKey(e, index)"
>
{{ item.key }}
-
功能关键字
changeGlobalValue(index, e.target.value)"
+ :value="item.value"
+ v-for="(item, index) in config.global"
+ class="value"
+ :disabled="!item.key"
+ @change="(e) => changeGlobalValue(index, e.target.value)"
/>
-
+ 新增全局快捷功能
+
+ 新增全局快捷功能
-