feat: add terminal and simple shortcut system (#16)

This commit is contained in:
Dominic Elm
2024-07-29 14:37:23 +02:00
committed by GitHub
parent d35f64eb1d
commit 8486d85f64
24 changed files with 696 additions and 111 deletions

View File

@@ -0,0 +1,39 @@
import { map } from 'nanostores';
import { workbenchStore } from './workbench';
export interface Shortcut {
key: string;
ctrlKey?: boolean;
shiftKey?: boolean;
altKey?: boolean;
metaKey?: boolean;
ctrlOrMetaKey?: boolean;
action: () => void;
}
export interface Shortcuts {
toggleTerminal: Shortcut;
}
export interface Settings {
shortcuts: Shortcuts;
}
export const shortcutsStore = map<Shortcuts>({
toggleTerminal: {
key: 'j',
ctrlOrMetaKey: true,
action: () => workbenchStore.toggleTerminal(),
},
});
export const settingsStore = map<Settings>({
shortcuts: shortcutsStore.get(),
});
shortcutsStore.subscribe((shortcuts) => {
settingsStore.set({
...settingsStore.get(),
shortcuts,
});
});