check for win11 22H2+ instead

This commit is contained in:
Flag 2023-07-06 10:56:04 +01:00
parent 0db6fa8f90
commit 0f2cc91230
4 changed files with 13 additions and 6 deletions

View file

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

View file

@ -23,7 +23,8 @@ export const VencordDesktopNative = {
app: {
relaunch: () => invoke<void>(IpcEvents.RELAUNCH),
getVersion: () => sendSync<void>(IpcEvents.GET_VERSION),
setBadgeCount: (count: number) => invoke<void>(IpcEvents.SET_BADGE_COUNT, count)
setBadgeCount: (count: number) => invoke<void>(IpcEvents.SET_BADGE_COUNT, count),
supportsWindowsTransparency: () => sendSync<boolean>(IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY)
},
autostart: {
isEnabled: () => sendSync<boolean>(IpcEvents.AUTOSTART_ENABLED),

View file

@ -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() {
</Switch>
))}
{isWindows &&
{supportsWindowsTransparency &&
<>
<Switch
value={Settings.transparent ?? false}
@ -111,9 +111,9 @@ export default function SettingsUi() {
<Forms.FormTitle className={Margins.top16 + " " + Margins.bottom8}>Transparency Options</Forms.FormTitle>
<Select
placeholder="Mica"
placeholder="Mica (incorporates system theme + desktop wallpaper to paint the background)"
options={[
{ label: "Mica (incorporates system theme + desktop wallpaper to \"paint\" the background)", value: "mica", default: true },
{ label: "Mica (incorporates system theme + desktop wallpaper to paint the background)", value: "mica", default: true },
{ label: "Tabbed (variant of Mica with stronger background tinting)", value: "tabbed" },
{ label: "Acrylic (blurs the window behind Vencord Desktop for a translucent background)", value: "acrylic" }
]}
@ -121,7 +121,7 @@ export default function SettingsUi() {
select={v => (Settings.transparencyOption = v)}
isSelected={v => v === Settings.transparencyOption}
serialize={s => s}
isDisabled={!Settings.transparent}
isDisabled={!Settings.transparent}
/>
<Forms.FormDivider className={Margins.top16 + " " + Margins.bottom16} />

View file

@ -11,6 +11,7 @@ export const enum IpcEvents {
GET_RENDERER_CSS_FILE = "VCD_GET_RENDERER_CSS_FILE",
GET_VERSION = "VCD_GET_VERSION",
SUPPORTS_WINDOWS_TRANSPARENCY = "VCD_SUPPORTS_WINDOWS_TRANSPARENCY",
RELAUNCH = "VCD_RELAUNCH",
CLOSE = "VCD_CLOSE",