Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Ctrl+Tab when search box is focused #101

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions docs/ctrl-tab/quickey-ctrl-tab.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,20 @@ SetKeyDelay, -1, -1 ;
SetKeyDelay, -1, -1 ; No delay at all will occur after each keystroke sent by Send and ControlSend
SetWinDelay, 0 ; Changed to 0 upon recommendation of documentation

; Note that there's a \u200b after the `t' of `Microsoft'
BrowserName := "Google Chrome|Microsoft" . Chr(0x200b) . " Edge"

BrowserName := "Google Chrome|Edge"
DeveloperToolsWindowTitle := "Developer Tools"
TicksToToggleTab := 450
MinUpDownTicks := 200
OpenedTickCount := 0
SawCtrlTab := 0
ExcludedTitles := ["(Visual Studio Code|VSCodium)( - Insiders)?$"] ; Add patterns to this array to exclude other apps
ExcludedTitlePattern := ExcludedTitles[1]

; Build a string that OR's all the excluded title patterns
For Idx, Title in ExcludedTitles {
If (Idx > 1) {
ExcludedTitlePattern .= "|" . Title
}
}
; Add patterns to this continuation section (one pattern per line) to exclude other apps
ExcludedTitlePattern := "
( Join| Comments
(Visual Studio Code|VSCodium)( - Insiders)?$ ; VSCode / VSCodium
Developer Tools|DevTools ; Developer Tools
)"


IsChromiumBrowser()
Expand All @@ -49,11 +47,20 @@ HasPopupWindowSize()
}


; Check if active window is search box
IsSearchBox()
{
WinGetText, WinText, A

return !WinText
}


IsPopupActive()
{
global BrowserName, DeveloperToolsWindowTitle
global BrowserName

return IsChromiumBrowser() and !WinActive(BrowserName) and !WinActive(DeveloperToolsWindowTitle) and HasPopupWindowSize()
return IsChromiumBrowser() and !IsSearchBox() and !WinActive(BrowserName) and HasPopupWindowSize()
}


Expand All @@ -62,7 +69,7 @@ IsPopupActive()
; Ctrl+Tab
^Tab::
{
if WinActive(BrowserName) {
if WinActive(BrowserName) or IsSearchBox() {
SawCtrlTab := 1

Send !{q}
Expand Down Expand Up @@ -101,7 +108,7 @@ IsPopupActive()
; Ctrl+Shift+Tab
^+Tab::
{
if WinActive(BrowserName) {
if WinActive(BrowserName) or IsSearchBox() {
Send !{q}
OpenedTickCount := A_TickCount
} else {
Expand Down