mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-20 15:19:16 +00:00
* fix(windows): restore frameless rounded corners and tray transparency (#2505) Windows frameless windows used a solid host backgroundColor under DWM rounding, which showed as a dark rim, while the tray popup kept the default opaque backdrop under CSS border-radius (square tips / 冒尖). Use a clear transparent host with native roundedCorners for app windows, and disable OS rounding for the CSS-shaped tray overlay. Keep html/body transparent on the tray route so corner pixels stay see-through. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(windows): require chrome helpers outside with(ctx) createMainWindowApi injects require from windowManager.cjs, so a relative require inside with(ctx) resolved to electron/bridges/windowsWindowChrome.cjs and crashed every main-window create (MODULE_NOT_FOUND). Load the helpers at module scope in each factory so paths stay file-local. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(windows): keep resizable app windows opaque Codex P2: Electron documents transparent BrowserWindows as not resizable, and enabling resizable can break them. App content windows now only set roundedCorners: true with a solid theme backdrop; the tray overlay stays transparent because it is already non-resizable. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(tray): hide opaque splash on tray overlay route Codex P2: the shared splash screen still painted an opaque full-window fill when the tray panel showed before React mounted, recreating the square-corner flash. Mark tray-window early, CSS-hide the splash, and remove the splash node on DOM ready / tray render. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(tray): defer first show until ready; keep chrome comments ASCII Wait to show the tray BrowserWindow until did-finish-load so the shared opaque splash cannot flash as a square underlay. Also rewrite the new helper file header in ASCII-only English per AGENTS.md. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(tray): cancel pending first-load show on second toggle If the user toggles the tray again while the first renderer load is still pending, clear trayPanelShowWhenReady so did-finish-load cannot open the panel after an intentional dismiss. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(tray): keep shared splash transparent by default Move the opaque splash fill behind html:not(.tray-window) so the tray overlay route never inherits a solid full-window background from the shared splash markup. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com>
57 lines
1.9 KiB
JavaScript
57 lines
1.9 KiB
JavaScript
/**
|
|
* Windows frameless window chrome helpers.
|
|
*
|
|
* Background (#2505):
|
|
* - Frameless Win11 windows need an explicit `roundedCorners: true` so DWM
|
|
* applies the system round clip (Electron 34+).
|
|
* - Transparent tray popups that keep the default opaque white backdrop + CSS
|
|
* `border-radius` produce square tips under a rounded panel.
|
|
*
|
|
* Approach:
|
|
* - App content windows (resizable): solid host + native `roundedCorners`.
|
|
* Do NOT set `transparent: true` here - Electron documents transparent
|
|
* windows as not resizable, and `resizable: true` can break them
|
|
* (https://www.electronjs.org/docs/latest/tutorial/custom-window-styles).
|
|
* - Tray / CSS-shaped popovers (`resizable: false`): transparent host + clear
|
|
* backdrop + `roundedCorners: false` so only the CSS radius defines the
|
|
* silhouette (Electron #46468: Win11 otherwise forces OS rounding on
|
|
* transparent windows).
|
|
*/
|
|
|
|
const CLEAR_BACKGROUND = "#00000000";
|
|
|
|
function isWindowsPlatform(platform = process.platform) {
|
|
return platform === "win32";
|
|
}
|
|
|
|
/**
|
|
* Options for full-bleed app windows (main / settings / terminal popup).
|
|
* Safe to spread on non-Windows - returns an empty object.
|
|
*/
|
|
function windowsFramelessContentChromeOptions(platform = process.platform) {
|
|
if (!isWindowsPlatform(platform)) return {};
|
|
return {
|
|
roundedCorners: true,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Options for CSS-rounded overlay windows (tray panel).
|
|
* Always apply when creating those windows; callers already opt into transparency.
|
|
*/
|
|
function windowsCssRoundedOverlayChromeOptions(platform = process.platform) {
|
|
return {
|
|
transparent: true,
|
|
backgroundColor: CLEAR_BACKGROUND,
|
|
// Overlay shape comes from CSS; keep OS rounding off on Win11.
|
|
...(isWindowsPlatform(platform) ? { roundedCorners: false } : {}),
|
|
};
|
|
}
|
|
|
|
module.exports = {
|
|
CLEAR_BACKGROUND,
|
|
isWindowsPlatform,
|
|
windowsFramelessContentChromeOptions,
|
|
windowsCssRoundedOverlayChromeOptions,
|
|
};
|