From 275a3459b8acf025b7ada074b9e574b44927dbcf Mon Sep 17 00:00:00 2001 From: DemonKingSwarn Date: Sun, 26 Jan 2025 13:58:45 +0530 Subject: chore: Total Screen Usage added --- Program.cs | 15 +++++++++++++++ src/GetWindows.cs | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/Program.cs b/Program.cs index 5cd262a..340e338 100644 --- a/Program.cs +++ b/Program.cs @@ -46,12 +46,27 @@ class Program data[key] = value; } } + + TimeSpan totalTime = TimeSpan.Zero; + + foreach (var entry in data) + { + if (TimeSpan.TryParse(entry.Value, out TimeSpan time)) + { + totalTime += time; + } + } + + Console.WriteLine($"Today's Screen Usage\t{totalTime}"); + Console.WriteLine($"{red}{new string('-', 60)}{reset}"); Console.WriteLine($"{yellow}{"App",-30}{"Time",30}{reset}"); Console.WriteLine($"{red}{new string('-', 60)}{reset}"); + foreach (var entry in data) { Console.WriteLine($"{blue}{entry.Key,-30}{reset}{green}{entry.Value,30}{reset}"); } + } } diff --git a/src/GetWindows.cs b/src/GetWindows.cs index eafb117..3eeb81c 100644 --- a/src/GetWindows.cs +++ b/src/GetWindows.cs @@ -40,6 +40,11 @@ namespace hyprwatch.Window Console.WriteLine(ex.Message); } + if(activeWindow == null) + { + activeWindow = "Home-Screen"; + } + return activeWindow ?? string.Empty; } } -- cgit v1.1