Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(desktop): require macOS 27 for the native sidebar glass material (#21921)

Innei480cb5a67e56
diff --git a/apps/desktop/src/main/core/browser/WindowThemeManager.macGlass.test.ts b/apps/desktop/src/main/core/browser/WindowThemeManager.macGlass.test.ts
index b9d57bc6c72..dfaab2a6238 100644
--- a/apps/desktop/src/main/core/browser/WindowThemeManager.macGlass.test.ts
+++ b/apps/desktop/src/main/core/browser/WindowThemeManager.macGlass.test.ts
@@ -30,9 +30,17 @@ describe('macOS window glass lifecycle', () => {
let manager: WindowThemeManager;
const browserWindow = window as unknown as BrowserWindow;
+ const setSystemVersion = (version: string) => {
+ Object.defineProperty(process, 'getSystemVersion', {
+ configurable: true,
+ value: vi.fn(() => version),
+ });
+ };
+
beforeEach(() => {
vi.clearAllMocks();
vi.useFakeTimers();
+ setSystemVersion('27.2.0');
glass.isSupported.mockReturnValue(true);
glass.setWindowGlass.mockImplementation((_handle, enabled) => {
material.background = enabled ? 'sidebar' : '';
@@ -97,6 +105,14 @@ describe('macOS window glass lifecycle', () => {
expect(material.background).toBe('sidebar');
});
+ it('keeps Electron sidebar vibrancy on macOS 26', () => {
+ setSystemVersion('26.6.0');
+ manager.attach(browserWindow);
+
+ expect(glass.setWindowGlass).not.toHaveBeenCalled();
+ expect(window.setVibrancy).toHaveBeenLastCalledWith('sidebar');
+ });
+
it('keeps Electron sidebar vibrancy when native glass is unavailable', () => {
glass.isSupported.mockReturnValue(false);
manager.attach(browserWindow);
diff --git a/apps/desktop/src/main/core/browser/WindowThemeManager.ts b/apps/desktop/src/main/core/browser/WindowThemeManager.ts
index 6bd1362fc25..67e7bbe2ee7 100644
--- a/apps/desktop/src/main/core/browser/WindowThemeManager.ts
+++ b/apps/desktop/src/main/core/browser/WindowThemeManager.ts
@@ -22,6 +22,9 @@ import {
const logger = createLogger('core:WindowThemeManager');
const MACOS_VIBRANCY = 'sidebar';
+// The AppKit sidebar material exists since macOS 26, but the desktop app only
+// adopts it from macOS 27 on; macOS 26 and older keep Electron sidebar vibrancy.
+const MACOS_GLASS_MINIMUM_MAJOR_VERSION = 27;
// lobe-design-ignore LOBE-RAW-COLOR: Electron native colors cannot resolve CSS variables.
const MACOS_TRANSPARENT_BACKGROUND = '#00000000';
@@ -185,15 +188,25 @@ export class WindowThemeManager {
return this.resolveIsDarkMode() ? BACKGROUND_DARK : BACKGROUND_LIGHT;
}
+ /**
+ * macOS product-version gate for the AppKit sidebar material.
+ * Electron exposes the product version (e.g. "27.2.0") via getSystemVersion().
+ */
+ private isMacGlassOSSupported(): boolean {
+ const [major = ''] = process.getSystemVersion().split('.');
+ const majorVersion = Number.parseInt(major, 10);
+ return Number.isFinite(majorVersion) && majorVersion >= MACOS_GLASS_MINIMUM_MAJOR_VERSION;
+ }
+
/**
* Replace the window material in place; transparent renderer regions expose it.
- * Keep Electron's sidebar vibrancy as the fallback for older systems or addon failure.
+ * Keep Electron's sidebar vibrancy as the fallback below macOS 27 or addon failure.
*/
private refreshMacVibrancy(): void {
if (!this.browserWindow) return;
this.browserWindow.setVibrancy(null);
- if (isGlassSupported()) {
+ if (isGlassSupported() && this.isMacGlassOSSupported()) {
const applied = setWindowGlass(
this.browserWindow.getNativeWindowHandle(),
true,