aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjustmessingaround <69480361+DemonKingSwarn@users.noreply.github.com>2025-01-27 09:54:03 +0530
committerGitHub <noreply@github.com>2025-01-27 09:54:03 +0530
commitad2466175b8d13d330cf5ea752d702a32a788d55 (patch)
treea54a358745ddb7c71c5b62d1fb58fe21df70fe5b
parent8582d6d98f322ce58462e0931ab46ee0e9733033 (diff)
parent73ac56ac8c2e59eda8875ab4866c611859f1fb2f (diff)
downloadhypr-wellbeing-ad2466175b8d13d330cf5ea752d702a32a788d55.zip
hypr-wellbeing-ad2466175b8d13d330cf5ea752d702a32a788d55.tar.gz
Merge pull request #1 from Zaphhh/master
Switch to AOT and Source-Generated Regex
-rw-r--r--hyprwatch.csproj4
-rw-r--r--src/GetWindows.cs9
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 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
- <PublishSingleFile>true</PublishSingleFile>
- <SelfContained>true</SelfContained>
+ <PublishAot>true</PublishAot>
+ <IsAotCompatible>true</IsAotCompatible>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
</PropertyGroup>
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();
+ }
}