Compare commits

..

2 commits

Author SHA1 Message Date
YsLtr
acf93fa8dd
Merge 523dfb7acf into 005cb620ec 2026-03-26 04:22:35 +00:00
YsLtr
523dfb7acf Restrict custom title bars to Wayland sessions 2026-03-26 12:21:40 +08:00
3 changed files with 10 additions and 3 deletions

View file

@ -1101,6 +1101,13 @@ public class Utils
public static bool IsLinux() => OperatingSystem.IsLinux(); 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 IsMacOS() => OperatingSystem.IsMacOS();
public static bool IsNonWindows() => !OperatingSystem.IsWindows(); public static bool IsNonWindows() => !OperatingSystem.IsWindows();

View file

@ -8,7 +8,7 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
public WindowBase() public WindowBase()
{ {
if (Utils.IsLinux()) if (Utils.IsWayland())
{ {
SystemDecorations = SystemDecorations.BorderOnly; SystemDecorations = SystemDecorations.BorderOnly;
} }
@ -65,7 +65,7 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
private void ConfigureLinuxTitleBar() private void ConfigureLinuxTitleBar()
{ {
if (!Utils.IsLinux()) if (!Utils.IsWayland())
{ {
return; return;
} }

View file

@ -18,7 +18,7 @@ internal class UI
WindowStartupLocation = WindowStartupLocation.CenterOwner, WindowStartupLocation = WindowStartupLocation.CenterOwner,
CanResize = false, CanResize = false,
Topmost = false, Topmost = false,
SystemDecorations = Utils.IsLinux() ? SystemDecorations.BorderOnly : SystemDecorations.Full SystemDecorations = Utils.IsWayland() ? SystemDecorations.BorderOnly : SystemDecorations.Full
}; };
var box = MessageBoxManager.GetMessageBoxStandard(messageBoxParams); var box = MessageBoxManager.GetMessageBoxStandard(messageBoxParams);
return await box.ShowWindowDialogAsync(owner); return await box.ShowWindowDialogAsync(owner);