-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
main.ahk
95 lines (88 loc) · 2.05 KB
/
main.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
#Requires AutoHotkey v2.0
#NoTrayIcon
#MaxThreadsPerHotkey 1
VNT := 0
#include *i compile_prop.ahk
#Include ./web_gui/Neutron.ahk
;@Ahk2Exe-AddResource *10 %A_ScriptDir%\html\index.html
#include *i setting.ahk
#include meta.ahk
block := 0
InHook := InputHook("M L16")
if VNT == 1 {
InHook.VisibleNonText := True
title := "iwck*"
} else {
InHook.VisibleNonText := False
title := "iwck"
}
dpiScale := A_ScreenDPI / 96
winW := dpiScale * 350
winH := dpiScale * 247
if A_IsCompiled {
path := "index.html"
} else {
path := "./html/index.html"
}
neutron := NeutronWindow().Load(path)
.Opt("-Resize")
.OnEvent("Close", (neutron) => ExitApp())
.Show("w" winW " h" winH, "iwck")
neutron.qs(".ver>span#ahk").innerHTML := "ahk" A_AhkVersion
neutron.qs(".ver>span#ahk").classList.add("hidden")
ver := "v" version
if VNT == 1 {
ver .= " VNT"
}
neutron.qs(".ver>span#iwck").innerHTML := ver
neutron.qs("html").setAttribute("style", "font-size:" Round(A_ScreenDPI * 100 / 192) "px")
if VNT == 1 {
neutron.qs("div#vnt").classList.remove("hidden")
}
return
Clicked(neutron, event) {
; MsgBox "You clicked: " event.target.id
global
if StrCompare(event.target.id, "btn_block") == 0 {
if (block != 1) {
block := 1
neutron.qs("button#btn_block").classList.remove("unlocked")
neutron.qs("button#btn_block").classList.add("locked")
neutron.qs(".circles").classList.remove("unlocked")
neutron.qs(".circles").classList.add("locked")
SetTimer blockKeyboard, -1
} Else {
block := 0
neutron.qs("button#btn_block").classList.remove("locked")
neutron.qs("button#btn_block").classList.add("unlocked")
neutron.qs(".circles").classList.remove("locked")
neutron.qs(".circles").classList.add("unlocked")
InHook.Stop()
}
}
}
blockKeyboard() {
global block, InHook
loop {
InHook.Start()
InHook.Wait()
if (!block) {
Return
}
}
}
#HotIf block == 1
LWin:: Return
RWin:: Return
*CapsLock:: Return
PrintScreen:: Return
Sleep:: Return
Tab:: Return
CapsLock:: Return
LShift:: Return
RShift:: Return
LCtrl:: Return
RCtrl:: Return
LAlt:: Return
RAlt:: Return
#HotIf