(solved) fine-tuning sticky keys

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
cajhin
Posts: 1
Joined: 25 Aug 2017, 12:56

(solved) fine-tuning sticky keys

25 Aug 2017, 13:50

Writing this post and reading it helped me see clearer, then I solved it myself.
It was quite difficult, I tried several approaches, so I post the solution for the search engine.
(sticky key, dead key, control, modifier, quick tapping, key order)

The problem: using one special key (CapsLock) BOTH as a modifier and a sticky key.
Case 1, modifier: Caps-down, KeyB-down, KeyB-up, Caps-up (results in page-Up in my config)
Case 2, sticky: Caps-down, Caps-up, KeyB-down, KeyB-up (results in 'ö' in my config)

My issue was fast typing with the sticky key, often resulting in
Case 3: Caps-down, KeyB-down, Caps-up, KeyB-up

This (Caps-down, KeyB-down) immediately triggered Case 1. I wanted it to trigger Case 2 instead.

Easy solution: wait for KeyB-up and decide

Code: Select all

;catch fast typed sticky ö
Capslock & o::
{
  Keywait, o, U T0.3
  GetKeyState, state, Capslock, P
  if state = D
    Sendj("{PageUp}")
  else
    Send ö
  return
}
BUT, this killed fast repeat of PageUp (I often fly through huge log files).

Solution with auto-repeat restored:

Code: Select all

;catch AvBvA^B^ order, and still allow fast repeating pageUp
repeatingMode := false
Capslock & o Up::repeatingMode:=false
Capslock & o::
{
  if (!repeatingMode)
  {
    Keywait, o, U T0.3
    GetKeyState, capsKeystate, Capslock, P
    if capsKeystate = U
    {
      Send ö
      return
    }
  }
  repeatingMode:=true
  Sendj("{PgUp}")
  return
}


---------------------------------------------
[original post]

Hi hackers
I've been using AHK for a long time to give me extra keyboard functions. Love it. Can't live without it.

My basic config:
hold CapsLock => cursor control layer
tap CapsLock => special characters layer

My issue is this:

Code: Select all

<caps>..</caps>....<O>....</O>
maps to an Ö character, while

Code: Select all

<caps>......<O>..</O>....</caps>
maps to Page-Up

When I type fast, typing "Jö" often comes out as

Code: Select all

<J>..<caps>.<O>..</caps>.<O>
and then AHK maps this to Page-Up. Gaaah!
I just can't get this out of my system, without killing my 'typing flow'.


How can I fix this?
When I do Page-Up/Down, I'm much slower and more deliberate than when I write text.
I imagine a rule like "if caps has been down for <0.2s when O is pressed, and is released <0.2s after O was pressed, act like O came before caps-release".

I'd need precise timers that store the last "caps-down" event, and somehow I cannot 'hardwire' the key combos anymore.
Ran out of ideas....

Do you have any ideas? Examples?
thanks a lot
j

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], mikeyww, ReyAHK and 276 guests