mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-11-29 09:41:02 +01:00
* Fix Linux WebView blank window on Wayland and improve sign-in logging (#2129) - Set WEBKIT_DISABLE_COMPOSITING_MODE=1 and WEBKIT_DISABLE_DMABUF_RENDERER=1 on Linux startup in Program.cs so WebKitGTK does not fail silently on Wayland/Xwayland when hardware acceleration or DMABUF compositing is buggy. - Add Configuration.IsWayland and Configuration.IsWaylandSession in LibationFileManager to detect Wayland desktop sessions. - In AvaloniaLoginChoiceEager, only set gtkArgs.ForceX11GdkBackend = true when not running in a Wayland session (!Configuration.IsWayland). On Wayland (e.g. Fedora KDE Plasma 6), forcing X11 forces Xwayland, causing compositor mismatches and blank rendering. - Add debug/warning logging for WebView adapter creation, navigation start, success, and failure in AvaloniaLoginChoiceEager. - Add unit tests for Configuration.IsWaylandSession in LibationFileManager.Tests. * Support RPM 4.20+ isolated build directory in Bundle_Redhat.sh RPM 4.20 introduced per-package build directory isolation (%mkbuilddir), which runs %install in %{_builddir}/%{name}-%{version}-build rather than %{_builddir}. This caused Bundle_Redhat.sh to fail on newer runners (e.g. GitHub Actions Ubuntu 26.04) because files were staged in %{_builddir}. In %install, detect if files are not present in the current working directory and copy them from %{_builddir}.
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using System;
|
|
|
|
namespace LibationFileManager;
|
|
|
|
[Flags]
|
|
public enum OS
|
|
{
|
|
Unknown,
|
|
Windows = 0x100000,
|
|
Linux = 0x200000,
|
|
MacOS = 0x400000,
|
|
}
|
|
|
|
public static class Extensions
|
|
{
|
|
public static string ToVersionString(this Version? version)
|
|
=> version is null ? "[unknown]"
|
|
: version.Revision > 1 ? version.ToString(4)
|
|
: version.ToString(3);
|
|
}
|
|
|
|
public partial class Configuration
|
|
{
|
|
public static bool IsWindows { get; } = OperatingSystem.IsWindows();
|
|
public static bool IsLinux { get; } = OperatingSystem.IsLinux();
|
|
public static bool IsMacOs { get; } = OperatingSystem.IsMacOS();
|
|
|
|
/// <summary>True when running inside a (Linux) Snap sandbox (e.g. snap run libation). WebView login is disabled in this environment to avoid portal/sandbox crashes.</summary>
|
|
public static bool IsRunningUnderSnap { get; } = IsLinux && !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SNAP"));
|
|
|
|
/// <summary>True when running under a Linux Wayland desktop session.</summary>
|
|
public static bool IsWayland { get; } = IsLinux && IsWaylandSession();
|
|
|
|
public static bool IsWaylandSession(Func<string, string?>? getEnv = null)
|
|
{
|
|
getEnv ??= Environment.GetEnvironmentVariable;
|
|
return !string.IsNullOrEmpty(getEnv("WAYLAND_DISPLAY"))
|
|
|| string.Equals(getEnv("XDG_SESSION_TYPE"), "wayland", StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
public static Version? LibationVersion { get; private set; }
|
|
public static void SetLibationVersion(Version? version) => LibationVersion = version;
|
|
|
|
public static OS OS { get; }
|
|
= IsLinux ? OS.Linux
|
|
: IsMacOs ? OS.MacOS
|
|
: IsWindows ? OS.Windows
|
|
: OS.Unknown;
|
|
}
|