mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-04 21:32:39 +02:00
Wire General Assist and screen capture through Electron IPC
This commit is contained in:
parent
7097f542fb
commit
b0810b4d47
7 changed files with 40 additions and 49 deletions
|
|
@ -1,13 +1,11 @@
|
|||
export interface ShortcutConfig {
|
||||
generalAssist: string;
|
||||
quickAsk: string;
|
||||
autocomplete: string;
|
||||
}
|
||||
|
||||
const DEFAULTS: ShortcutConfig = {
|
||||
generalAssist: 'CommandOrControl+Shift+S',
|
||||
quickAsk: 'CommandOrControl+Alt+S',
|
||||
autocomplete: 'CommandOrControl+Shift+Space',
|
||||
generalAssist: 'Alt+Shift+G',
|
||||
quickAsk: 'Alt+Shift+Q',
|
||||
};
|
||||
|
||||
const STORE_KEY = 'shortcuts';
|
||||
|
|
@ -27,14 +25,16 @@ async function getStore() {
|
|||
|
||||
export async function getShortcuts(): Promise<ShortcutConfig> {
|
||||
const s = await getStore();
|
||||
const stored = s.get(STORE_KEY) as Partial<ShortcutConfig> | undefined;
|
||||
return { ...DEFAULTS, ...stored };
|
||||
const raw = (s.get(STORE_KEY) as Record<string, string> | undefined) ?? {};
|
||||
const { autocomplete: _drop, ...rest } = raw;
|
||||
return { ...DEFAULTS, ...rest };
|
||||
}
|
||||
|
||||
export async function setShortcuts(config: Partial<ShortcutConfig>): Promise<ShortcutConfig> {
|
||||
const s = await getStore();
|
||||
const current = (s.get(STORE_KEY) as ShortcutConfig) ?? DEFAULTS;
|
||||
const merged = { ...current, ...config };
|
||||
const raw = (s.get(STORE_KEY) as Record<string, string> | undefined) ?? {};
|
||||
const { autocomplete: _drop, ...current } = raw;
|
||||
const merged = { ...DEFAULTS, ...current, ...config };
|
||||
s.set(STORE_KEY, merged);
|
||||
return merged;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue