[FEATURE]: Desktop v2 — custom titlebar with native window controls on Linux
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- electron, linux, typescript
- Ambito
- desktop-dev
Direzione di ricerca
Start in the desktop main process where the window factory branches only on darwin/win32: add the Linux branch and check the overlay factory's max(44, 44 * zoom) height against the 36 px header. Relax the win32 guard on the setTitleBarOverlay updater so theme switches reach Linux, then align the five renderer conditions (hideVerticalTitlebar, actionInSidebarHeader, the titlebar toggle, the vertical-tabs header, useCollapsedSlot) with the Windows path. PR #52338 already holds this change, so rebasing it is the fastest route; done means WCO visible at 36 px, legible buttons in both themes, and no duplicate collapsed toggle.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
- I have checked that this feature has not been requested before (see "Related" below — the only prior request, #36225, was closed as not planned for v1 with a note to open a v2 request)
Description
On Linux the desktop app still gets a native GTK titlebar, stacked on top of its own top bar: two headers, and the app menu / sidebar toggle sit in the second one. Windows and macOS have a single custom top bar with the window controls drawn at its right edge (macOS keeps its traffic lights at the left). Linux should look the same.
Environment: OpenCode desktop v2 2.3.2 (Fedora RPM opencode-2.3.2-1.x86_64), Electron 44.9.1 / Chromium 152, Fedora 44, GNOME on Wayland, org.gnome.desktop.interface color-scheme = prefer-dark.
Electron supports this on Linux: titleBarStyle: "hidden" together with titleBarOverlay enables the Window Controls Overlay (WCO), and Chromium draws real minimize / maximize / close buttons itself — no custom button component needed. That is the same mechanism the Windows build already uses.
Related
- #36225 — Desktop: use custom titlebar instead of native GNOME/GTK titlebar on Linux. Closed as not planned for v1; the closing note said v2 still uses the native frame and a separate v2 request should be opened, hence this issue.
- #52338 — PR doing essentially the change below for v2 (Linux WCO,
frame.tsrefactor, tests, screenshots for left/right/split controls and vertical tabs). Auto-closed by the stale/cleanup bot; the author asked for it to be reopened. - #37620 — earlier attempt, closed unmerged.
If #52338 can be reopened, it is probably the better vehicle; this issue is meant to record the v2 request and the exact behaviour expected.
What the 2.3.2 build actually does
Putting the shipped app.asar next to Electron's docs:
-
Window options (main process): the factory only branches on
darwin(titleBarStyle: "hidden",trafficLightPosition) andwin32(frame: false,titleBarStyle: "hidden",titleBarOverlay). Linux matches neither, so it gets Electron's defaultframe: true. -
Overlay colours on theme change: the renderer calls
WindowSetTitlebar({ mode, scheme })whenever a theme is applied; the desktop chunk stores it and calls a helper that is guarded byprocess.platform === "win32". On Linux the overlay keeps its window-creation colours, so as soon as the app theme differs from the system theme the buttons are dark-on-dark or light-on-light. -
Renderer, non-Windows branches that exist because Linux had a native titlebar:
hideVerticalTitlebar— with vertical tabs the app top bar is hidden on every non-Windows platform.actionInSidebarHeader— on non-Windows the first action ("home" / "new session") moves into the sidebar header.- the titlebar sidebar toggle — shown only on Windows.
- the vertical-tabs sidebar header — shown on non-Windows.
useCollapsedSlot— the floating collapsed-sidebar toggle is excluded only on Windows, because elsewhere the header had no toggle of its own.
Remove the native frame without touching these and the result is worse than today: no native titlebar and no app menu (the top bar is hidden under vertical tabs).
Proposed change
- Main, window options: add a Linux branch —
frame: false,titleBarStyle: "hidden",titleBarOverlay: { ... }. Keep macOS and Windows as they are. - Overlay height: the overlay factory returns
max(44, round(44 * zoom)), sized for the Windows header (which includes a content inset). The Linux header row is 36 px, so the height should follow the platform (or the header height constant) rather than reuse 44. - Overlay colours: relax the
win32guard on thesetTitleBarOverlayupdater to "every platform with an overlay" (i.e. not macOS), so theme switches updatesymbolColor/coloron Linux too. - Renderer: treat Linux like Windows, not like macOS, in the five places above — keep the app top bar under vertical tabs, put the sidebar toggle in the top bar next to the menu button, drop the duplicate sidebar header and the floating collapsed toggle. This is what the Windows layout already is.
- GTK button layout: if feasible, respect
org.gnome.desktop.wm.preferences button-layout(buttons on the left is a common setting). Not a blocker — WCO drawn on the right matches the current Windows layout and is what my local test does. - Escape hatch: Wayland resize-by-edge behaviour with
frame: falsediffers slightly from a native frame. An env/setting gate (e.g. keep native decorations if set) would let users opt out while this settles.
Verified locally
I applied the change above as equal-length byte patches to the 2.3.2 app.asar (no source build) and measured it through the main-process inspector and renderer CDP:
BrowserWindow.getBounds()andgetContentBounds()are identical, before and after maximize/restore → no native frame remains.navigator.windowControlsOverlay.visible === true;getTitlebarAreaRect()is 1167×36 in a 1280 px window — 113 px at the top right reserved for the system buttons, matching the 36 px header row.- Top bar
[data-slot=titlebar-v2]is visible at 36 px, menu button at (12, 8), sidebar toggle at (50, 8), app menu opens normally. - Collapsing the sidebar sets
[data-slot=vertical-tabs-sidebar]width to 0 and leaves zero[data-slot=collapsed-sidebar-toggle]elements; flipping the condition back to the original makes the floating toggle reappear at (18, 54), which confirms the duplicate. - Theme switch:
setTitleBarOverlayis called withsymbolColor: "black"for the light theme and"white"for the dark one, height 36 in both. Visually the buttons stay legible in both themes. maximize()/unmaximize()/minimize()/restore()/close()all work; the WCO buttons call the sameBrowserWindowmethods.
Caveats: screenshots were not possible on this machine (no screencopy under this GNOME/Wayland session), so "the buttons are drawn" is confirmed only through the WCO API and the reserved rect — #52338's screenshots cover the visual side. Only one configuration was tested (Fedora 44 / GNOME / Wayland / Electron 44.9.1, vertical tabs), and the WCO reserve means a horizontal-tabs layout with third-party titlebar plugin items can have its rightmost item covered.
I am happy to help turn this into a source-level PR (or to review / rebase #52338) if that is useful.
- Lingua principale
- TypeScript
- Stelle
- 227k
- Fork
- 30.7k
- Merge medio
- 3h 57m
- PR unite (30g)
- 484
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di anomalyco/opencode
-
[Site] Active section detection should respect scroll-margin-topForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea/web reproduced type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
anomalyco/opencode#65384 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area/cli type/feature version/v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
anomalyco/opencode#65379 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Shell tool: no upper bound on the timeout a model can ask for, so one call can hold a turn for hoursApertaarea/core platform/linux type/feature version/v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anomalyco/opencode#65254 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
inference/go type/feature
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
anomalyco/opencode#65148 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area/providers type/feature version/v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
anomalyco/opencode#64845 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di anomalyco/opencode
Issue simili
-
[Provider] antigravity-acp catalog omits gemini-4-hydrogen and gemini-4-neon that agy acp offersForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertacatalog provider provider-compatibility
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
lidge-jun/opencodex#9037 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
slavakurilyak/awesome-ai-agents#1005 ·
-
kind/bug triage/unresolved
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
I maintainer di solito rispondono entro 1 giorno
-
effort:S P3 refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nightscout/nocturne#3735 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
wpilibsuite/systemcore-blocks-interface#641 ·
I maintainer di solito rispondono entro 2 giorni