11using System . IO ;
22using System . Runtime . InteropServices ;
33using System . Threading ;
4+ using CommunityToolkit . Mvvm . DependencyInjection ;
45using Flow . Launcher . Infrastructure . Logger ;
6+ using Flow . Launcher . Infrastructure . UserSettings ;
57using Interop . UIAutomationClient ;
68using NHotkey ;
79using SHDocVw ;
@@ -17,6 +19,11 @@ public static class QuickSwitch
1719 {
1820 private static readonly string ClassName = nameof ( QuickSwitch ) ;
1921
22+ private static readonly Settings _settings = Ioc . Default . GetRequiredService < Settings > ( ) ;
23+
24+ // The class name of a dialog window is "#32770".
25+ private const string DialogWindowClassName = "#32770" ;
26+
2027 private static CUIAutomation8 _automation = new CUIAutomation8Class ( ) ;
2128
2229 private static InternetExplorer lastExplorerView = null ;
@@ -98,8 +105,8 @@ private static bool JumpToPath(string path)
98105 var t = new Thread ( ( ) =>
99106 {
100107 // Jump after flow launcher window vanished (after JumpAction returned true)
101- // and the dialog had been in the foreground. The class name of a dialog window is "#32770".
102- var timeOut = ! SpinWait . SpinUntil ( ( ) => GetForegroundWindowClassName ( ) == "#32770" , 1000 ) ;
108+ // and the dialog had been in the foreground.
109+ var timeOut = ! SpinWait . SpinUntil ( ( ) => GetForegroundWindowClassName ( ) == DialogWindowClassName , 1000 ) ;
103110 if ( timeOut )
104111 {
105112 return ;
@@ -150,10 +157,13 @@ uint dwmsEventTime
150157 return ;
151158 }
152159
153- if ( window is { CurrentClassName : "#32770" } )
160+ if ( _settings . AutoQuickSwitch )
154161 {
155- NavigateDialogPath ( ) ;
156- return ;
162+ if ( window is { CurrentClassName : DialogWindowClassName } )
163+ {
164+ NavigateDialogPath ( ) ;
165+ return ;
166+ }
157167 }
158168
159169 ShellWindowsClass shellWindows ;
0 commit comments