-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyckout.ahk
50 lines (40 loc) · 1.28 KB
/
keyckout.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
#Requires AutoHotkey v2
#Include "modules/UI.ahk"
#SingleInstance Ignore
TraySetIcon("Keyckout.ico")
Tray := A_TrayMenu
Tray.delete
Tray.add "Exit", (*) => ExitApp()
; Read settings
KeycoutSettingsManager := SettingsManager("settings.ini")
Settings := KeycoutSettingsManager.Load()
global Transparency := Settings["Transparency"]
global WaitingTime := Settings["WaitingTime"]
global UseDPIScale := Settings["UseDPIScale"]
global EnableDefault := Settings["EnableDefault"]
; Initialize GUI class
global PopupGUI := PopupWindow(Transparency, UseDPIScale)
; Hotkey for the Windows key
LWin::{
keyPressed := A_TickCount
global InputKeys := InputHook("M")
SetTimer PopupCallbackWrapper, -WaitingTime ; Wait before showing/updating the window
InputKeys.Start()
KeyWait "LWin"
SetTimer PopupCallbackWrapper, 0
if (A_TickCount - keyPressed < WaitingTime) {
AllKeys := InputKeys.Input
InputKeys.Stop()
SendInput("{LWin down}" . AllKeys . "{LWin up}") ; Send original keys
} else {
PopupGUI.Hide()
}
}
PopupCallbackWrapper() {
InputKeys.Stop()
ActiveWinTitle := WinGetTitle("A")
ActiveWinProc := WinGetProcessName("A")
OutputDebug ActiveWinTitle
OutputDebug ActiveWinProc
PopupGUI.Show(ActiveWinTitle, ActiveWinProc)
}