Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions packages/app/src/components/settings-general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,44 @@ export const SettingsGeneral: Component = () => {
/>
</div>
</SettingsRow>

<SettingsRow
title="Font Size"
description="Base font size for code and messages"
>
<div data-action="settings-font-size" class="flex items-center gap-3 w-full sm:w-[220px]">
<input
type="range"
min="10"
max="24"
step="1"
value={settings.appearance.fontSize()}
onInput={(e) => settings.appearance.setFontSize(Number(e.currentTarget.value) || 14)}
class="flex-1 accent-color-accent h-1.5 cursor-pointer"
style={{ "transition": "all 200ms ease-out" }}
/>
<span class="text-12-regular text-text-weak tabular-nums w-8 text-right">{settings.appearance.fontSize()}px</span>
</div>
</SettingsRow>

<SettingsRow
title="Chat Width"
description="0 = centered layout, drag right for wider chat"
>
<div data-action="settings-max-width" class="flex items-center gap-3 w-full sm:w-[220px]">
<input
type="range"
min="0"
max="100"
step="5"
value={settings.appearance.maxWidth()}
onInput={(e) => settings.appearance.setMaxWidth(Number(e.currentTarget.value) || 0)}
class="flex-1 accent-color-accent h-1.5 cursor-pointer"
style={{ "transition": "all 200ms ease-out" }}
/>
<span class="text-12-regular text-text-weak tabular-nums w-8 text-right">{settings.appearance.maxWidth() === 0 ? "auto" : `${settings.appearance.maxWidth()}%`}</span>
</div>
</SettingsRow>
</SettingsList>
</div>
)
Expand Down
6 changes: 6 additions & 0 deletions packages/app/src/context/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface Settings {
}
appearance: {
fontSize: number
maxWidth: number
mono: string
sans: string
}
Expand Down Expand Up @@ -98,6 +99,7 @@ const defaultSettings: Settings = {
},
appearance: {
fontSize: 14,
maxWidth: 0,
mono: "",
sans: "",
},
Expand Down Expand Up @@ -187,6 +189,10 @@ export const { use: useSettings, provider: SettingsProvider } = createSimpleCont
setFontSize(value: number) {
setStore("appearance", "fontSize", value)
},
maxWidth: withFallback(() => store.appearance?.maxWidth, defaultSettings.appearance.maxWidth),
setMaxWidth(value: number) {
setStore("appearance", "maxWidth", Math.max(0, Math.min(100, value)))
},
font: withFallback(() => store.appearance?.mono, defaultSettings.appearance.mono),
setFont(value: string) {
setStore("appearance", "mono", value.trim() ? value : "")
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/pages/session.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export default function Page() {
if (desktopReviewOpen()) return `${layout.session.width()}px`
return `calc(100% - ${layout.fileTree.width()}px)`
})
const centered = createMemo(() => isDesktop() && !desktopReviewOpen())
const centered = createMemo(() => isDesktop() && !desktopReviewOpen() && settings.appearance.maxWidth() === 0)

function normalizeTab(tab: string) {
if (!tab.startsWith("file://")) return tab
Expand Down
11 changes: 11 additions & 0 deletions packages/app/src/pages/session/use-session-commands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useLocal } from "@/context/local"
import { usePermission } from "@/context/permission"
import { usePrompt } from "@/context/prompt"
import { useSDK } from "@/context/sdk"
import { useSettings } from "@/context/settings"
import { useSync } from "@/context/sync"
import { useTerminal } from "@/context/terminal"
import { showToast } from "@opencode-ai/ui/toast"
Expand Down Expand Up @@ -44,6 +45,7 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
const sync = useSync()
const terminal = useTerminal()
const layout = useLayout()
const settings = useSettings()
const navigate = useNavigate()
const { params, tabs, view } = useSessionLayout()

Expand Down Expand Up @@ -313,6 +315,15 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
keybind: "mod+\\",
onSelect: () => layout.fileTree.toggle(),
}),
viewCommand({
id: "wide.toggle",
title: "Toggle Wide Mode",
keybind: "mod+shift+w",
onSelect: () => {
const cur = settings.appearance.maxWidth()
settings.appearance.setMaxWidth(cur === 0 ? 100 : 0)
},
}),
viewCommand({
id: "input.focus",
title: language.t("command.input.focus"),
Expand Down
Loading