mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-18 00:46:45 +00:00
#7097 force-disabled the custom title bar on all GNOME and hid the toggle, even though only GNOME+Wayland actually fails to render the Window-Controls-Overlay. This stranded GNOME-X11 users (where the feature worked) with no way to re-enable it. - Narrow the kill-switch from IS_GNOME_DESKTOP to a new IS_GNOME_WAYLAND (XDG_SESSION_TYPE/WAYLAND_DISPLAY, mirroring idle-time-handler). GNOME on X11 keeps the feature and the settings toggle. - Unify GNOME detection: preload imports it from common.const instead of re-implementing, so main and renderer can't drift. - Align global-theme.service with main-window: force native decorations on GNOME+Wayland in both, so a persisted/synced `true` no longer lays the custom header over native controls (doubled header). - Add unit tests for the detection matrix.
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
export const isGnomeDesktopEnv = (
|
|
platform: NodeJS.Platform,
|
|
env: NodeJS.ProcessEnv,
|
|
): boolean =>
|
|
platform === 'linux' &&
|
|
[
|
|
env.XDG_CURRENT_DESKTOP,
|
|
env.XDG_SESSION_DESKTOP,
|
|
env.DESKTOP_SESSION,
|
|
env.GNOME_SHELL_SESSION_MODE,
|
|
]
|
|
.filter((v): v is string => !!v)
|
|
.map((v) => v.toLowerCase())
|
|
.some((v) => v.includes('gnome') || v.includes('ubuntu'));
|
|
|
|
// Some sessions only set WAYLAND_DISPLAY and leave XDG_SESSION_TYPE unset, so
|
|
// check both.
|
|
export const isWaylandEnv = (
|
|
platform: NodeJS.Platform,
|
|
env: NodeJS.ProcessEnv,
|
|
): boolean =>
|
|
platform === 'linux' && (env.XDG_SESSION_TYPE === 'wayland' || !!env.WAYLAND_DISPLAY);
|
|
|
|
// Only GNOME on Wayland reliably fails to render the Window-Controls-Overlay
|
|
// when titleBarStyle is 'hidden', stranding the window with no min/max/close
|
|
// controls. The custom-title-bar kill-switch is narrowed to this combination
|
|
// so GNOME-on-X11 (where the feature works) keeps it.
|
|
export const isGnomeWaylandEnv = (
|
|
platform: NodeJS.Platform,
|
|
env: NodeJS.ProcessEnv,
|
|
): boolean => isGnomeDesktopEnv(platform, env) && isWaylandEnv(platform, env);
|
|
|
|
export const IS_MAC = process.platform === 'darwin';
|
|
export const IS_GNOME_DESKTOP = isGnomeDesktopEnv(process.platform, process.env);
|
|
export const IS_GNOME_WAYLAND = isGnomeWaylandEnv(process.platform, process.env);
|