From af42af070ecd9bf912aa48a0fbab1934837a8ebb Mon Sep 17 00:00:00 2001 From: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Date: Tue, 11 Apr 2023 01:21:45 +0800 Subject: [PATCH] feat: implement translucency for macOS (#4) Co-authored-by: Vendicated --- src/main/mainWindow.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index c0971ad..d2f9233 100644 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -232,6 +232,16 @@ function initSettingsListeners(win: BrowserWindow) { }); } }); + + VencordSettings.addChangeListener("macosTranslucency", enabled => { + if (enabled) { + win.setVibrancy("sidebar"); + win.setBackgroundColor("#ffffff00"); + } else { + win.setVibrancy(null); + win.setBackgroundColor("#ffffff"); + } + }); } export function createMainWindow() { @@ -247,6 +257,12 @@ export function createMainWindow() { }, icon: ICON_PATH, frame: VencordSettings.store.frameless !== true, + ...(VencordSettings.store.macosTranslucency + ? { + vibrancy: "sidebar", + backgroundColor: "#ffffff00" + } + : {}), ...getWindowBoundsOptions() }));