diff --git a/v2rayN/ServiceLib/Common/Utils.cs b/v2rayN/ServiceLib/Common/Utils.cs index 3907b1a7..2a00560a 100644 --- a/v2rayN/ServiceLib/Common/Utils.cs +++ b/v2rayN/ServiceLib/Common/Utils.cs @@ -1101,6 +1101,13 @@ public class Utils public static bool IsLinux() => OperatingSystem.IsLinux(); + public static bool IsWayland() => + OperatingSystem.IsLinux() + && ( + Environment.GetEnvironmentVariable("WAYLAND_DISPLAY").IsNotEmpty() + || string.Equals(Environment.GetEnvironmentVariable("XDG_SESSION_TYPE"), "wayland", StringComparison.OrdinalIgnoreCase) + ); + public static bool IsMacOS() => OperatingSystem.IsMacOS(); public static bool IsNonWindows() => !OperatingSystem.IsWindows(); diff --git a/v2rayN/v2rayN.Desktop/Base/WindowBase.cs b/v2rayN/v2rayN.Desktop/Base/WindowBase.cs index 86ba979e..26fadc77 100644 --- a/v2rayN/v2rayN.Desktop/Base/WindowBase.cs +++ b/v2rayN/v2rayN.Desktop/Base/WindowBase.cs @@ -8,7 +8,7 @@ public class WindowBase : ReactiveWindow where TViewMode public WindowBase() { - if (Utils.IsLinux()) + if (Utils.IsWayland()) { SystemDecorations = SystemDecorations.BorderOnly; } @@ -65,7 +65,7 @@ public class WindowBase : ReactiveWindow where TViewMode private void ConfigureLinuxTitleBar() { - if (!Utils.IsLinux()) + if (!Utils.IsWayland()) { return; } diff --git a/v2rayN/v2rayN.Desktop/Common/UI.cs b/v2rayN/v2rayN.Desktop/Common/UI.cs index 429ba344..79638cd9 100644 --- a/v2rayN/v2rayN.Desktop/Common/UI.cs +++ b/v2rayN/v2rayN.Desktop/Common/UI.cs @@ -18,7 +18,7 @@ internal class UI WindowStartupLocation = WindowStartupLocation.CenterOwner, CanResize = false, Topmost = false, - SystemDecorations = Utils.IsLinux() ? SystemDecorations.BorderOnly : SystemDecorations.Full + SystemDecorations = Utils.IsWayland() ? SystemDecorations.BorderOnly : SystemDecorations.Full }; var box = MessageBoxManager.GetMessageBoxStandard(messageBoxParams); return await box.ShowWindowDialogAsync(owner);