-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransparentWindowController.ahk
More file actions
91 lines (81 loc) · 2.52 KB
/
TransparentWindowController.ahk
File metadata and controls
91 lines (81 loc) · 2.52 KB
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
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
; Initial settings
winID := "" ; Will hold window ID
transparencyLevel := 180 ; Initial transparency level
transparencyStep := 10
; Ctrl+Alt+S — select window under cursor
^!s::
MouseGetPos,,, winID
if (!winID) {
MsgBox, Could not get window under cursor!
return
}
WinGetTitle, selectedTitle, ahk_id %winID%
ToolTip, Selected window:`n%selectedTitle%
SetTimer, RemoveToolTip, -500
return
; Ctrl+Alt+T — toggle transparency and click-through
^!t::
if (!winID) {
MsgBox, Please select a window first with Ctrl+Alt+S!
return
}
if !WinExist("ahk_id " . winID) {
MsgBox, Selected window no longer exists!
return
}
WinGet, ExStyle, ExStyle, ahk_id %winID%
MouseTransparentOn := ExStyle & 0x20
if (MouseTransparentOn) {
WinSet, Transparent, OFF, ahk_id %winID%
WinSet, ExStyle, -0x20, ahk_id %winID%
WinSet, AlwaysOnTop, OFF, ahk_id %winID%
; ToolTip, Transparency OFF
} else {
WinSet, Transparent, %transparencyLevel%, ahk_id %winID%
WinSet, ExStyle, +0x20, ahk_id %winID%
WinSet, AlwaysOnTop, ON, ahk_id %winID%
; ToolTip, Transparency ON (%transparencyLevel%)
}
SetTimer, RemoveToolTip, -500
return
; Ctrl+Alt+Up — increase transparency
^!Up::
if (!winID) {
MsgBox, Please select a window first with Ctrl+Alt+S!
return
}
transparencyLevel += transparencyStep
if (transparencyLevel > 255)
transparencyLevel := 255
if WinExist("ahk_id " . winID)
WinSet, Transparent, %transparencyLevel%, ahk_id %winID%
; ToolTip, Transparency increased: %transparencyLevel%
; SetTimer, RemoveToolTip, -500
return
; Ctrl+Alt+Down — decrease transparency
^!Down::
if (!winID) {
MsgBox, Please select a window first with Ctrl+Alt+S!
return
}
transparencyLevel -= transparencyStep
if (transparencyLevel < 0)
transparencyLevel := 0
if WinExist("ahk_id " . winID)
WinSet, Transparent, %transparencyLevel%, ahk_id %winID%
; ToolTip, Transparency decreased: %transparencyLevel%
; SetTimer, RemoveToolTip, -500
return
RemoveToolTip:
ToolTip
return
; Ctrl+Alt+W — show title of active window
^!w::
WinGetTitle, currentTitle, A
ToolTip, Active window:`n%currentTitle%
SetTimer, RemoveToolTip, -500
return