feat(app): change traffic light position, fix sequoia bug (#35081)

This commit is contained in:
Aarav Sareen 2026-07-07 10:19:28 +05:30 committed by GitHub
commit 50374abab8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 12 deletions

View file

@ -71,7 +71,10 @@ export function setAppQuitting(quitting = true) {
export function setBackgroundColor(color: string) {
backgroundColor = color
BrowserWindow.getAllWindows().forEach((win) => win.setBackgroundColor(color))
BrowserWindow.getAllWindows().forEach((win) => {
win.setBackgroundColor(color)
if (process.platform === "darwin") win.invalidateShadow()
})
}
export function getBackgroundColor(): string | undefined {
@ -106,6 +109,13 @@ function overlay(theme: Partial<TitlebarTheme> = {}, zoom = 1) {
export function setTitlebar(win: BrowserWindow, theme: Partial<TitlebarTheme> = {}) {
titlebarThemes.set(win, theme)
// macOS draws the window frame hairline and shadow using the NSWindow
// appearance, which follows nativeTheme rather than the rendered content.
// Align it with the app theme so a light app on a dark system does not get
// the dark-appearance border and shadow. A "system" scheme must map to
// "system" (not the resolved mode) or prefers-color-scheme stops tracking
// OS appearance changes in the renderer.
if (process.platform === "darwin") nativeTheme.themeSource = theme.scheme ?? theme.mode ?? "system"
updateTitlebar(win)
}
@ -172,7 +182,7 @@ export function createMainWindow(id: string = randomUUID()) {
...(process.platform === "darwin"
? {
titleBarStyle: "hidden" as const,
trafficLightPosition: { x: 12, y: 14 },
trafficLightPosition: { x: 14, y: 14 },
}
: {}),
...(process.platform === "win32"

View file

@ -31,6 +31,7 @@ export type UpdaterAPI = {
export type LinuxDisplayBackend = "wayland" | "auto"
export type TitlebarTheme = {
mode: "light" | "dark"
scheme?: "system" | "light" | "dark"
}
export type FatalRendererError = {
error: string