-
Notifications
You must be signed in to change notification settings - Fork 5
/
System Keys.ahk
130 lines (116 loc) · 3.69 KB
/
System Keys.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Unofficial Apple Wireless Keyboard Support ;;
;; http://code.google.com/p/uawks/ ;;
;; ;;
;; Version 2008.09.17 ;;
;; ;;
;; by Brian Jorgensen ;;
;; (based on work by Leon, Veil and Micha) ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; {Left Control} --> {Windows Key}
;$*LCtrl::PreferenceKeyDown("LCtrl", "RemapLeftControlToWindows", "Control Up}{LWin")
;$*LCtrl Up::PreferenceKeyUp("LCtrl", "RemapLeftControlToWindows", "LWin")
;;Alt-Shift -> Switch Layout
;$*!Space::
;Alt & Space::
; SetKeyDelay, -1
; Send {Alt Up}
; Send {Space Up}
; GetKeyState, state, Alt
; if state = D
; SoundBeep
; SendInput {Ctrl down}{Shift down}{Shift up}{Ctrl up}
; return
;; {Apple Command Key} --> {Control}
$*LWin::
;global
LWinVar := 1
SetKeyDelay, -1
Send {Blind}{LCtrl Down}
return
$*Space::
if LWinVar = 1
{
SetKeyDelay, -1
Send {Blind}{LCtrl Up}
LWinVar = 0
SendInput !{Space}
}
else
{
GetKeyState, state, Alt
if state = D
{
Send {Ctrl down}
Send {Ctrl up}
Send {Blind}{Alt Up}
SendInput {Ctrl down}{Shift down}{Shift up}{Ctrl up}
}
else
Send {Blind}{Space}
}
;SendInput {Raw}
;Send {Blind}{Space}
return
$*LWin Up::
SetKeyDelay, -1
Send {Blind}{LCtrl Up}
LWinVar := 0
return
;$LWin::PreferenceKeyDown("LWin", "RemapCommandToControl", "LCtrl")
;$LWin Up::PreferenceKeyUp("LWin", "RemapCommandToControl", "LCtrl")
$*RWin::PreferenceKeyDown("RWin", "RemapCommandToControl", "RCtrl")
$*RWin Up::PreferenceKeyUp("RWin", "RemapCommandToControl", "RCtrl")
;; Cmd-Space -> Alt-Space (to use app launchers like Launchy the same as Spotlight in mac, cause in Win7 we can't use Win-Space directly)
;$LWin Space::SendInput !{Space}
;#Space::SendInput !{Space}
;LWin & Space::SendInput !{Space}
;{LWin Down}{Space Down}{Space Up}{LWin}::SendInput !{Space}
;#Space::
;^Space::SendInput !{Space}
;; {Right Alt} --> {Apple Fn Key}
RAltFnKeyDown:
PreferenceKeyFnDown("{RAlt Down}", "RemapRightOptionToFn")
return
RAltFnKeyUp:
PreferenceKeyFnUp("{RAlt Up}", "RemapRightOptionToFn")
return
; Trying to fix problems with AltGr, mostly on european layouts
RAltFnKeyEnable() {
Hotkey, $*RAlt, RAltFnKeyDown, On UseErrorLevel
Hotkey, $*RAlt Up, RAltFnKeyUp, On UseErrorLevel
}
RAltFnKeyDisable() {
Hotkey, $*RAlt, Off, UseErrorLevel
Hotkey, $*RAlt Up, Off, UseErrorLevel
}
;; {Apple Fn Key}-{Backspace} --> {Forward Delete}
;$*Backspace::FnKey("{Backspace}", "{Delete}")
;; {Apple Fn Key}-{F3} --> {Print Screen}
$F3::FnKey("{F3 Down}", "", false)
$F3 Up::FnKey("{F3 Up}", "{PrintScreen}", false)
;; {Control}-{Alt}-{Backspace} --> Ctrl-Alt-Delete
#!Backspace::
^!Backspace::Run taskmgr.exe
;; {Capslock} --> {Control}
$*CapsLock::
SetKeyDelay, -1
if (RemapCapsLockToControl) {
Send, {Blind}{LWin Down}
} else {
if (GetKeyState("CapsLock", "T")) {
SetCapsLockState, Off
} else {
SetCapsLockState, On
}
KeyWait, CapsLock
}
Return
$*CapsLock Up::
SetKeyDelay, -1
if (RemapCapsLockToControl) {
Send, {Blind}{LWin Up}
}
Return