diff --git a/src/main/ipc.ts b/src/main/ipc.ts index e6a42af..4d9aaf8 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -40,6 +40,11 @@ handleSync( () => process.platform === "win32" && Number(release().split(".").pop()) >= 22621 ); +handleSync( + IpcEvents.IS_WINDOWS, + () => process.platform === "win32" +); + handleSync(IpcEvents.AUTOSTART_ENABLED, () => autoStart.isEnabled()); handle(IpcEvents.ENABLE_AUTOSTART, autoStart.enable); handle(IpcEvents.DISABLE_AUTOSTART, autoStart.disable); diff --git a/src/preload/VesktopNative.ts b/src/preload/VesktopNative.ts index d17bd23..c7c5a3c 100644 --- a/src/preload/VesktopNative.ts +++ b/src/preload/VesktopNative.ts @@ -24,7 +24,8 @@ export const VesktopNative = { relaunch: () => invoke(IpcEvents.RELAUNCH), getVersion: () => sendSync(IpcEvents.GET_VERSION), setBadgeCount: (count: number) => invoke(IpcEvents.SET_BADGE_COUNT, count), - supportsWindowsTransparency: () => sendSync(IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY) + supportsWindowsTransparency: () => sendSync(IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY), + isWindows: () => sendSync(IpcEvents.IS_WINDOWS) }, autostart: { isEnabled: () => sendSync(IpcEvents.AUTOSTART_ENABLED), diff --git a/src/renderer/components/Settings.tsx b/src/renderer/components/Settings.tsx index 77c29b9..670615a 100644 --- a/src/renderer/components/Settings.tsx +++ b/src/renderer/components/Settings.tsx @@ -16,7 +16,7 @@ import { isTruthy } from "shared/utils/guards"; export default function SettingsUi() { const Settings = useSettings(); const supportsWindowsTransparency = VesktopNative.app.supportsWindowsTransparency(); - const isWindows = process.platform === "win32"; + const isWindows = VesktopNative.app.isWindows(); const { autostart } = VesktopNative; const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled()); diff --git a/src/shared/IpcEvents.ts b/src/shared/IpcEvents.ts index df64403..9b0e8fc 100644 --- a/src/shared/IpcEvents.ts +++ b/src/shared/IpcEvents.ts @@ -12,6 +12,7 @@ export const enum IpcEvents { GET_VERSION = "VCD_GET_VERSION", SUPPORTS_WINDOWS_TRANSPARENCY = "VCD_SUPPORTS_WINDOWS_TRANSPARENCY", + IS_WINDOWS = "VCD_IS_WINDOWS", RELAUNCH = "VCD_RELAUNCH", CLOSE = "VCD_CLOSE",