From d37f07cedb170aa754004a71dc890a04becda3ea Mon Sep 17 00:00:00 2001 From: Oleh Polisan Date: Sun, 2 Jun 2024 00:23:07 +0300 Subject: [PATCH] moved isWayland to constants --- src/main/constants.ts | 3 +++ src/main/mainWindow.ts | 2 +- src/main/screenShare.ts | 4 +--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/constants.ts b/src/main/constants.ts index 1a02d5e..6e2cb2f 100644 --- a/src/main/constants.ts +++ b/src/main/constants.ts @@ -61,3 +61,6 @@ export const enum MessageBoxChoice { Default, Cancel } + +export const isWayland = + process.platform === "linux" && (process.env.XDG_SESSION_TYPE === "wayland" || !!process.env.WAYLAND_DISPLAY); diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index 4ddb85c..583484c 100644 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -31,13 +31,13 @@ import { DATA_DIR, DEFAULT_HEIGHT, DEFAULT_WIDTH, + isWayland, MessageBoxChoice, MIN_HEIGHT, MIN_WIDTH, VENCORD_FILES_DIR } from "./constants"; import { initKeybinds } from "./keybinds"; -import { isWayland } from "./screenShare"; import { Settings, State, VencordSettings } from "./settings"; import { createSplashWindow } from "./splash"; import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally"; diff --git a/src/main/screenShare.ts b/src/main/screenShare.ts index 004edc5..34d8e4a 100644 --- a/src/main/screenShare.ts +++ b/src/main/screenShare.ts @@ -8,11 +8,9 @@ import { desktopCapturer, session, Streams } from "electron"; import type { StreamPick } from "renderer/components/ScreenSharePicker"; import { IpcEvents } from "shared/IpcEvents"; +import { isWayland } from "./constants"; import { handle } from "./utils/ipcWrappers"; -export const isWayland = - process.platform === "linux" && (process.env.XDG_SESSION_TYPE === "wayland" || !!process.env.WAYLAND_DISPLAY); - export function registerScreenShareHandler() { handle(IpcEvents.CAPTURER_GET_LARGE_THUMBNAIL, async (_, id: string) => { const sources = await desktopCapturer.getSources({