Add dynamic vibe import only on windows (#227)

This commit is contained in:
kz-n 2022-10-12 21:35:32 +02:00 committed by GitHub
parent 0c6e7f2a9a
commit 3696ebdba9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View file

@ -1,7 +1,6 @@
import * as fs from "fs";
import {app, dialog} from "electron";
import path from "path";
import vibe from "@pyke/vibe";
export var firstRun: boolean;
export var contentPath: string;
export var transparency: boolean;
@ -120,10 +119,12 @@ export async function injectElectronFlags() {
default:
console.log("No performance modes set");
}
if ((await getConfig("windowStyle")) == "transparent") {
console.log("Transparent mode enabled");
vibe.setup(app);
transparency = true;
if ((await getConfig("windowStyle")) == "transparent" && process.platform === "win32") {
import("@pyke/vibe").then(vibe => {
console.log("Transparent mode enabled");
vibe.setup(app);
transparency = true;
});
}
}
export async function setLang(language: string) {

View file

@ -21,7 +21,6 @@ import startServer from "./socket";
import contextMenu from "electron-context-menu";
import os from "os";
import {tray} from "./tray";
import vibe from "@pyke/vibe";
import {iconPath} from "./main";
export let mainWindow: BrowserWindow;
export let inviteWindow: BrowserWindow;
@ -51,10 +50,12 @@ contextMenu({
]
});
async function doAfterDefiningTheWindow() {
if (transparency) {
vibe.applyEffect(mainWindow, "acrylic");
vibe.setDarkMode(mainWindow);
mainWindow.show();
if (transparency && process.platform === "win32") {
import("@pyke/vibe").then(vibe => {
vibe.applyEffect(mainWindow, "acrylic");
vibe.setDarkMode(mainWindow);
mainWindow.show();
});
}
var ignoreProtocolWarning = await getConfig("ignoreProtocolWarning");
await checkIfConfigIsBroken();