feat: implement translucency for macOS (#4)

Co-authored-by: Vendicated <vendicated@riseup.net>
This commit is contained in:
Ryan Cao 2023-04-11 01:21:45 +08:00 committed by GitHub
parent 07d647ba2e
commit af42af070e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()
}));