-
Notifications
You must be signed in to change notification settings - Fork 0
/
chrome-ctrl+tab.ahk
130 lines (102 loc) · 2.45 KB
/
chrome-ctrl+tab.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#NoEnv ;
SetBatchLines, -1 ; Script will never sleep
ListLines Off ; Omits subsequently-executed lines from the history
#KeyHistory 0 ; Disable key history
SendMode Input ; Recommended for new scripts due to its superior speed and reliability
SetTitleMatchMode 2 ;
SetTitleMatchMode Fast ;
SetKeyDelay, -1, -1 ;
#SingleInstance force ; Skips the dialog box and replaces the old instance automatically
#NoTrayIcon ; Hide the tray icon
#MaxMem 1 ; Maximum memory per variable - 1MB
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
WindowTitle := "Google Chrome"
DeveloperToolsWindowTitle := "Developer Tools"
TicksToOpenPopup := 300
OpenedTickCount := 0
NeedToMovePrev := false
HasPopupWindowSize()
{
Width := 0
WinGetPos, , , Width, , A
return Width between 430 and 440
}
#IfWinActive ahk_exe Chrome.exe
; Ctrl+Tab
^Tab::
{
NeedToMovePrev := false
IfWinActive % WindowTitle
{
Send ^+{s}
OpenedTickCount := A_TickCount
}
else
{
Send ^{Down}
}
return
}
; Ctrl+Shift+Tab
^+Tab::
{
IfWinActive % WindowTitle
{
Send ^+{s}
NeedToMovePrev := true
OpenedTickCount := A_TickCount
}
else
{
NeedToMovePrev := false
Send ^{Up}
}
return
}
; Ctrl keyup
~Ctrl Up::
{
TicksToSleep := TicksToOpenPopup + OpenedTickCount - A_TickCount
if (TicksToSleep > 0)
{
Sleep TicksToSleep
}
if WinActive("ahk_class Chrome_WidgetWin_1") and !WinActive(WindowTitle) and !WinActive(DeveloperToolsWindowTitle) and HasPopupWindowSize()
{
if NeedToMovePrev
{
Send ^{Up}
Sleep 50
}
Send {Enter}
}
return
}
#IfWinActive
#If WinActive("ahk_exe Chrome.exe") and WinActive("ahk_class Chrome_WidgetWin_1") and !WinActive(WindowTitle) and !WinActive(DeveloperToolsWindowTitle) and HasPopupWindowSize()
; Ctrl+Right, Ctrl+Shift+Right, Ctrl+Shift+Down
^Right::
^+Right::
^+Down::
{
NeedToMovePrev := false
Send ^{Down}
return
}
; Ctrl+Left, Ctrl+Shift+Left, Ctrl+Shift+Up
^Left::
^+Left::
^+Up::
{
NeedToMovePrev := false
Send ^{Up}
return
}
; Ctrl+Esc
^Esc::
{
Send {Esc}
return
}
#If