capslock-plus icon indicating copy to clipboard operation
capslock-plus copied to clipboard

To support multiple modifier keys?

Open 12425 opened this issue 5 years ago • 0 comments

For example, Caps+s means ,and Ctrl+← means one word to the left, while Ctrl+Caps+s is not equivalent to Ctrl+←. I tried adding a * which will make it work.

*Capslock::
*s::

I also made a minimal script that does the basic mapping. Single pressing Caps means Esc. E.g. Caps+Ctrl+l or Ctrl+Caps+l will go to the very end of page (Ctrl+End).

; caps.ahk

CapsState := 0
*Capslock::
  CapsState := 1
  KeyPressed := 0
  KeyWait, Capslock
  CapsState := 0
  If !KeyPressed
    SendInput {Esc}
  Return

#If CapsState
*a:: press("{Left}")
*d:: press("{Right}")
*w:: press("{Up}")
*s:: press("{Down}")

*h:: press("{Home}")
*l:: press("{End}")
*k:: press("{PgUp}")
*j:: press("{PgDn}")
#If

press(str) {
  global KeyPressed
  GetKeyState, state, Shift
  If (state = "D")
    str := "+" . str
  GetKeyState, state, Control
  If (state = "D")
    str := "^" . str
  SendInput %str%
  KeyPressed := 1
}

12425 avatar Jul 03 '20 06:07 12425