快速面板模块

This commit is contained in:
zhongluofeng
2026-08-04 13:37:42 +08:00
parent 5656193b5c
commit 126f8896b6
23 changed files with 4048 additions and 52 deletions
+45
View File
@@ -0,0 +1,45 @@
import type { ModuleConfig } from '@/types/module'
import type { SearchIndexItem } from '@/stores/searchIndex'
const searchItems: SearchIndexItem[] = [
{
title: '快速面板',
description: '全局快捷键唤起命令面板',
keywords: ['快速面板', '快速启动', '搜索', '命令', 'quickpanel', 'launcher', 'spotlight']
}
]
export const moduleConfig: ModuleConfig = {
id: 'quickpanel',
name: '快速面板',
icon: 'quickpanel',
description: '全局快捷键唤起的多源命令面板(命令/应用/文件/计算)',
category: 'tool',
defaultEnabled: true,
loader: () => import('./QuickPanelModule.vue'),
searchItems,
lifecycle: {
// 模块启用:读取设置并注册全局快捷键
onEnable: async () => {
const { invoke } = await import('@tauri-apps/api/core')
try {
const settings = await invoke<{ shortcut: string }>('quickpanel_get_settings')
if (settings.shortcut) {
await invoke('quickpanel_register_shortcut', { shortcut: settings.shortcut })
}
} catch (e) {
console.error('[quickpanel] onEnable 注册快捷键失败:', e)
}
},
// 模块禁用:注销全局快捷键
onDisable: async () => {
const { invoke } = await import('@tauri-apps/api/core')
try {
await invoke('quickpanel_unregister_shortcut')
} catch (e) {
console.error('[quickpanel] onDisable 注销快捷键失败:', e)
}
}
},
order: 60
}