Stage 1: make this branch Windows 7 only
The dual-skin arrangement existed to let one build toggle between the modern
shadcn look and 7.css. Keeping both correct is what forced the cascade tricks
that fight 7.css, so the branch drops the toggle: this build IS the Windows 7
build.
- `skin` is gone from AppSettings/DEFAULT_SETTINGS, the settings store, the
SettingsService (signal, applySkin, persist payload), the options popover
control, and the i18n keys.
- buildPreload adds `.win7` unconditionally; `chromeOptions()` no longer takes a
skin and always returns frameless `titleBarStyle: "hidden"`.
- `IS_WIN7_CHROME` and `IS_MAC_CHROME` are deleted along with every
`isMacChrome` branch in the tab bar, editor window and connection manager.
Those reserved `pl-24` for macOS traffic lights, which frameless chrome
removes on every platform, so the branches were dead by construction.
- The title bar is no longer conditional — it is the window's only chrome.
- index.html keeps just the win7 anti-flash arm (four theme states).
Not done here, deliberately: stripping Tailwind's element styling. The
neutralizers in styles.css (notably `.win7 button { min-width: 0 }`) are still
load-bearing until each component's markup is converted to 7.css's real
contract, so they come out per component rather than in one sweep.
Verified: backend `tsc --noEmit` clean, `bun run build:ui` clean; bundle
490.50 kB, down from 492.52 kB.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+16
-28
@@ -1,7 +1,6 @@
|
||||
import { BrowserWindow } from "electrobun/bun";
|
||||
import type { AppSettings } from "../shared/types";
|
||||
|
||||
const isMac = process.platform === "darwin";
|
||||
|
||||
/**
|
||||
* The preload globals every window gets. Single composition point: the UI
|
||||
@@ -21,15 +20,13 @@ export function buildPreload(
|
||||
): string {
|
||||
let script =
|
||||
`window.__APP_PLATFORM=${JSON.stringify(process.platform)};` +
|
||||
`window.__APP_MODE=${JSON.stringify(mode)};` +
|
||||
`window.__APP_SKIN=${JSON.stringify(settings.skin)};`;
|
||||
`window.__APP_MODE=${JSON.stringify(mode)};`;
|
||||
if (ctx !== undefined) script += `window.__APP_CTX=${JSON.stringify(ctx)};`;
|
||||
|
||||
// A class, not a data-* attribute: 7.scoped.css is precompiled to require a
|
||||
// literal `.win7` ancestor (mirrors SettingsService.applySkin).
|
||||
if (settings.skin === "win7") {
|
||||
script += `document.documentElement.classList.add("win7");`;
|
||||
}
|
||||
// literal `.win7` ancestor. Unconditional on this branch — the skin is not a
|
||||
// setting any more, this build IS the Windows 7 build.
|
||||
script += `document.documentElement.classList.add("win7");`;
|
||||
|
||||
const dataset: Record<string, string> = {};
|
||||
if (settings.theme !== "system") dataset["theme"] = settings.theme;
|
||||
@@ -43,27 +40,18 @@ export function buildPreload(
|
||||
}
|
||||
|
||||
/**
|
||||
* Native chrome options for a window, per skin. The ONE place either skin's
|
||||
* frame decision is made — both the main window (src/bun/index.ts) and
|
||||
* openSecondaryWindow spread this.
|
||||
* Native chrome options for a window. The ONE place the frame decision is made —
|
||||
* both the main window (src/bun/index.ts) and openSecondaryWindow spread this.
|
||||
*
|
||||
* - "win7" draws its own Aero title bar in the webview (drag region + our own
|
||||
* minimize/maximize/close), so the window must be frameless on EVERY
|
||||
* platform. `titleBarStyle: "hidden"` clears `Titled` from the Cocoa style
|
||||
* mask, which is also what removes the macOS traffic lights — there is no
|
||||
* separate hide-traffic-lights API.
|
||||
* - "modern" keeps today's split: macOS fuses the tab bar into an inset
|
||||
* titlebar (traffic lights overlay the UI's h-10 tab row, offset centers
|
||||
* them); other platforms keep the native titlebar.
|
||||
*
|
||||
* Skin changes therefore only reach the frame on the NEXT window open — the
|
||||
* CSS half applies live. The settings UI says so.
|
||||
* The webview draws its own Aero title bar (drag region + our own
|
||||
* minimize/maximize/close), so the window is frameless on EVERY platform.
|
||||
* `titleBarStyle: "hidden"` clears `Titled` from the Cocoa style mask, which is
|
||||
* also what removes the macOS traffic lights — there is no separate
|
||||
* hide-traffic-lights API. Linux honours it too: the GTK wrapper calls
|
||||
* gtk_window_set_decorated(false).
|
||||
*/
|
||||
export function chromeOptions(skin: AppSettings["skin"]) {
|
||||
if (skin === "win7") return { titleBarStyle: "hidden" as const };
|
||||
return isMac
|
||||
? { titleBarStyle: "hiddenInset" as const, trafficLightOffset: { x: 12, y: 13 } }
|
||||
: {};
|
||||
export function chromeOptions() {
|
||||
return { titleBarStyle: "hidden" as const };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,14 +115,14 @@ export interface SecondaryWindowOptions {
|
||||
|
||||
/**
|
||||
* App-chromed secondary window. The frame decision is delegated to
|
||||
* chromeOptions (which owns both the per-skin and the per-platform branch).
|
||||
* chromeOptions (the single frame decision).
|
||||
*/
|
||||
export function openSecondaryWindow(opts: SecondaryWindowOptions): BrowserWindow {
|
||||
const win = new BrowserWindow({
|
||||
title: opts.title,
|
||||
url: opts.url,
|
||||
frame: opts.frame,
|
||||
...chromeOptions(opts.settings.skin),
|
||||
...chromeOptions(),
|
||||
preload: buildPreload(opts.mode, opts.settings, opts.ctx),
|
||||
rpc: opts.rpc,
|
||||
hidden: true,
|
||||
|
||||
Reference in New Issue
Block a user