From 72896810ac06f34d1b2bacefafbd2c38535352f2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 12 Jul 2026 12:11:15 +0000 Subject: [PATCH 1/6] Initial plan From 8f3119f5ee235f9d4e8c8f5c80586e3963e06966 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 12 Jul 2026 12:14:09 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=E3=82=AB=E3=82=BF=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=81=AB=E3=83=87=E3=82=B9=E3=82=AF=E3=83=88=E3=83=83=E3=83=97?= =?UTF-8?q?=E3=81=94=E3=81=A8=E3=81=AE=E3=82=A6=E3=82=A3=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=82=A6=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3=E3=82=92=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VdLabel/DesktopCatalog.xaml | 20 +++++++++ VdLabel/DesktopCatalogViewModel.cs | 22 ++++++++-- VdLabel/Program.cs | 6 ++- VdLabel/WindowIconCache.cs | 43 +++++++++++++++++++ VdLabel/WindowMonitor.cs | 66 +++++++++++++++++++++++------- 5 files changed, 138 insertions(+), 19 deletions(-) create mode 100644 VdLabel/WindowIconCache.cs diff --git a/VdLabel/DesktopCatalog.xaml b/VdLabel/DesktopCatalog.xaml index 63feb99..5310158 100644 --- a/VdLabel/DesktopCatalog.xaml +++ b/VdLabel/DesktopCatalog.xaml @@ -73,6 +73,26 @@ + + + + + + + + + + + + diff --git a/VdLabel/DesktopCatalogViewModel.cs b/VdLabel/DesktopCatalogViewModel.cs index a9e96a7..7967e02 100644 --- a/VdLabel/DesktopCatalogViewModel.cs +++ b/VdLabel/DesktopCatalogViewModel.cs @@ -1,5 +1,6 @@ using System.Windows; using System.Windows.Controls; +using System.Windows.Media; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; @@ -10,6 +11,8 @@ internal sealed partial class DesktopCatalogViewModel : ObservableObject, IDispo private readonly IVirualDesktopService virualDesktopService; private readonly ICommandService commandService; private readonly IConfigStore configStore; + private readonly IWindowMonitor windowMonitor; + private readonly IWindowIconCache windowIconCache; private readonly int maxColumns; [ObservableProperty] private IReadOnlyList desktops = []; @@ -28,13 +31,16 @@ internal sealed partial class DesktopCatalogViewModel : ObservableObject, IDispo [ObservableProperty] private double height; - public DesktopCatalogViewModel(IVirualDesktopService virualDesktopService, ICommandService commandService, IConfigStore configStore) + public DesktopCatalogViewModel(IVirualDesktopService virualDesktopService, ICommandService commandService, IConfigStore configStore, IWindowMonitor windowMonitor, IWindowIconCache windowIconCache) { this.virualDesktopService = virualDesktopService; this.commandService = commandService; this.configStore = configStore; + this.windowMonitor = windowMonitor; + this.windowIconCache = windowIconCache; this.configStore.Saved += ConfigStore_Saved; this.commandService.BadgeResultsUpdated += CommandService_BadgeResultsUpdated; + this.windowMonitor.DesktopWindowsChanged += WindowMonitor_DesktopWindowsChanged; this.maxColumns = (int)(SystemParameters.PrimaryScreenWidth * 0.8 / 280); Setup(); } @@ -69,7 +75,11 @@ private async void Setup() var cached = this.commandService.GetBadgeResult(b.Id, c.Id); return cached ?? new ResolvedBadge(b.Label, b.Color); }); - return new DesktopViewModel(i + 1, c, commandLabel, wallpaperPath, pos, resolvedBadges, ToggleBadgeAsync); + var windowIcons = this.windowMonitor.GetDesktopWindows(c.Id) + .Select(this.windowIconCache.Get) + .OfType() + .ToArray(); + return new DesktopViewModel(i + 1, c, commandLabel, wallpaperPath, pos, resolvedBadges, windowIcons, ToggleBadgeAsync); }) .ToArray(); var currentDesktop = this.virualDesktopService.GetCurrent(); @@ -101,10 +111,14 @@ private void ConfigStore_Saved(object? sender, EventArgs e) private void CommandService_BadgeResultsUpdated(object? sender, EventArgs e) => System.Windows.Application.Current.Dispatcher.BeginInvoke(Setup); + private void WindowMonitor_DesktopWindowsChanged(object? sender, EventArgs e) + => System.Windows.Application.Current.Dispatcher.BeginInvoke(Setup); + public void Dispose() { this.configStore.Saved -= ConfigStore_Saved; this.commandService.BadgeResultsUpdated -= CommandService_BadgeResultsUpdated; + this.windowMonitor.DesktopWindowsChanged -= WindowMonitor_DesktopWindowsChanged; } partial void OnSelectedDesktopChanged(DesktopViewModel? value) @@ -121,7 +135,7 @@ partial void OnLeftChanged(double value) => this.Left = (SystemParameters.PrimaryScreenWidth - this.Width) / 2; } -internal class DesktopViewModel(int index, DesktopConfig desktopConfig, string? commandLabel, string? wallpaperPath, Dock pos, IReadOnlyDictionary resolvedBadges, Func toggleBadge) +internal class DesktopViewModel(int index, DesktopConfig desktopConfig, string? commandLabel, string? wallpaperPath, Dock pos, IReadOnlyDictionary resolvedBadges, IReadOnlyList windowIcons, Func toggleBadge) { private readonly int index = index; private DesktopConfig desktopConfig = desktopConfig; @@ -141,6 +155,8 @@ internal class DesktopViewModel(int index, DesktopConfig desktopConfig, string? .Select(id => resolvedBadges[id]) .ToArray(); + public IReadOnlyList WindowIcons { get; } = windowIcons; + public IReadOnlyList BadgeMenuItems { get; } = resolvedBadges .Select(kvp => new BadgeMenuItem(kvp.Key, kvp.Value, desktopConfig.Id, desktopConfig.BadgeIds.Contains(kvp.Key), toggleBadge)) .ToArray(); diff --git a/VdLabel/Program.cs b/VdLabel/Program.cs index 44b1f51..4df84b2 100644 --- a/VdLabel/Program.cs +++ b/VdLabel/Program.cs @@ -15,12 +15,16 @@ .AddSingleton() .AddSingleton() .AddSingleton() + .AddSingleton() + .AddSingleton() .AddHostedService(sp => sp.GetRequiredService()) .AddHostedService(sp => sp.GetRequiredService()) .AddHostedService(sp => sp.GetRequiredService()) - .AddHostedService() + .AddHostedService(sp => sp.GetRequiredService()) .AddSingleton(sp => sp.GetRequiredService()) .AddSingleton(sp => sp.GetRequiredService()) + .AddSingleton(sp => sp.GetRequiredService()) + .AddSingleton(sp => sp.GetRequiredService()) .AddSingleton(sp => sp.GetRequiredService()) .AddSingleton() .AddSingleton() diff --git a/VdLabel/WindowIconCache.cs b/VdLabel/WindowIconCache.cs new file mode 100644 index 0000000..b0d40cc --- /dev/null +++ b/VdLabel/WindowIconCache.cs @@ -0,0 +1,43 @@ +using System.Collections.Concurrent; +using System.Drawing; +using System.Windows; +using System.Windows.Interop; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +namespace VdLabel; + +interface IWindowIconCache +{ + ImageSource? Get(string processPath); +} + +sealed class WindowIconCache : IWindowIconCache +{ + private readonly ConcurrentDictionary> icons = new(StringComparer.OrdinalIgnoreCase); + + public ImageSource? Get(string processPath) + => this.icons.GetOrAdd(processPath, static path => new(() => Extract(path))).Value; + + private static ImageSource? Extract(string processPath) + { + try + { + using var icon = Icon.ExtractAssociatedIcon(processPath); + if (icon is null) + { + return null; + } + var source = Imaging.CreateBitmapSourceFromHIcon( + icon.Handle, + Int32Rect.Empty, + BitmapSizeOptions.FromWidthAndHeight(24, 24)); + source.Freeze(); + return source; + } + catch (Exception) + { + return null; + } + } +} diff --git a/VdLabel/WindowMonitor.cs b/VdLabel/WindowMonitor.cs index 3b3fad2..7cfb2da 100644 --- a/VdLabel/WindowMonitor.cs +++ b/VdLabel/WindowMonitor.cs @@ -7,16 +7,22 @@ using static VdLabel.ProcessUtility; namespace VdLabel; -class WindowMonitor(ILogger logger, IConfigStore configStore) : BackgroundService +class WindowMonitor(ILogger logger, IConfigStore configStore) : BackgroundService, IWindowMonitor { private readonly ILogger logger = logger; private readonly IConfigStore configStore = configStore; private readonly Dictionary checkedWindows = []; private bool needReload = true; private TargetWindow[] targetWindows = []; + private IReadOnlyDictionary> desktopWindows = new Dictionary>(); private record TargetWindow(Guid DesktopId, WindowMatchType MatchType, Regex Regex); + public event EventHandler? DesktopWindowsChanged; + + public IReadOnlyList GetDesktopWindows(Guid desktopId) + => this.desktopWindows.TryGetValue(desktopId, out var windows) ? windows : []; + protected override async Task ExecuteAsync(CancellationToken stoppingToken) { var timer = new PeriodicTimer(TimeSpan.FromSeconds(1)); @@ -67,11 +73,8 @@ private void CheckWindows() { var now = DateTime.Now; this.logger.LogDebug("ウィンドウチェック開始"); - if (this.targetWindows.Length == 0) - { - return; - } var windows = new HashSet(); + var desktopWindows = new Dictionary>(); User32.EnumWindows((hWnd, lParam) => { windows.Add(hWnd); @@ -93,6 +96,27 @@ private void CheckWindows() return true; } + if (VirtualDesktop.FromHwnd(hWnd) is not { } desktop) + { + return true; + } + + if (GetProcessPath(processId) is not { } path) + { + return true; + } + if (!desktopWindows.TryGetValue(desktop.Id, out var processPaths)) + { + processPaths = []; + desktopWindows.Add(desktop.Id, processPaths); + } + processPaths.Add(path); + + if (this.targetWindows.Length == 0) + { + return true; + } + // ウィンドウタイトルが取得できない場合はスキップ if (GetWindowTitle(hWnd) is not { } windowTitle) { @@ -106,12 +130,6 @@ private void CheckWindows() } // ウィンドウが所属するプロセスのパスが取得できない場合はスキップ - if (GetProcessPath(processId) is not { } path) - { - this.checkedWindows[hWnd] = windowTitle; - return true; - } - // ウィンドウが所属するプロセスのコマンドラインが取得できない場合はスキップ if (GetCommandLine(processId) is not { } commandLine) { @@ -135,12 +153,12 @@ private void CheckWindows() VirtualDesktop.PinWindow(hWnd); } } - else if (VirtualDesktop.FromId(target.DesktopId) is { } desktop) + else if (VirtualDesktop.FromId(target.DesktopId) is { } targetDesktop) { - if (VirtualDesktop.FromHwnd(hWnd)?.Id != desktop.Id) + if (VirtualDesktop.FromHwnd(hWnd)?.Id != targetDesktop.Id) { - this.logger.LogDebug($"ウィンドウ検出: {windowTitle} to {desktop.Name}"); - VirtualDesktop.MoveToDesktop(hWnd, desktop); + this.logger.LogDebug($"ウィンドウ検出: {windowTitle} to {targetDesktop.Name}"); + VirtualDesktop.MoveToDesktop(hWnd, targetDesktop); } } @@ -159,9 +177,21 @@ private void CheckWindows() { this.checkedWindows.Remove(hWnd); } + var newDesktopWindows = desktopWindows.ToDictionary( + pair => pair.Key, + pair => (IReadOnlyList)pair.Value.ToArray()); + if (!DesktopWindowsEqual(this.desktopWindows, newDesktopWindows)) + { + this.desktopWindows = newDesktopWindows; + this.DesktopWindowsChanged?.Invoke(this, EventArgs.Empty); + } this.logger.LogDebug($"ウィンドウチェック終了: {DateTime.Now - now}"); } + private static bool DesktopWindowsEqual(IReadOnlyDictionary> left, IReadOnlyDictionary> right) + => left.Count == right.Count + && left.All(pair => right.TryGetValue(pair.Key, out var windows) && pair.Value.SequenceEqual(windows, StringComparer.OrdinalIgnoreCase)); + private static string GetCheckText(WindowMatchType type, string path, string commandLine, string windowTitle) => type switch { @@ -171,3 +201,9 @@ private static string GetCheckText(WindowMatchType type, string path, string com _ => string.Empty, }; } + +interface IWindowMonitor +{ + event EventHandler? DesktopWindowsChanged; + IReadOnlyList GetDesktopWindows(Guid desktopId); +} From af8dca58cdf34d247802f3204937d0f2de5b9ab0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 12 Jul 2026 12:41:57 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=E3=82=A6=E3=82=A3=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=82=A6=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3=E3=82=92=E7=94=BB?= =?UTF-8?q?=E5=83=8F=E4=B8=8B=E9=83=A8=E3=81=B8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VdLabel/DesktopCatalog.xaml | 55 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/VdLabel/DesktopCatalog.xaml b/VdLabel/DesktopCatalog.xaml index 5310158..d2279b6 100644 --- a/VdLabel/DesktopCatalog.xaml +++ b/VdLabel/DesktopCatalog.xaml @@ -62,37 +62,34 @@ CornerRadius="8" Focusable="False" Source="{Binding ImagePath, Converter={StaticResource filePathToImageConv}}" /> - - - - - - - - - - - - - - - - - - - + VerticalAlignment="Bottom"> + + + + + + + + + + + + + + + + + + + + From 065257b394ddb2c38cf0830ec9b8d122d47f61f6 Mon Sep 17 00:00:00 2001 From: Freesia Date: Mon, 13 Jul 2026 23:30:57 +0900 Subject: [PATCH 4/6] =?UTF-8?q?=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VdLabel/DesktopCatalog.xaml | 51 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/VdLabel/DesktopCatalog.xaml b/VdLabel/DesktopCatalog.xaml index d2279b6..4304908 100644 --- a/VdLabel/DesktopCatalog.xaml +++ b/VdLabel/DesktopCatalog.xaml @@ -57,39 +57,38 @@ Text="{Binding Label}" TextTrimming="CharacterEllipsis" TextWrapping="Wrap" /> + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + VerticalAlignment="Bottom" + ItemsSource="{Binding AssignedBadges}"> + + + + + + From 5cbc427a769e94dd9c68d03f7e360980e33472e5 Mon Sep 17 00:00:00 2001 From: Freesia Date: Mon, 13 Jul 2026 23:51:58 +0900 Subject: [PATCH 5/6] =?UTF-8?q?=E7=B4=B0=E3=81=8B=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VdLabel/DesktopCatalog.xaml | 7 +++++-- VdLabel/WindowIconCache.cs | 2 +- VdLabel/WindowMonitor.cs | 21 ++++++++++----------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/VdLabel/DesktopCatalog.xaml b/VdLabel/DesktopCatalog.xaml index 4304908..4395d47 100644 --- a/VdLabel/DesktopCatalog.xaml +++ b/VdLabel/DesktopCatalog.xaml @@ -50,14 +50,17 @@ - + diff --git a/VdLabel/WindowIconCache.cs b/VdLabel/WindowIconCache.cs index b0d40cc..15504e7 100644 --- a/VdLabel/WindowIconCache.cs +++ b/VdLabel/WindowIconCache.cs @@ -31,7 +31,7 @@ sealed class WindowIconCache : IWindowIconCache var source = Imaging.CreateBitmapSourceFromHIcon( icon.Handle, Int32Rect.Empty, - BitmapSizeOptions.FromWidthAndHeight(24, 24)); + BitmapSizeOptions.FromWidthAndHeight(64, 64)); source.Freeze(); return source; } diff --git a/VdLabel/WindowMonitor.cs b/VdLabel/WindowMonitor.cs index 7cfb2da..f7eaa20 100644 --- a/VdLabel/WindowMonitor.cs +++ b/VdLabel/WindowMonitor.cs @@ -3,18 +3,19 @@ using PInvoke; using System.Text.RegularExpressions; using WindowsDesktop; -using static Windows.Win32.PInvoke; using static VdLabel.ProcessUtility; namespace VdLabel; -class WindowMonitor(ILogger logger, IConfigStore configStore) : BackgroundService, IWindowMonitor + +class WindowMonitor(ILogger logger, IConfigStore configStore, App app) : BackgroundService, IWindowMonitor { private readonly ILogger logger = logger; private readonly IConfigStore configStore = configStore; + private readonly App app = app; private readonly Dictionary checkedWindows = []; private bool needReload = true; private TargetWindow[] targetWindows = []; - private IReadOnlyDictionary> desktopWindows = new Dictionary>(); + private Dictionary> desktopWindows = []; private record TargetWindow(Guid DesktopId, WindowMatchType MatchType, Regex Regex); @@ -29,6 +30,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) this.logger.LogInformation("ウィンドウ監視開始"); await ReloadTargetProcess().ConfigureAwait(false); this.configStore.Saved += ConfigStore_Saved; + await this.app.WaitForStartupAsync().ConfigureAwait(false); while (!stoppingToken.IsCancellationRequested) { @@ -96,12 +98,12 @@ private void CheckWindows() return true; } - if (VirtualDesktop.FromHwnd(hWnd) is not { } desktop) + if (GetProcessPath(processId) is not { } path) { return true; } - if (GetProcessPath(processId) is not { } path) + if (VirtualDesktop.FromHwnd(hWnd) is not { } desktop) { return true; } @@ -177,18 +179,15 @@ private void CheckWindows() { this.checkedWindows.Remove(hWnd); } - var newDesktopWindows = desktopWindows.ToDictionary( - pair => pair.Key, - pair => (IReadOnlyList)pair.Value.ToArray()); - if (!DesktopWindowsEqual(this.desktopWindows, newDesktopWindows)) + if (!DesktopWindowsEqual(this.desktopWindows, desktopWindows)) { - this.desktopWindows = newDesktopWindows; + this.desktopWindows = desktopWindows; this.DesktopWindowsChanged?.Invoke(this, EventArgs.Empty); } this.logger.LogDebug($"ウィンドウチェック終了: {DateTime.Now - now}"); } - private static bool DesktopWindowsEqual(IReadOnlyDictionary> left, IReadOnlyDictionary> right) + private static bool DesktopWindowsEqual(Dictionary> left, Dictionary> right) => left.Count == right.Count && left.All(pair => right.TryGetValue(pair.Key, out var windows) && pair.Value.SequenceEqual(windows, StringComparer.OrdinalIgnoreCase)); From 81d5f04e2e3cd7974f597d0524181325829d6718 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 13 Jul 2026 14:52:09 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=E3=82=AB=E3=82=BF=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=81=AE=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3=E8=BF=BD=E5=BE=93?= =?UTF-8?q?=E3=82=92=E5=BB=83=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VdLabel/DesktopCatalogViewModel.cs | 5 ----- VdLabel/Program.cs | 3 +-- VdLabel/WindowMonitor.cs | 13 +------------ 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/VdLabel/DesktopCatalogViewModel.cs b/VdLabel/DesktopCatalogViewModel.cs index 7967e02..7005557 100644 --- a/VdLabel/DesktopCatalogViewModel.cs +++ b/VdLabel/DesktopCatalogViewModel.cs @@ -40,7 +40,6 @@ public DesktopCatalogViewModel(IVirualDesktopService virualDesktopService, IComm this.windowIconCache = windowIconCache; this.configStore.Saved += ConfigStore_Saved; this.commandService.BadgeResultsUpdated += CommandService_BadgeResultsUpdated; - this.windowMonitor.DesktopWindowsChanged += WindowMonitor_DesktopWindowsChanged; this.maxColumns = (int)(SystemParameters.PrimaryScreenWidth * 0.8 / 280); Setup(); } @@ -111,14 +110,10 @@ private void ConfigStore_Saved(object? sender, EventArgs e) private void CommandService_BadgeResultsUpdated(object? sender, EventArgs e) => System.Windows.Application.Current.Dispatcher.BeginInvoke(Setup); - private void WindowMonitor_DesktopWindowsChanged(object? sender, EventArgs e) - => System.Windows.Application.Current.Dispatcher.BeginInvoke(Setup); - public void Dispose() { this.configStore.Saved -= ConfigStore_Saved; this.commandService.BadgeResultsUpdated -= CommandService_BadgeResultsUpdated; - this.windowMonitor.DesktopWindowsChanged -= WindowMonitor_DesktopWindowsChanged; } partial void OnSelectedDesktopChanged(DesktopViewModel? value) diff --git a/VdLabel/Program.cs b/VdLabel/Program.cs index 4df84b2..6411b0a 100644 --- a/VdLabel/Program.cs +++ b/VdLabel/Program.cs @@ -16,7 +16,6 @@ .AddSingleton() .AddSingleton() .AddSingleton() - .AddSingleton() .AddHostedService(sp => sp.GetRequiredService()) .AddHostedService(sp => sp.GetRequiredService()) .AddHostedService(sp => sp.GetRequiredService()) @@ -24,7 +23,7 @@ .AddSingleton(sp => sp.GetRequiredService()) .AddSingleton(sp => sp.GetRequiredService()) .AddSingleton(sp => sp.GetRequiredService()) - .AddSingleton(sp => sp.GetRequiredService()) + .AddSingleton() .AddSingleton(sp => sp.GetRequiredService()) .AddSingleton() .AddSingleton() diff --git a/VdLabel/WindowMonitor.cs b/VdLabel/WindowMonitor.cs index f7eaa20..9af0cff 100644 --- a/VdLabel/WindowMonitor.cs +++ b/VdLabel/WindowMonitor.cs @@ -19,8 +19,6 @@ class WindowMonitor(ILogger logger, IConfigStore configStore, App private record TargetWindow(Guid DesktopId, WindowMatchType MatchType, Regex Regex); - public event EventHandler? DesktopWindowsChanged; - public IReadOnlyList GetDesktopWindows(Guid desktopId) => this.desktopWindows.TryGetValue(desktopId, out var windows) ? windows : []; @@ -179,18 +177,10 @@ private void CheckWindows() { this.checkedWindows.Remove(hWnd); } - if (!DesktopWindowsEqual(this.desktopWindows, desktopWindows)) - { - this.desktopWindows = desktopWindows; - this.DesktopWindowsChanged?.Invoke(this, EventArgs.Empty); - } + this.desktopWindows = desktopWindows; this.logger.LogDebug($"ウィンドウチェック終了: {DateTime.Now - now}"); } - private static bool DesktopWindowsEqual(Dictionary> left, Dictionary> right) - => left.Count == right.Count - && left.All(pair => right.TryGetValue(pair.Key, out var windows) && pair.Value.SequenceEqual(windows, StringComparer.OrdinalIgnoreCase)); - private static string GetCheckText(WindowMatchType type, string path, string commandLine, string windowTitle) => type switch { @@ -203,6 +193,5 @@ private static string GetCheckText(WindowMatchType type, string path, string com interface IWindowMonitor { - event EventHandler? DesktopWindowsChanged; IReadOnlyList GetDesktopWindows(Guid desktopId); }