-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcompose.ahk
103 lines (80 loc) · 4.86 KB
/
compose.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
#SingleInstance force
#NoEnv
#Persistent
Menu, Tray, Icon, compose.ico
disabled := false
;User settings
IniRead, SoundOnReset, %A_ScriptDir%\config.ini, Settings, SoundOnReset
IniRead, ModifierKey, %A_ScriptDir%\config.ini, Settings, ModifierKey
IniRead, UseCapslock, %A_ScriptDir%\config.ini, Settings, UseCapslock
IniRead, ResetDelay, %A_ScriptDir%\config.ini, Settings, ResetDelay
; Allows user to easily edit the settings
#Include %A_ScriptDir%\ini-editor.ahk
; Convert the 'human' key name to a AHK approved version!
key_map := {RAlt: "Right Alt", LAlt:"Left Alt", RControl: "Right Ctrl" , RWin: "Right Winkey" , LWin: "Left Winkey" , Esc: Escape , Insert: Insert, Numlock: "Num Lock", Tab: Tab, None: None}
for key, value in key_map {
if (value == ModifierKey) {
key_name := key
break
}
}
; Tell the user that compose-keys has loaded, and which modifier is active
TrayTip, Compose Keys, Compose Keys is now running...`nPress [ %ModifierKey% ] to start a new key sequence., 10, 1
Menu, Tray, Click, 1
Menu, Tray, NoStandard
; display the current modifier key at the top of the menu
Menu, Tray, Add, %ModifierKey%, ModifierKey
Menu, Tray, Disable, %ModifierKey%
Menu, Tray, Add, &Capslock, UseCapslock
Menu, Tray, Disable, &Capslock
if (UseCapslock == 1) {
Menu, Tray, Check, &Capslock
}
Menu, Tray, Add
Menu, Tray, Add, &Disable, DisableKey
Menu, Tray, Add, &Restart, MenuRestart
Menu, Tray, Add
Menu, Tray, Add, &Settings..., MenuSettings
Menu, Tray, Add, &Help, MenuHelp
Menu, Tray, Add, &About, MenuAbout
Menu, Tray, Add, E&xit, MenuExit
Menu, Tray, Default, &Help
Menu, Tray, Tip, Compose Keys : right-click for options.
Menu, Tray, Icon, compose.ico
; this is where the real action is!
; this loads all the compose key combinations
#Include %A_ScriptDir%\hotstring.ahk
return
ModifierKey:
;Void
return
UseCapslock:
;void
return
DisableKey:
global disabled
if (disabled == true) {
disabled := false
Menu, Tray, Uncheck, &Disable
Menu, Tray, Icon, compose.ico
} else {
disabled := true
Menu, Tray, Check, &Disable
Menu, Tray, Icon, compose2.ico
}
return
MenuRestart:
Reload
return
MenuSettings:
IniSettingsEditor("Compose", "config.ini")
return
MenuHelp:
Run, notepad.exe %A_ScriptDir%\help.txt
return
MenuAbout:
return
MenuExit:
ExitApp
return