feat: 支持主程序拼音、缩写检索,支持 shift+Esc 呼起主界面

This commit is contained in:
muwoo
2021-08-03 13:00:15 +08:00
parent a65acbaeb3
commit a35a5ccfc3
8 changed files with 70 additions and 7 deletions

View File

@@ -7,10 +7,12 @@ const configPath = path.join(getlocalDataFile(), './rubick-config.json');
let defaultConfig = {
Darwin: {
version: 2,
perf: {
shortCut: {
showAndHidden: 'Option+R',
separate: 'Ctrl+D'
separate: 'Ctrl+D',
quit: 'Shift+Escape'
},
common: {
start: true,
@@ -39,7 +41,7 @@ global.opConfig = {
opConfig.config = JSON.parse(fs.readFileSync(configPath) || JSON.stringify(defaultConfig[platform]));
}
// 重置
if (!opConfig.config.perf || !opConfig.config.superPanel || !opConfig.config.global) {
if (!opConfig.version || opConfig.version < defaultConfig[platform].version) {
opConfig.config = defaultConfig[platform];
fs.writeFileSync(configPath, JSON.stringify(opConfig.config));
}

View File

@@ -63,6 +63,11 @@ class Listener {
mainWindow.webContents.send('new-window');
});
globalShortcut.register(config.perf.shortCut.quit, () => {
mainWindow.webContents.send('init-rubick');
mainWindow.show();
});
// 注册自定义全局快捷键
config.global.forEach(sc => {
if (!sc.key || !sc.value) return;