@@ -55,25 +55,6 @@ guiActive := 0
5555;
5656firstlettermatch =
5757
58- ; set this to yes to enable activating the currently selected
59- ; window in the background
60- activateselectioninbg =
61-
62- ; number of milliseconds to wait for the user become idle, before
63- ; activating the currently selected window in the background
64- ;
65- ; it has no effect if activateselectioninbg is off
66- ;
67- ; if set to blank the current selection is activated immediately
68- ; without delay
69- bgactivationdelay = 300
70-
71-
72- ; Close switcher window if the user activates an other window.
73- ; It does not work well if activateselectioninbg is enabled, so
74- ; currently they cannot be enabled together.
75- closeifinactivated =
76-
7758selectedIndex := 1
7859
7960contentType := S.contentTypeAllWindows()
@@ -93,13 +74,6 @@ if S.useVirtualDesktops() = 1
9374 }
9475}
9576
96- if activateselectioninbg <>
97- if closeifinactivated <>
98- {
99- msgbox , activateselectioninbg and closeifinactivated cannot be enabled together
100- exitapp
101- }
102-
10377; List of subtsrings separated with pipe (|) characters (e.g. carpe|diem).
10478; Window titles containing any of the listed substrings are filtered out
10579; from the list of windows.
@@ -322,13 +296,16 @@ HotkeyAction:
322296 GoSub , UpdateGui
323297
324298 Loop
325- {
299+ {
300+ if guiActive = 0
301+ {
302+ break
303+ }
326304 Input , input , L1, {enter }{esc }{backspace }{up }{down }{pgup }{pgdn }{tab }{left }{right }
327305
328306 if ErrorLevel = EndKey:enter
329307 {
330308 GoSub , ActivateWindow
331-
332309 break
333310 }
334311
@@ -344,45 +321,35 @@ HotkeyAction:
344321 continue
345322 }
346323
347- if ErrorLevel = EndKey:tab
348- if completion =
349- continue
350- else
351- input = %completion%
352-
353- ; pass these keys to the selector window
354-
355324 if ErrorLevel = EndKey:up
356325 {
357326 Send , {up }
358- GoSuB ActivateWindowInBackgroundIfEnabled
359327 continue
360328 }
361329
362330 if ErrorLevel = EndKey:down
363331 {
364332 Send , {down }
365- GoSuB ActivateWindowInBackgroundIfEnabled
366333 continue
367334 }
368335
369336 if ErrorLevel = EndKey:pgup
370337 {
371338 Send , {pgup }
372-
373- GoSuB ActivateWindowInBackgroundIfEnabled
374339 continue
375340 }
376341
377342 if ErrorLevel = EndKey:pgdn
378343 {
379344 Send , {pgdn }
380- GoSuB ActivateWindowInBackgroundIfEnabled
381345 continue
382- }
383-
384- ; FIXME: probably other error level cases
385- ; should be handled here (interruption?)
346+ }
347+
348+ if ErrorLevel = EndKey:tab
349+ if completion =
350+ continue
351+ else
352+ input = %completion%
386353
387354 ; invoke digit shortcuts if applicable
388355 if S.digitShortcuts() <>
@@ -446,9 +413,6 @@ HotkeyAction:
446413 GoSub , RefreshWindowList
447414 }
448415 }
449-
450- Gosub , CleanExit
451-
452416return
453417
454418UpdateWindowArrays :
@@ -657,7 +621,6 @@ RefreshWindowList:
657621 if search =
658622 {
659623 Gui , cancel
660- Gosub , CleanExit
661624 }
662625 ; delete the last character
663626 else
@@ -697,12 +660,10 @@ RefreshWindowList:
697660 }
698661 }
699662 GoSub , ActivateWindow
700- Gosub , CleanExit
701663 }
702664 }
703665 }
704666
705- GoSub , ActivateWindowInBackgroundIfEnabled
706667 GoSub , CheckCompletion
707668
708669return
@@ -828,7 +789,6 @@ WaitForUserToEndTyping:
828789 if (A_TimeIdle > 100 ) {
829790 SetTimer , WaitForUserToEndTyping, Off
830791 GoSub , ActivateWindow
831- Gosub , CleanExit
832792 }
833793return
834794; ----------------------------------------------------------------------
@@ -920,7 +880,7 @@ return
920880#If
921881
922882#If guiActive = 1
923- F1 ::
883+ F1 ::
924884 if (contentType = S.contentTypeTrayIcons()) {
925885 contentType := S.contentTypeAllWindows()
926886 } else {
@@ -974,15 +934,6 @@ ActivateWindow:
974934 Sleep , 100
975935 Gui , Submit
976936 guiActive := 0
977- /*
978- WinGet, ID, List
979- Loop %ID%
980- {
981- WinActivate, ahk_id ID%A_Index%
982- winTools.moveMouseToCurrentWindowCenter()
983- break
984- }
985- */
986937 return
987938 }
988939
@@ -1016,70 +967,3 @@ ActivateWindow:
1016967 GoSub , HotkeyAction
1017968 }
1018969return
1019-
1020- ; ----------------------------------------------------------------------
1021- ;
1022- ; Activate selected window in the background
1023- ;
1024- ActivateWindowInBackground :
1025- guicontrolget , index,, ListView1
1026- window := filteredWindows.get(index)
1027- window_id := window.getHwnd()
1028-
1029- if prev_active_id <> %window_id%
1030- {
1031- WinActivate , ahk_id %window_id%
1032- WinActivate , ahk_id %switcher_id%
1033- prev_active_id = %window_id%
1034- }
1035-
1036- return
1037-
1038- ; ----------------------------------------------------------------------
1039- ;
1040- ; Activate selected window in the background if the option is enabled.
1041- ; If an activation delay is set then a timer is started instead of
1042- ; activating the window immediately.
1043- ;
1044- ActivateWindowInBackgroundIfEnabled :
1045-
1046- if activateselectioninbg =
1047- return
1048-
1049- ; Don't do it just after the switcher is activated. It is confusing
1050- ; if active window is changed immediately.
1051- WinGet , id , ID , ahk_id %switcher_id%
1052- if id =
1053- return
1054-
1055- if bgactivationdelay =
1056- GoSub ActivateWindowInBackground
1057- else
1058- settimer , BgActivationTimer, %bgactivationdelay%
1059-
1060- return
1061-
1062- ; ----------------------------------------------------------------------
1063- ;
1064- ; Check if the user is idle and if so activate the currently selected
1065- ; window in the background
1066- ;
1067- BgActivationTimer :
1068-
1069- settimer , BgActivationTimer, off
1070-
1071- GoSub ActivateWindowInBackground
1072-
1073- return
1074-
1075- ; ----------------------------------------------------------------------
1076- ;
1077- ; Stop background window activation timer if necessary and exit
1078- ;
1079- CleanExit :
1080-
1081- settimer , BgActivationTimer, off
1082-
1083- exit
1084-
1085-
0 commit comments