feat: implement transparency for Windows (#46)

This commit is contained in:
Flag
2023-07-11 19:45:30 +01:00
committed by GitHub
parent b4da701080
commit 0415cb77f7
6 changed files with 57 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
import { app, dialog, ipcMain, session, shell } from "electron";
import { existsSync, readFileSync, watch } from "fs";
import { open, readFile } from "fs/promises";
import { release } from "os";
import { join } from "path";
import { debounce } from "shared/utils/debounce";
@@ -41,6 +42,10 @@ ipcMain.on(IpcEvents.GET_VERSION, e => {
e.returnValue = app.getVersion();
});
ipcMain.on(IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY, e => {
e.returnValue = process.platform === "win32" && Number(release().split(".").pop()) >= 22621;
});
ipcMain.on(IpcEvents.AUTOSTART_ENABLED, e => {
e.returnValue = autoStart.isEnabled();
});

View File

@@ -262,6 +262,15 @@ function createMainWindow() {
},
icon: ICON_PATH,
frame: VencordSettings.store.frameless !== true,
...(Settings.store.transparencyOption !== "none"
? {
backgroundColor: "#00000000",
backgroundMaterial: Settings.store.transparencyOption,
transparent: true
}
: {
transparent: false
}),
...(Settings.store.staticTitle ? { title: "Vencord" } : {}),
...(VencordSettings.store.macosTranslucency
? {