diff options
Diffstat (limited to 'packages/app/src/components')
| -rw-r--r-- | packages/app/src/components/settings-general.tsx | 63 | ||||
| -rw-r--r-- | packages/app/src/components/terminal.tsx | 12 |
2 files changed, 74 insertions, 1 deletions
diff --git a/packages/app/src/components/settings-general.tsx b/packages/app/src/components/settings-general.tsx index e9965b0fa..52672d01f 100644 --- a/packages/app/src/components/settings-general.tsx +++ b/packages/app/src/components/settings-general.tsx @@ -3,6 +3,7 @@ import { Select } from "@opencode-ai/ui/select" import { Switch } from "@opencode-ai/ui/switch" import { useTheme, type ColorScheme } from "@opencode-ai/ui/theme" import { useSettings } from "@/context/settings" +import { playSound, SOUND_OPTIONS } from "@/utils/sound" export const SettingsGeneral: Component = () => { const theme = useTheme() @@ -20,11 +21,20 @@ export const SettingsGeneral: Component = () => { const fontOptions = [ { value: "ibm-plex-mono", label: "IBM Plex Mono" }, + { value: "cascadia-code", label: "Cascadia Code" }, { value: "fira-code", label: "Fira Code" }, + { value: "hack", label: "Hack" }, + { value: "inconsolata", label: "Inconsolata" }, + { value: "intel-one-mono", label: "Intel One Mono" }, { value: "jetbrains-mono", label: "JetBrains Mono" }, + { value: "meslo-lgs", label: "Meslo LGS" }, + { value: "roboto-mono", label: "Roboto Mono" }, { value: "source-code-pro", label: "Source Code Pro" }, + { value: "ubuntu-mono", label: "Ubuntu Mono" }, ] + const soundOptions = [...SOUND_OPTIONS] + return ( <div class="flex flex-col h-full overflow-y-auto no-scrollbar"> <div class="flex flex-col gap-8 p-8 max-w-[720px]"> @@ -110,6 +120,59 @@ export const SettingsGeneral: Component = () => { /> </SettingsRow> </div> + + {/* Sound effects Section */} + <div class="flex flex-col gap-1"> + <h3 class="text-14-medium text-text-strong pb-2">Sound effects</h3> + + <SettingsRow title="Agent" description="Play sound when the agent is complete or needs attention"> + <Select + options={soundOptions} + current={soundOptions.find((o) => o.id === settings.sounds.agent())} + value={(o) => o.id} + label={(o) => o.label} + onSelect={(option) => { + if (!option) return + settings.sounds.setAgent(option.id) + playSound(option.src) + }} + variant="secondary" + size="small" + /> + </SettingsRow> + + <SettingsRow title="Permissions" description="Play sound when a permission is required"> + <Select + options={soundOptions} + current={soundOptions.find((o) => o.id === settings.sounds.permissions())} + value={(o) => o.id} + label={(o) => o.label} + onSelect={(option) => { + if (!option) return + settings.sounds.setPermissions(option.id) + playSound(option.src) + }} + variant="secondary" + size="small" + /> + </SettingsRow> + + <SettingsRow title="Errors" description="Play sound when an error occurs"> + <Select + options={soundOptions} + current={soundOptions.find((o) => o.id === settings.sounds.errors())} + value={(o) => o.id} + label={(o) => o.label} + onSelect={(option) => { + if (!option) return + settings.sounds.setErrors(option.id) + playSound(option.src) + }} + variant="secondary" + size="small" + /> + </SettingsRow> + </div> </div> </div> ) diff --git a/packages/app/src/components/terminal.tsx b/packages/app/src/components/terminal.tsx index 8001e2caa..f19366b8a 100644 --- a/packages/app/src/components/terminal.tsx +++ b/packages/app/src/components/terminal.tsx @@ -1,6 +1,7 @@ import type { Ghostty, Terminal as Term, FitAddon } from "ghostty-web" import { ComponentProps, createEffect, createSignal, onCleanup, onMount, splitProps } from "solid-js" import { useSDK } from "@/context/sdk" +import { monoFontFamily, useSettings } from "@/context/settings" import { SerializeAddon } from "@/addons/serialize" import { LocalPTY } from "@/context/terminal" import { resolveThemeVariant, useTheme, withAlpha, type HexColor } from "@opencode-ai/ui/theme" @@ -36,6 +37,7 @@ const DEFAULT_TERMINAL_COLORS: Record<"light" | "dark", TerminalColors> = { export const Terminal = (props: TerminalProps) => { const sdk = useSDK() + const settings = useSettings() const theme = useTheme() let container!: HTMLDivElement const [local, others] = splitProps(props, ["pty", "class", "classList", "onConnectError"]) @@ -82,6 +84,14 @@ export const Terminal = (props: TerminalProps) => { setOption("theme", colors) }) + createEffect(() => { + const font = monoFontFamily(settings.appearance.font()) + if (!term) return + const setOption = (term as unknown as { setOption?: (key: string, value: string) => void }).setOption + if (!setOption) return + setOption("fontFamily", font) + }) + const focusTerminal = () => { const t = term if (!t) return @@ -112,7 +122,7 @@ export const Terminal = (props: TerminalProps) => { cursorBlink: true, cursorStyle: "bar", fontSize: 14, - fontFamily: "IBM Plex Mono, monospace", + fontFamily: monoFontFamily(settings.appearance.font()), allowTransparency: true, theme: terminalColors(), scrollback: 10_000, |
