From 7fd2f731e790fa41f4dd897551e896079c13c776 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 25 Jun 2026 20:36:10 +0200 Subject: [PATCH] fix: apply target refresh rate to newly-enabled displays in staged mode Phase 2 of staged application only flipped the active/inactive path flags via ApplyDisplayTopology, without selecting a target mode. A monitor transitioning from disabled to enabled could therefore come up at whatever default refresh rate Windows picked (often 60Hz) instead of the rate stored in the profile. Explicitly call ChangeResolution for newly-enabled displays after Phase 2, mirroring what Phase 1 already does for already-active displays. Co-Authored-By: Claude Sonnet 4.6 --- src/Core/ProfileManager.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Core/ProfileManager.cs b/src/Core/ProfileManager.cs index 26be230..67ae5b2 100644 --- a/src/Core/ProfileManager.cs +++ b/src/Core/ProfileManager.cs @@ -863,6 +863,22 @@ private bool ApplyStagedConfiguration(List tc.IsEnabled && !phase1Configs.Any(p => p.TargetId == tc.TargetId && p.SourceId == tc.SourceId)) + .ToList(); + + foreach (var config in newlyEnabledConfigs) + { + logger.Debug($"Phase 2: Changing mode for newly-enabled {config.DeviceName} to {config.Width}x{config.Height}@{config.RefreshRate}Hz"); + if (!DisplayHelper.ChangeResolution(config.DeviceName, config.Width, config.Height, (int)config.RefreshRate)) + { + logger.Warn($"Phase 2: Failed to change resolution for newly-enabled display {config.DeviceName}."); + } + } + // Apply final positions for all monitors if (!DisplayConfigHelper.ApplyDisplayPosition(targetConfigs)) {