summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src
diff options
context:
space:
mode:
authorIsrael Araújo de Oliveira <[email protected]>2026-02-09 06:00:35 -0300
committerGitHub <[email protected]>2026-02-09 17:00:35 +0800
commit93a11ddedf697c9b673dd59628cee3db48ac67d0 (patch)
treeeaa37846d594604d49afb0333662df453103e88f /packages/app/src
parent94feb811ca32f4e01a1bada9cfbc022e8d5ca9e3 (diff)
downloadopencode-93a11ddedf697c9b673dd59628cee3db48ac67d0.tar.gz
opencode-93a11ddedf697c9b673dd59628cee3db48ac67d0.zip
feat(desktop): add native Wayland toggle on Linux (#11971)
Co-authored-by: Brendan Allan <[email protected]>
Diffstat (limited to 'packages/app/src')
-rw-r--r--packages/app/src/components/settings-general.tsx44
-rw-r--r--packages/app/src/context/platform.tsx8
-rw-r--r--packages/app/src/i18n/en.ts6
-rw-r--r--packages/app/src/index.ts2
4 files changed, 57 insertions, 3 deletions
diff --git a/packages/app/src/components/settings-general.tsx b/packages/app/src/components/settings-general.tsx
index b31cfb6cc..db057a4c4 100644
--- a/packages/app/src/components/settings-general.tsx
+++ b/packages/app/src/components/settings-general.tsx
@@ -1,8 +1,10 @@
-import { Component, createMemo, type JSX } from "solid-js"
+import { Component, Show, createEffect, createMemo, createResource, type JSX } from "solid-js"
import { createStore } from "solid-js/store"
import { Button } from "@opencode-ai/ui/button"
+import { Icon } from "@opencode-ai/ui/icon"
import { Select } from "@opencode-ai/ui/select"
import { Switch } from "@opencode-ai/ui/switch"
+import { Tooltip } from "@opencode-ai/ui/tooltip"
import { useTheme, type ColorScheme } from "@opencode-ai/ui/theme"
import { showToast } from "@opencode-ai/ui/toast"
import { useLanguage } from "@/context/language"
@@ -40,6 +42,8 @@ export const SettingsGeneral: Component = () => {
checking: false,
})
+ const linux = createMemo(() => platform.platform === "desktop" && platform.os === "linux")
+
const check = () => {
if (!platform.checkUpdate) return
setStore("checking", true)
@@ -410,13 +414,49 @@ export const SettingsGeneral: Component = () => {
</SettingsRow>
</div>
</div>
+
+ <Show when={linux()}>
+ {(_) => {
+ const [valueResource, actions] = createResource(() => platform.getDisplayBackend?.())
+ const value = () => (valueResource.state === "pending" ? undefined : valueResource.latest)
+
+ const onChange = (checked: boolean) =>
+ platform.setDisplayBackend?.(checked ? "wayland" : "auto").finally(() => actions.refetch())
+
+ return (
+ <div class="flex flex-col gap-1">
+ <h3 class="text-14-medium text-text-strong pb-2">{language.t("settings.general.section.display")}</h3>
+
+ <div class="bg-surface-raised-base px-4 rounded-lg">
+ <SettingsRow
+ title={
+ <div class="flex items-center gap-2">
+ <span>{language.t("settings.general.row.wayland.title")}</span>
+ <Tooltip value={language.t("settings.general.row.wayland.tooltip")} placement="top">
+ <span class="text-text-weak">
+ <Icon name="help" size="small" />
+ </span>
+ </Tooltip>
+ </div>
+ }
+ description={language.t("settings.general.row.wayland.description")}
+ >
+ <div data-action="settings-wayland">
+ <Switch checked={value() === "wayland"} onChange={onChange} />
+ </div>
+ </SettingsRow>
+ </div>
+ </div>
+ )
+ }}
+ </Show>
</div>
</div>
)
}
interface SettingsRowProps {
- title: string
+ title: string | JSX.Element
description: string | JSX.Element
children: JSX.Element
}
diff --git a/packages/app/src/context/platform.tsx b/packages/app/src/context/platform.tsx
index 3fca502ba..7aa6c6554 100644
--- a/packages/app/src/context/platform.tsx
+++ b/packages/app/src/context/platform.tsx
@@ -57,6 +57,12 @@ export type Platform = {
/** Set the default server URL to use on app startup (platform-specific) */
setDefaultServerUrl?(url: string | null): Promise<void> | void
+ /** Get the preferred display backend (desktop only) */
+ getDisplayBackend?(): Promise<DisplayBackend | null> | DisplayBackend | null
+
+ /** Set the preferred display backend (desktop only) */
+ setDisplayBackend?(backend: DisplayBackend): Promise<void>
+
/** Parse markdown to HTML using native parser (desktop only, returns unprocessed code blocks) */
parseMarkdown?(markdown: string): Promise<string>
@@ -70,6 +76,8 @@ export type Platform = {
readClipboardImage?(): Promise<File | null>
}
+export type DisplayBackend = "auto" | "wayland"
+
export const { use: usePlatform, provider: PlatformProvider } = createSimpleContext({
name: "Platform",
init: (props: { value: Platform }) => {
diff --git a/packages/app/src/i18n/en.ts b/packages/app/src/i18n/en.ts
index 8fba6861b..f4f49f055 100644
--- a/packages/app/src/i18n/en.ts
+++ b/packages/app/src/i18n/en.ts
@@ -588,6 +588,7 @@ export const dict = {
"settings.general.section.notifications": "System notifications",
"settings.general.section.updates": "Updates",
"settings.general.section.sounds": "Sound effects",
+ "settings.general.section.display": "Display",
"settings.general.row.language.title": "Language",
"settings.general.row.language.description": "Change the display language for OpenCode",
@@ -598,6 +599,11 @@ export const dict = {
"settings.general.row.font.title": "Font",
"settings.general.row.font.description": "Customise the mono font used in code blocks",
+ "settings.general.row.wayland.title": "Use native Wayland",
+ "settings.general.row.wayland.description": "Disable X11 fallback on Wayland. Requires restart.",
+ "settings.general.row.wayland.tooltip":
+ "On Linux with mixed refresh-rate monitors, native Wayland can be more stable.",
+
"settings.general.row.releaseNotes.title": "Release notes",
"settings.general.row.releaseNotes.description": "Show What's New popups after updates",
diff --git a/packages/app/src/index.ts b/packages/app/src/index.ts
index fb6682009..59e1431fa 100644
--- a/packages/app/src/index.ts
+++ b/packages/app/src/index.ts
@@ -1,3 +1,3 @@
-export { PlatformProvider, type Platform } from "./context/platform"
+export { PlatformProvider, type Platform, type DisplayBackend } from "./context/platform"
export { AppBaseProviders, AppInterface } from "./app"
export { useCommand } from "./context/command"