From 73ac56ac8c2e59eda8875ab4866c611859f1fb2f Mon Sep 17 00:00:00 2001 From: Zaphhh Date: Mon, 27 Jan 2025 03:51:30 +0000 Subject: Use aot rather than self-contained + single-file and use Regex source gen over compiled regex --- hyprwatch.csproj | 4 ++-- src/GetWindows.cs | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hyprwatch.csproj b/hyprwatch.csproj index e230d2b..e4aab94 100644 --- a/hyprwatch.csproj +++ b/hyprwatch.csproj @@ -5,8 +5,8 @@ net8.0 enable enable - true - true + true + true linux-x64 diff --git a/src/GetWindows.cs b/src/GetWindows.cs index 3eeb81c..e110760 100644 --- a/src/GetWindows.cs +++ b/src/GetWindows.cs @@ -4,7 +4,7 @@ namespace hyprwatch.Window using System.Diagnostics; using System.Text.RegularExpressions; - public class GetWindows + public partial class GetWindows { public static string ActiveWindow() { @@ -28,7 +28,7 @@ namespace hyprwatch.Window string output = process.StandardOutput.ReadToEnd(); process.WaitForExit(); - var classMatch = Regex.Match(output, @"class:(.+)"); + var classMatch = ClassRegex().Match(output); if(classMatch.Success) { @@ -47,5 +47,8 @@ namespace hyprwatch.Window return activeWindow ?? string.Empty; } - } + + [GeneratedRegex(@"class:(.+)")] + private static partial Regex ClassRegex(); + } } -- cgit v1.1