Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
iamEvanYT committed May 26, 2025
commit 89beba12c7e86f46798e78b1616ef4b5046b2070
34 changes: 25 additions & 9 deletions src/main/browser/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ type BrowserWindowEvents = {
destroy: [];
};

function applyMicaEffect(window: MicaBrowserWindow) {
// if (window.isMaximized()) {
// window.setSquareCorner();
// } else {
// window.setRoundedCorner();
// }

// Window 7+
window.setAcrylic();

// Window 11
window.setMicaAcrylicEffect();
}

export class TabbedBrowserWindow extends TypedEventEmitter<BrowserWindowEvents> {
id: number;
window: MicaBrowserWindow;
Expand Down Expand Up @@ -76,15 +90,15 @@ export class TabbedBrowserWindow extends TypedEventEmitter<BrowserWindowEvents>
});

// Apply Mica effect on Windows
if (process.platform === "win32") {
this.window.setRoundedCorner();

// Window 7+
this.window.setAcrylic();

// Window 11
this.window.setMicaAcrylicEffect();
}
const useMicaElectron = process.platform === "win32" && FLAGS.USE_MICA_ELECTRON;
const updateMicaEffect = () => {
if (useMicaElectron) {
applyMicaEffect(this.window);
return true;
}
return false;
};
updateMicaEffect();

// Hide the window buttons before the component is mounted
if (type === "normal") {
Expand Down Expand Up @@ -113,9 +127,11 @@ export class TabbedBrowserWindow extends TypedEventEmitter<BrowserWindowEvents>

this.window.on("maximize", () => {
fireWindowStateChanged(this);
updateMicaEffect();
});
this.window.on("unmaximize", () => {
fireWindowStateChanged(this);
updateMicaEffect();
});

// Focus on the focused tab
Expand Down
4 changes: 4 additions & 0 deletions src/main/modules/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { DEBUG_AREA } from "./output";

type Flags = {
SCRUBBED_USER_AGENT: boolean;
USE_MICA_ELECTRON: boolean;
ERROR_PAGE_LOAD_MODE: "replace" | "load";
SHOW_DEBUG_PRINTS: boolean;
SHOW_DEBUG_ERRORS: boolean | DEBUG_AREA[];
Expand All @@ -17,6 +18,9 @@ export const FLAGS: Flags = {
// Transform the user agent
SCRUBBED_USER_AGENT: true,

// Use Mica Electron
USE_MICA_ELECTRON: true,

// Replace - Use window.location.replace to load the error page.
// Load - Add the page to the history stack by loading it normally.
ERROR_PAGE_LOAD_MODE: "replace",
Expand Down