-
Notifications
You must be signed in to change notification settings - Fork 174
/
Hide&restore windows via ctrl+win and vice-versa-2.ahk
63 lines (55 loc) · 1.82 KB
/
Hide&restore windows via ctrl+win and vice-versa-2.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
global ArrayMinimisedID := [] ; â ýòîò ìàññèâ áóäóò çàïèñûâàòüñÿ âñå ìèíèìèçèðîâàííûå îêíà
global EVENT_SYSTEM_MINIMIZESTART := 0x16
global EVENT_SYSTEM_MINIMIZEEND := 0x17
; ñîçäà¸ì èçíà÷àëüíî îòêëþ÷¸ííóþ ãîðÿ÷óþ êëàâèøó LWin, êîòîðóþ áóäåì âêëþ÷àòü ïðè íåîáõîäèìîñòè.
Hotkey, *LWin, Win, Off
WinGet, List, List
Loop % List
{
WinGet, MinMax, MinMax, % "ahk_id" List%A_Index%
if MinMax = -1
ArrayMinimisedID.Insert(List%A_Index%)
}
; óñòàíàâëèâàåì õóê, îòñëåæèâàþùèé ñîáûòèÿ ìèíèìèçàöèè è âîññòàíîâëåíèÿ
; èíôîðìàöèÿ — http://msdn.microsoft.com/en-us/library/windows/desktop/dd373640%28v=vs.85%29.aspx
DllCall("SetWinEventHook", UInt, EVENT_SYSTEM_MINIMIZESTART
, UInt, EVENT_SYSTEM_MINIMIZEEND
, UInt, 0
, UInt, RegisterCallback("HookProc", "F")
, UInt, 0 , UInt, 0 , UInt, 0)
Return
HookProc(hWinEventHook, event, hwnd)
{
if (event = EVENT_SYSTEM_MINIMIZESTART)
ArrayMinimisedID.Insert(1, hwnd) ; ïðè ìèíèìèçàöèè êàêîãî-ë. îêíà çàïèñûâàåì åãî èäåíòèôèêàòîð â ìàññèâ
if (event = EVENT_SYSTEM_MINIMIZEEND) ; ïðè âîññòàíîâëåíèè êàêîãî-ë. îêíà èñêëþ÷àåì åãî èäåíòèôèêàòîð èç ìàññèâà
for k, v in ArrayMinimisedID
if (v = hwnd)
ArrayMinimisedID.Remove(k, k)
}
~*LCtrl::
if !GetKeyState("LWin", "P")
{
Hotkey, *LWin, On
Return
}
if !GetKeyState("LShift", "P")
{
WinGetClass, class, A
if !(class ~= "Progman|WorkerW|Shell_TrayWnd|Button")
WinMinimize, A
Return
}
~*LCtrl Up:: Hotkey, *LWin, Off
Win:
ID := ArrayMinimisedID.1
WinRestore, % "ahk_id " ID
WinActivate, % "ahk_id " ID
Return
; Win+` = äîáàâèòü/ñíÿòü àêòèâíîìó îêíó ìåòêó "ïîâåðõ âñåõ îêîí".
#`::Winset, Alwaysontop, , A
; Win+Shift+LCtrl = Win+D
#+LCtrl::Send, #d
; To do:
; Ìèäë-êëèê ïî îêíàì â òàñêáàðå çàêðûâàåò èõ, ìèäë êëèê ïî ïóñêó îòêðûâàåò îêíî çàâåðøåíèÿ ðàáîòû.
; Ïðîêðóòêà ââåðõ/âíèç íàä òàñêáàðîì - ïåðåêëþ÷àåò îêíà ââåðõ/âíèç.