check for win11 22H2+ instead
This commit is contained in:
parent
0db6fa8f90
commit
0f2cc91230
4 changed files with 13 additions and 6 deletions
|
@ -9,6 +9,7 @@ import { existsSync, readFileSync, watch } from "fs";
|
||||||
import { open, readFile } from "fs/promises";
|
import { open, readFile } from "fs/promises";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import { debounce } from "shared/utils/debounce";
|
import { debounce } from "shared/utils/debounce";
|
||||||
|
import { release } from "os";
|
||||||
|
|
||||||
import { IpcEvents } from "../shared/IpcEvents";
|
import { IpcEvents } from "../shared/IpcEvents";
|
||||||
import { setBadgeCount } from "./appBadge";
|
import { setBadgeCount } from "./appBadge";
|
||||||
|
@ -41,6 +42,10 @@ ipcMain.on(IpcEvents.GET_VERSION, e => {
|
||||||
e.returnValue = app.getVersion();
|
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 => {
|
ipcMain.on(IpcEvents.AUTOSTART_ENABLED, e => {
|
||||||
e.returnValue = autoStart.isEnabled();
|
e.returnValue = autoStart.isEnabled();
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,7 +23,8 @@ export const VencordDesktopNative = {
|
||||||
app: {
|
app: {
|
||||||
relaunch: () => invoke<void>(IpcEvents.RELAUNCH),
|
relaunch: () => invoke<void>(IpcEvents.RELAUNCH),
|
||||||
getVersion: () => sendSync<void>(IpcEvents.GET_VERSION),
|
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: {
|
autostart: {
|
||||||
isEnabled: () => sendSync<boolean>(IpcEvents.AUTOSTART_ENABLED),
|
isEnabled: () => sendSync<boolean>(IpcEvents.AUTOSTART_ENABLED),
|
||||||
|
|
|
@ -10,10 +10,10 @@ import { Margins } from "@vencord/types/utils";
|
||||||
import { Button, Forms, Select, Switch, Text, useState } from "@vencord/types/webpack/common";
|
import { Button, Forms, Select, Switch, Text, useState } from "@vencord/types/webpack/common";
|
||||||
import { setBadge } from "renderer/appBadge";
|
import { setBadge } from "renderer/appBadge";
|
||||||
import { useSettings } from "renderer/settings";
|
import { useSettings } from "renderer/settings";
|
||||||
import { isWindows } from "renderer/utils";
|
|
||||||
|
|
||||||
export default function SettingsUi() {
|
export default function SettingsUi() {
|
||||||
const Settings = useSettings();
|
const Settings = useSettings();
|
||||||
|
const supportsWindowsTransparency = VencordDesktopNative.app.supportsWindowsTransparency();
|
||||||
|
|
||||||
const { autostart } = VencordDesktopNative;
|
const { autostart } = VencordDesktopNative;
|
||||||
const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled());
|
const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled());
|
||||||
|
@ -98,7 +98,7 @@ export default function SettingsUi() {
|
||||||
</Switch>
|
</Switch>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{isWindows &&
|
{supportsWindowsTransparency &&
|
||||||
<>
|
<>
|
||||||
<Switch
|
<Switch
|
||||||
value={Settings.transparent ?? false}
|
value={Settings.transparent ?? false}
|
||||||
|
@ -111,9 +111,9 @@ export default function SettingsUi() {
|
||||||
<Forms.FormTitle className={Margins.top16 + " " + Margins.bottom8}>Transparency Options</Forms.FormTitle>
|
<Forms.FormTitle className={Margins.top16 + " " + Margins.bottom8}>Transparency Options</Forms.FormTitle>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
placeholder="Mica"
|
placeholder="Mica (incorporates system theme + desktop wallpaper to paint the background)"
|
||||||
options={[
|
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: "Tabbed (variant of Mica with stronger background tinting)", value: "tabbed" },
|
||||||
{ label: "Acrylic (blurs the window behind Vencord Desktop for a translucent background)", value: "acrylic" }
|
{ 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)}
|
select={v => (Settings.transparencyOption = v)}
|
||||||
isSelected={v => v === Settings.transparencyOption}
|
isSelected={v => v === Settings.transparencyOption}
|
||||||
serialize={s => s}
|
serialize={s => s}
|
||||||
isDisabled={!Settings.transparent}
|
isDisabled={!Settings.transparent}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Forms.FormDivider className={Margins.top16 + " " + Margins.bottom16} />
|
<Forms.FormDivider className={Margins.top16 + " " + Margins.bottom16} />
|
||||||
|
|
|
@ -11,6 +11,7 @@ export const enum IpcEvents {
|
||||||
GET_RENDERER_CSS_FILE = "VCD_GET_RENDERER_CSS_FILE",
|
GET_RENDERER_CSS_FILE = "VCD_GET_RENDERER_CSS_FILE",
|
||||||
|
|
||||||
GET_VERSION = "VCD_GET_VERSION",
|
GET_VERSION = "VCD_GET_VERSION",
|
||||||
|
SUPPORTS_WINDOWS_TRANSPARENCY = "VCD_SUPPORTS_WINDOWS_TRANSPARENCY",
|
||||||
|
|
||||||
RELAUNCH = "VCD_RELAUNCH",
|
RELAUNCH = "VCD_RELAUNCH",
|
||||||
CLOSE = "VCD_CLOSE",
|
CLOSE = "VCD_CLOSE",
|
||||||
|
|
Reference in a new issue