summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/components
diff options
context:
space:
mode:
authorAdam <[email protected]>2026-01-20 07:10:40 -0600
committerAdam <[email protected]>2026-01-20 07:33:44 -0600
commit340285575b510f4ab466fa80d0de1cf20b4e048a (patch)
tree9587a21664547875d060258ad7ee7b3de0dba290 /packages/app/src/components
parentdd5b5f5482df86959f0ea90e20f86ca7a5e19b08 (diff)
downloadopencode-340285575b510f4ab466fa80d0de1cf20b4e048a.tar.gz
opencode-340285575b510f4ab466fa80d0de1cf20b4e048a.zip
chore: cleanup
Diffstat (limited to 'packages/app/src/components')
-rw-r--r--packages/app/src/components/settings-general.tsx22
-rw-r--r--packages/app/src/components/settings-keybinds.tsx38
2 files changed, 50 insertions, 10 deletions
diff --git a/packages/app/src/components/settings-general.tsx b/packages/app/src/components/settings-general.tsx
index 15dc98bfb..10f4facef 100644
--- a/packages/app/src/components/settings-general.tsx
+++ b/packages/app/src/components/settings-general.tsx
@@ -77,7 +77,15 @@ export const SettingsGeneral: Component = () => {
current={themeOptions().find((o) => o.id === theme.themeId())}
value={(o) => o.id}
label={(o) => o.name}
- onSelect={(option) => option && theme.setTheme(option.id)}
+ onSelect={(option) => {
+ if (!option) return
+ theme.setTheme(option.id)
+ }}
+ onHighlight={(option) => {
+ if (!option) return
+ theme.previewTheme(option.id)
+ return () => theme.cancelPreview()
+ }}
variant="secondary"
size="small"
/>
@@ -135,6 +143,10 @@ export const SettingsGeneral: Component = () => {
current={soundOptions.find((o) => o.id === settings.sounds.agent())}
value={(o) => o.id}
label={(o) => o.label}
+ onHighlight={(option) => {
+ if (!option) return
+ playSound(option.src)
+ }}
onSelect={(option) => {
if (!option) return
settings.sounds.setAgent(option.id)
@@ -151,6 +163,10 @@ export const SettingsGeneral: Component = () => {
current={soundOptions.find((o) => o.id === settings.sounds.permissions())}
value={(o) => o.id}
label={(o) => o.label}
+ onHighlight={(option) => {
+ if (!option) return
+ playSound(option.src)
+ }}
onSelect={(option) => {
if (!option) return
settings.sounds.setPermissions(option.id)
@@ -167,6 +183,10 @@ export const SettingsGeneral: Component = () => {
current={soundOptions.find((o) => o.id === settings.sounds.errors())}
value={(o) => o.id}
label={(o) => o.label}
+ onHighlight={(option) => {
+ if (!option) return
+ playSound(option.src)
+ }}
onSelect={(option) => {
if (!option) return
settings.sounds.setErrors(option.id)
diff --git a/packages/app/src/components/settings-keybinds.tsx b/packages/app/src/components/settings-keybinds.tsx
index 811b34f9b..7bc9b1fd7 100644
--- a/packages/app/src/components/settings-keybinds.tsx
+++ b/packages/app/src/components/settings-keybinds.tsx
@@ -124,13 +124,23 @@ export const SettingsKeybinds: Component = () => {
const out = new Map<string, KeybindMeta>()
out.set(PALETTE_ID, { title: "Command palette", group: "General" })
+ for (const opt of command.catalog) {
+ if (opt.id.startsWith("suggested.")) continue
+ out.set(opt.id, { title: opt.title, group: groupFor(opt.id) })
+ }
+
for (const opt of command.options) {
if (opt.id.startsWith("suggested.")) continue
+ out.set(opt.id, { title: opt.title, group: groupFor(opt.id) })
+ }
- out.set(opt.id, {
- title: opt.title,
- group: groupFor(opt.id),
- })
+ const keybinds = settings.current.keybinds as Record<string, string | undefined> | undefined
+ if (keybinds) {
+ for (const [id, value] of Object.entries(keybinds)) {
+ if (typeof value !== "string") continue
+ if (out.has(id)) continue
+ out.set(id, { title: id, group: groupFor(id) })
+ }
}
return out
@@ -181,11 +191,21 @@ export const SettingsKeybinds: Component = () => {
add(sig, { id: PALETTE_ID, title: "Command palette" })
}
- for (const opt of command.options) {
- if (opt.id.startsWith("suggested.")) continue
- if (!opt.keybind) continue
- for (const sig of signatures(opt.keybind)) {
- add(sig, { id: opt.id, title: opt.title })
+ const valueFor = (id: string) => {
+ const custom = settings.keybinds.get(id)
+ if (typeof custom === "string") return custom
+
+ const live = command.options.find((x) => x.id === id)
+ if (live?.keybind) return live.keybind
+
+ const meta = command.catalog.find((x) => x.id === id)
+ return meta?.keybind
+ }
+
+ for (const id of list().keys()) {
+ if (id === PALETTE_ID) continue
+ for (const sig of signatures(valueFor(id))) {
+ add(sig, { id, title: title(id) })
}
}