From 0f2cc91230ed1df8c437900942ef61972fde31fc Mon Sep 17 00:00:00 2001 From: Flag <38012125+Yumiro@users.noreply.github.com> Date: Thu, 6 Jul 2023 10:56:04 +0100 Subject: [PATCH] check for win11 22H2+ instead --- src/main/ipc.ts | 5 +++++ src/preload/VencordDesktopNative.ts | 3 ++- src/renderer/components/Settings.tsx | 10 +++++----- src/shared/IpcEvents.ts | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/ipc.ts b/src/main/ipc.ts index c073c68..57d3cb5 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -9,6 +9,7 @@ import { existsSync, readFileSync, watch } from "fs"; import { open, readFile } from "fs/promises"; import { join } from "path"; import { debounce } from "shared/utils/debounce"; +import { release } from "os"; import { IpcEvents } from "../shared/IpcEvents"; import { setBadgeCount } from "./appBadge"; @@ -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(); }); diff --git a/src/preload/VencordDesktopNative.ts b/src/preload/VencordDesktopNative.ts index 6f0f402..5d2f724 100644 --- a/src/preload/VencordDesktopNative.ts +++ b/src/preload/VencordDesktopNative.ts @@ -23,7 +23,8 @@ export const VencordDesktopNative = { app: { relaunch: () => invoke(IpcEvents.RELAUNCH), getVersion: () => sendSync(IpcEvents.GET_VERSION), - setBadgeCount: (count: number) => invoke(IpcEvents.SET_BADGE_COUNT, count) + setBadgeCount: (count: number) => invoke(IpcEvents.SET_BADGE_COUNT, count), + supportsWindowsTransparency: () => sendSync(IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY) }, autostart: { isEnabled: () => sendSync(IpcEvents.AUTOSTART_ENABLED), diff --git a/src/renderer/components/Settings.tsx b/src/renderer/components/Settings.tsx index 4880a6d..6844768 100644 --- a/src/renderer/components/Settings.tsx +++ b/src/renderer/components/Settings.tsx @@ -10,10 +10,10 @@ import { Margins } from "@vencord/types/utils"; import { Button, Forms, Select, Switch, Text, useState } from "@vencord/types/webpack/common"; import { setBadge } from "renderer/appBadge"; import { useSettings } from "renderer/settings"; -import { isWindows } from "renderer/utils"; export default function SettingsUi() { const Settings = useSettings(); + const supportsWindowsTransparency = VencordDesktopNative.app.supportsWindowsTransparency(); const { autostart } = VencordDesktopNative; const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled()); @@ -98,7 +98,7 @@ export default function SettingsUi() { ))} - {isWindows && + {supportsWindowsTransparency && <> Transparency Options