MCPcopy
hub / github.com/shiyi-0x7f/o-lib / ShortcutSection

Function ShortcutSection

src/pages/SettingsPage/ShortcutSection.tsx:11–40  ·  view source on GitHub ↗
({ config, update, loadConfig }: ShortcutSectionProps)

Source from the content-addressed store, hash-verified

9}
10
11export default function ShortcutSection({ config, update, loadConfig }: ShortcutSectionProps) {
12 return (
13 <div className="card settings-grid-full">
14 <div className="settings-group">
15 <div className="settings-group-title">快捷键</div>
16
17 <div className="settings-item">
18 <div className="settings-item-info">
19 <div className="settings-item-title">打开快速搜索</div>
20 <div className="settings-item-desc">全局快捷键,在任何位置按下可打开搜索面板</div>
21 </div>
22 <ShortcutRecorder
23 value={config.shortcut_search || "CommandOrControl+Space"}
24 defaultValue="CommandOrControl+Space"
25 onRecord={async (shortcut) => {
26 try {
27 await invoke("update_global_shortcut", { shortcut });
28 update("shortcut_search", shortcut);
29 } catch (err) {
30 console.error("Failed to update shortcut:", err);
31 // Revert UI on failure
32 loadConfig();
33 }
34 }}
35 />
36 </div>
37 </div>
38 </div>
39 );
40}

Callers

nothing calls this directly

Calls 2

updateFunction · 0.85
loadConfigFunction · 0.85

Tested by

no test coverage detected