Skip to content

Commit 609acd4

Browse files
committed
新增:快捷面板开关和快捷键配置
1 parent 6a219df commit 609acd4

3 files changed

Lines changed: 43 additions & 6 deletions

File tree

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## v0.3.0
22

3+
- 新增:快捷面板开关和快捷键配置
34
- 新增:插件管理隐藏系统插件版本
45
- 新增:工单反馈功能,便于解决问题
56
- 新增:setting.darkModeSupport 配置项,默认为false

electron/mapi/manager/hotkey/handle.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {ManagerPluginEvent} from "../plugin/event";
22
import {ManagerConfig} from "../config/config";
3+
import ConfigMain from "../../config/main";
34

45

56
export const ManagerHotkeyHandle = {
@@ -11,6 +12,9 @@ export const ManagerHotkeyHandle = {
1112
}
1213
},
1314
async fastPanelTrigger() {
15+
if (!await ConfigMain.get('fastPanelEnable', true)) {
16+
return
17+
}
1418
if (await ManagerPluginEvent.isFastPanelWindowShown(null, null)) {
1519
await ManagerPluginEvent.hideFastPanelWindow(null, null)
1620
} else {

src/pages/System/SystemSetting.vue

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
11
<script setup lang="ts">
22
import HotkeyInput from "./components/HotkeyInput.vue";
33
import {useManagerStore} from "../../store/modules/manager";
4-
import {onMounted} from "vue";
4+
import {onMounted, ref} from "vue";
55
import {useSettingStore} from "../../store/modules/setting";
66
77
const setting = useSettingStore()
88
const manager = useManagerStore()
9-
onMounted(() => {
109
10+
const isMacOs = focusany.isMacOs()
11+
const isWindows = focusany.isWindows()
12+
const isLinux = focusany.isLinux()
13+
const fastPanelTriggerType = ref('Ctrl')
14+
15+
onMounted(() => {
16+
fastPanelTriggerType.value = manager.configGet('fastPanelTrigger', null).value?.type || 'Ctrl'
1117
})
18+
19+
const onManagerConfigChange = (key: string, value: any) => {
20+
// console.log('onManagerConfigChange', key, value)
21+
switch (key) {
22+
case 'fastPanelTriggerType':
23+
manager.onConfigChange('fastPanelTrigger', {type: value})
24+
break
25+
}
26+
}
27+
1228
</script>
1329

1430
<template>
1531
<div class="p-4">
1632
<div class="mb-8">
1733
<div class="text-base font-bold mb-4">功能设置</div>
1834
<div class="pl-4">
19-
<div class="flex mb-4">
35+
<div class="flex items-center mb-6">
2036
<div class="flex-grow">
2137
呼出快捷键
2238
</div>
@@ -25,7 +41,7 @@ onMounted(() => {
2541
@change="manager.onConfigChange('mainTrigger',$event)"/>
2642
</div>
2743
</div>
28-
<div class="flex mb-4">
44+
<div class="flex items-center mb-6">
2945
<div class="flex-grow">
3046
主题样式
3147
</div>
@@ -38,12 +54,28 @@ onMounted(() => {
3854
</a-radio-group>
3955
</div>
4056
</div>
41-
<div v-if="0" class="flex mb-4">
57+
<div class="flex items-center mb-6">
4258
<div class="flex-grow">
4359
快捷面板
4460
</div>
4561
<div>
46-
<HotkeyInput/>
62+
<a-switch :model-value="setting.configGet('fastPanelEnable',true).value"
63+
@change="setting.onConfigChange('fastPanelEnable',$event)"/>
64+
</div>
65+
</div>
66+
<div class="flex items-center mb-6"
67+
v-if="setting.configGet('fastPanelEnable',true).value">
68+
<div class="flex-grow">
69+
快捷面板呼出快捷键
70+
</div>
71+
<div>
72+
<a-select :model-value="fastPanelTriggerType"
73+
@change="onManagerConfigChange('fastPanelTriggerType',$event)">
74+
<a-option value="Ctrl">Ctrl</a-option>
75+
<a-option value="Alt" v-if="isWindows||isLinux">Alt</a-option>
76+
<a-option value="Alt" v-if="isMacOs">Option</a-option>
77+
<a-option value="Meta" v-if="isMacOs">Meta</a-option>
78+
</a-select>
4779
</div>
4880
</div>
4981
</div>

0 commit comments

Comments
 (0)