Skip to content

linux: respect GNOME window button layouts in the Snap - #350994

Open
Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
mainfrom
agents/linux-issues-verification-loop
Open

Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
mainfrom
agents/linux-issues-verification-loop

Conversation

@dmitrivMS

Copy link
Copy Markdown
Collaborator

Fixes #176467

The Linux Snap kept all three window buttons on the right even when GNOME was configured to hide them or move them to the left. The .deb already followed those settings on the same Electron version (package comparison).

This makes native controls the default for recognized GNOME Shell Wayland sessions in the Snap. Other Wayland desktops keep their existing default, including Phosh, which also advertises GNOME for compatibility. Explicit window.controlsStyle choices still take precedence.

The classic launcher also needs to run its two GLib helpers with the core24 loader and libraries: on Ubuntu 22.10 the schema compiler otherwise picked up the older host GLib and failed, and the GIO cache omitted the dconf backend. The launcher prefers the host’s compiled settings schemas so resetting the layout restores the distribution default; the Snap’s schemas remain available as a fallback. No Electron or GLib upgrade is required.

Screenshots

Published Insiders Snap 2654 versus the first local fix, with four explicitly configured layouts:

Published Snap keeps all controls on the right; the local build follows close-only, left, right, and split GNOME layouts.

The final fix also restores Ubuntu’s three native controls after a reset and preserves the three custom controls on Phoc with the Phosh:GNOME session identifier:

A previous build showed only Close after reset. The final build shows all three native buttons on fresh and reset Ubuntu profiles, and keeps custom buttons on Phoc.

How to verify

  1. In a GNOME Wayland test session, run a Snap containing this change. Use a fresh VS Code profile with window.titleBarStyle set to custom and window.controlsStyle unset. Open a GTK reference window. Both should start with the distribution’s button layout.
  2. With both windows open, run gsettings set org.gnome.desktop.wm.preferences button-layout ':close', then gsettings set org.gnome.desktop.wm.preferences button-layout 'close:minimize,maximize'. Both should first show only Close on the right, then Close on the left and the other two buttons on the right, without restarting.
  3. Run gsettings reset org.gnome.desktop.wm.preferences button-layout. Both should return to the distribution default (Minimize, Maximize, Close on Ubuntu).
  4. On Sway or in a Phosh:GNOME session, leave window.controlsStyle unset and confirm that the Snap still draws its three custom buttons.

Validation

  • Ubuntu 22.10 amd64, Electron 43.8.13: seven real Wayland window scenarios passed on Mutter, Phoc (with the packaged Phosh session ID), and Sway. Fresh and reset Ubuntu layouts matched host GTK with XDG_DATA_DIRS both set and unset. Six launcher checks passed for user, system, and fallback schema lookup.
  • pnpm run compile-client — passed.
  • env -u WAYLAND_DISPLAY XDG_SESSION_TYPE=x11 xvfb-run -a ./scripts/test.sh --no-sandbox --run src/vs/platform/window/test/common/window.test.ts --reporter spec — 14 passed.
  • pnpm run oxlint src/vs/platform/window/common/window.ts src/vs/platform/window/test/common/window.test.ts src/vs/workbench/electron-browser/desktop.contribution.ts and bash -n resources/linux/snap/electron-launch — passed.

Run the GLib helpers with the classic Snap's core24 runtime and prefer host schemas so resetting the layout preserves distribution defaults. Use native controls on GNOME Shell Wayland without changing the fallback for other desktops that advertise GNOME compatibility.

Fixes #176467

Co-authored-by: Copilot <[email protected]>
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added linux Issues with VS Code on Linux titlebar VS Code main title bar issues snap Issues related to the snap package labels Nov 29, 2026
Copilot AI balanced review requested due to automatic review settings November 29, 2026 06:37
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added the snap Issues related to the snap package label Nov 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 6d819674 Current: 139139ba

Changed (1)

sessions/artifactIntegrations/PullRequestCommentsInformation/Light
Before After
before after

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the desktop-aware Snap Wayland window-controls changes.

No open issues 🎉

What changed in this PR

This PR addresses #176467 by making the Linux Snap follow GNOME window-button layouts in recognized GNOME Shell Wayland sessions, while preserving explicit user choices and existing defaults on other desktops.

Changes:

  • Centralizes Snap Wayland controls defaults, selecting native controls for recognized GNOME sessions and retaining custom controls for Phosh and other desktops.
  • Updates the launcher to prefer host settings schemas and run GLib helpers with the core24 loader and libraries.
  • Expands tests for desktop-specific defaults and explicit window-control choices.
File Description
src/​vs/​workbench/​electron-browser/​desktop.contribution.ts Uses the shared helper for the registered controls default.
src/​vs/​platform/​window/​test/​common/​window.test.ts Covers GNOME, Phosh, other desktops, and explicit overrides.
src/​vs/​platform/​window/​common/​window.ts Centralizes desktop-aware Snap Wayland controls selection.
resources/​linux/​snap/​electron-launch Prefers host schemas and isolates GLib helpers from host libraries.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linux Issues with VS Code on Linux snap Issues related to the snap package titlebar VS Code main title bar issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow VS-code to respect native titlebar decorations configuration on GNOME/Linux

2 participants