Advertisement
GroggyOtter

CapsRemaps for AHK v2

Sep 20th, 2024
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 1.32 KB | Source Code | 0 0
  1. #Requires AutoHotkey v2.0+
  2.  
  3. ; Caps remaps
  4. *CapsLock::double_tap_caps(), KeyWait('Capslock')
  5. #HotIf GetKeyState('CapsLock', 'P')
  6. *i::Up
  7. *j::Left
  8. *k::Down
  9. *l::Right
  10.  
  11. *u::PgUp
  12. *o::PgDn
  13.  
  14. *,::Home
  15. *.::End
  16.  
  17. *;::Delete
  18. *'::BackSpace
  19.  
  20. *a::Shift
  21. *s::Control
  22. *d::Alt
  23. */::Escape
  24.  
  25. *LButton::spam('LButton', 'LButton')
  26.  
  27. spam(hold_key, send_key) {
  28.     static click_pause := 20
  29.     start()
  30.     return
  31.    
  32.     start() {
  33.         if !GetKeyState(hold_key, 'P')
  34.             return
  35.         SendInput('{' send_key '}')
  36.         SetTimer(start, -click_pause)
  37.     }
  38. }
  39.  
  40. $F4::window_borderless_fullscreen()
  41. #HotIf
  42.  
  43. window_borderless_fullscreen() {
  44.     WS_CAPTION := 0xC00000
  45.     try {
  46.         id := WinActive('A')
  47.         if (WinGetStyle(id) & WS_CAPTION)
  48.             WinSetStyle('-' WS_CAPTION, id)
  49.             ,WinMaximize(id)
  50.         else WinSetStyle('+' WS_CAPTION, id)
  51.             ,WinRestore(id)
  52.     }
  53. }
  54.  
  55. class double_tap_caps {
  56.     static __New() => SetCapsLockState('AlwaysOff')
  57.    
  58.     static call() {
  59.         static last := 0
  60.         if (A_TickCount - last < 175)
  61.             last := 0
  62.             ,this.toggle_caps()
  63.         else last := A_TickCount
  64.     }
  65.    
  66.     static toggle_caps() {
  67.         state := GetKeyState('CapsLock', 'T') ? 'Off' : 'On'
  68.         SetCapsLockState('Always' state)
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement