From d823970f602f07d02dd37c84dc5cafe49de751dc Mon Sep 17 00:00:00 2001 From: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Date: Sun, 9 Apr 2023 11:32:10 +0800 Subject: [PATCH] feat: implement translucency for macOS --- src/main/mainWindow.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index 6188472..5b2e767 100644 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -227,6 +227,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() { @@ -242,6 +252,12 @@ export function createMainWindow() { }, icon: ICON_PATH, frame: VencordSettings.store.frameless !== true, + ...(VencordSettings.store.macosTranslucency + ? { + vibrancy: "sidebar", + backgroundColor: "#ffffff00" + } + : {}), ...getWindowBoundsOptions() }));