From 2cac35f9bba3517cc480d85dbe74e2983f2bc3ee Mon Sep 17 00:00:00 2001 From: dreamsyntax Date: Sat, 25 Jul 2026 08:17:44 -0700 Subject: [PATCH 1/2] Linux: Use Wayland by default; fallback to X11 --- .../HedgeModManager.UI.csproj | 1 + Source/HedgeModManager.UI/Program.cs | 26 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Source/HedgeModManager.UI/HedgeModManager.UI.csproj b/Source/HedgeModManager.UI/HedgeModManager.UI.csproj index 22b5983..1b3adec 100644 --- a/Source/HedgeModManager.UI/HedgeModManager.UI.csproj +++ b/Source/HedgeModManager.UI/HedgeModManager.UI.csproj @@ -33,6 +33,7 @@ + diff --git a/Source/HedgeModManager.UI/Program.cs b/Source/HedgeModManager.UI/Program.cs index dff0c4d..4d698bd 100644 --- a/Source/HedgeModManager.UI/Program.cs +++ b/Source/HedgeModManager.UI/Program.cs @@ -210,7 +210,31 @@ public static string GetTagName() // Avalonia configuration, don't remove; also used by visual designer. public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() - .UsePlatformDetect() + .UsePlatformDetectPreferWayland() .WithInterFont() .LogToTrace(); } + +internal static class LinuxPlatformDetector +{ + public static AppBuilder UsePlatformDetectPreferWayland(this AppBuilder builder) + { + if (!OperatingSystem.IsLinux()) + return builder.UsePlatformDetect(); + + if (IsWaylandSession()) + builder.UseWayland(); + else + builder.UseX11(); + + builder.UseSkia().UseHarfBuzz(); + return builder; + } + + private static bool IsWaylandSession() + => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WAYLAND_DISPLAY")) + || string.Equals( + Environment.GetEnvironmentVariable("XDG_SESSION_TYPE"), + "wayland", + StringComparison.OrdinalIgnoreCase); +} From aafd8209aa1e86a7631d78039cba30c223f984d3 Mon Sep 17 00:00:00 2001 From: dreamsyntax Date: Sat, 25 Jul 2026 09:05:55 -0700 Subject: [PATCH 2/2] Flatpak: Wayland --- flatpak/io.github.hedge_dev.hedgemodmanager-autobuild.yml | 3 ++- flatpak/io.github.hedge_dev.hedgemodmanager.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/flatpak/io.github.hedge_dev.hedgemodmanager-autobuild.yml b/flatpak/io.github.hedge_dev.hedgemodmanager-autobuild.yml index a103dbb..f032c72 100644 --- a/flatpak/io.github.hedge_dev.hedgemodmanager-autobuild.yml +++ b/flatpak/io.github.hedge_dev.hedgemodmanager-autobuild.yml @@ -12,7 +12,8 @@ build-options: command: HedgeModManager.UI finish-args: - - --socket=x11 + - --socket=fallback-x11 + - --socket=wayland # UnleashedRecomp permissions - --filesystem=~/.config/UnleashedRecomp - --filesystem=~/.local/share/applications/UnleashedRecomp.desktop:ro diff --git a/flatpak/io.github.hedge_dev.hedgemodmanager.yml b/flatpak/io.github.hedge_dev.hedgemodmanager.yml index 1b06e01..1809060 100644 --- a/flatpak/io.github.hedge_dev.hedgemodmanager.yml +++ b/flatpak/io.github.hedge_dev.hedgemodmanager.yml @@ -12,7 +12,8 @@ build-options: command: HedgeModManager.UI finish-args: - - --socket=x11 + - --socket=fallback-x11 + - --socket=wayland # UnleashedRecomp permissions - --filesystem=~/.config/UnleashedRecomp - --filesystem=~/.local/share/applications/UnleashedRecomp.desktop:ro