Live data from Hacker News

Untitled topic

news.ycombinator.com

1–5 of 5 posts

Re: undefined

#2
I think an AutoHotKey script could do that (if it runs on Windows 11. I couldn’t easily find that on its site). Approach would be:

- in a “caps lock key pressed” handler, set a timer (https://www.autohotkey.com/docs/v2/lib/SetTimer.htm) that runs every ten seconds

- in that timer, check the value of A_TimeIdleKeyboard (https://www.autohotkey.com/docs/v2/Variables.htm#TimeIdleKey...)

- if it’s too large, call SetCapsLockState (https://www.autohotkey.com/docs/v2/lib/SetNumScrollCapsLockS...) and stop the timer

- otherwise, compute a new ideal delay from the desired run interval and A_TimeIdleKeyboard, and update the time interval

You also wail want to prevent starting multiple timers if you enable caps lock multiple times.

Re: undefined

#3
post #2

I think an AutoHotKey script could do that (if it runs on Windows 11. I couldn’t easily find that on its site). Approach would be: - in a “caps lock key pressed” handler, set a timer ( https://www.autohotkey.com/docs/v2/lib/SetTimer.htm ) that runs every ten seconds - in that timer, check the value of A_TimeIdleKeyboard ( https://www.autohotkey.com/docs/v2/Variables.htm#TimeIdleKey... ) - if it’s too large, call SetC…

Thank you, I'll check it out.

Re: undefined

#5
post #2

I think an AutoHotKey script could do that (if it runs on Windows 11. I couldn’t easily find that on its site). Approach would be: - in a “caps lock key pressed” handler, set a timer ( https://www.autohotkey.com/docs/v2/lib/SetTimer.htm ) that runs every ten seconds - in that timer, check the value of A_TimeIdleKeyboard ( https://www.autohotkey.com/docs/v2/Variables.htm#TimeIdleKey... ) - if it’s too large, call SetC…

Here's an AHK script I've had since 2007 (omg, I'm too old). Adds a delay (press-and-hold to enable/disable) to capslock. Not exactly what you want, but I loved it and it should be easy to modify to do what you want:

  CAPSLKTOOLTIP:
  ToolTip,
  SetTimer,CAPSLKTOOLTIP,Off
  Return
  
  SetTimer,CAPSLKTOOLTIP,1500
  SetTimer,CAPSLKTOOLTIP,Off
  
  CapsLock::
  counter := 0
  Loop,20
  {
   Sleep, 40
   counter++
   GetKeyState,state,CapsLock,P
   If state=U
    Break
  
   If counter >= 20
   {
    counter := 0
    GetKeyState,state,CapsLock,T
    If state=D
    {
     ToolTip,Caps Lock Off
     SetCapsLockState,Off
    }
    Else
    {
     ToolTip,Caps Lock On
     SetCapsLockState,On
  
    }
    keyWait, Capslock, U
    SetTimer,CAPSLKTOOLTIP,On
    Continue
   }
  }
  Return