Instantly share code, notes, and snippets.

@alinnert /README.md
Last active Sep 28, 2018

Embed
What would you like to do?
An AutoHotKey script for developers and productivity.

This AutoHotKey script turns the keys CapsLock, < and into a modifier key for control actions and special characters.

Optimized for QWERTZ keyboards.

A few examples (aka where everything started):


CapsLock is the modifier for various quick controls.

Text cursor movement of course also works in combination with Shift, Ctrl and Alt keys.

  • CapsLock + Tab → toggle CapsLock (because we need CapsLock itself as a modifier key)
  • CapsLock + j/k/l/i → Arrow Keys
  • CapsLock + u → Home
  • CapsLock + o → End
  • CapsLock + h → Page up
  • CapsLock + z → Page down
  • CapsLock + Return → Context Menu
  • CapsLock + Mouse Buttons left/middle/right → Copy | Paste | Cut
  • CapsLock + 1/2/3/4 → Browser Controls: Back | Forward | Refresh | Home Page (back and forward also work with JetBrains IDEs)
  • CapsLock + q/w/e/r → Media Controls: Stop | Back | Forward | Play/Pause
  • CapsLock + b/n/m → Audio Volume Controls: Down | Up | Mute

< is the modifier for special characters. Simply press < to enter the < character.

  • < + d/f< & >
  • < + j/k{ & }
  • < + u/i[ & ]
  • < + g/h/ & \
  • < + e/r' & "
  • < + q/w» & «
  • < + s$
  • < + n&
  • < + l~
  • < + yλ (for ramda.js)
  • < + z (for AMP Project)

Here is a complete preview: http://www.keyboard-layout-editor.com/#/gists/7b8abc49f8aa2121202f72115fd321fb

; Create an invisible window. This is used to check if Capslock is being pressed.
; This window gets destroyd after Capslock has been released
$*Capslock::
Gui, 99:+ToolWindow
Gui, 99:Show,NoActivate x-1 w1, Capslock Is Down
keywait, Capslock
Gui, 99:Destroy
return
#IfWinExist, Capslock Is Down
Tab::Capslock ; Trigger Capslock state using [Capslock] + [Tab]
; Cursor controls
j::Left
l::Right
i::Up
k::Down
u::Home
o::End
h::PgDn
z::PgUp
; Media controls
b::Volume_Down
n::Volume_Up
m::Volume_Mute
r::Media_Play_Pause
e::Media_Next
w::Media_Prev
q::Media_Stop
; Browser controls, based on the Chrome OS keyboards
1::Browser_Back
2::Browser_Forward
3::Browser_Refresh
4::Browser_Home
0::PrintScreen
; Windows 10 Desktop controls
f::sendevent {LWin down}{LCtrl down}{Right down}{LWin up}{LCtrl up}{Right up}
s::sendevent {LWin down}{LCtrl down}{Left down}{LWin up}{LCtrl up}{Left up}
d::sendevent {LWin down}{Tab down}{Tab up}{LWin up}
; Misc. system controls
.::Insert
Backspace::Delete
Enter::AppsKey ; Context menu
NumpadSub::Backspace
; [Capslock] + Mouse actions
MButton::^v ; Copy, Cut, Paste
LButton::^c
RButton::^x
WheelUp::Send {PgUp}
WheelDown::Send {PgDn}
XButton1::Send !{Up}
#IfWinExist
; Special characters using [<] + letter
< & j::{
< & k::}
< & u::[
< & i::]
< & g::/
< & h::\
< & n::&
< & a::@
< & s::$
< & p::Send {`%}
< & o::*
< & x::×
< & d::<
< & f::>
< & q::»
< & w::«
< & l::~
< & z::⚡ ; for Google AMP
< & y::λ
< & c::›
< & v::‹
< & b::Send {``}{Space}
< & ,::?
< & .::!
< & r::"
< & e::'
< & m::=
< & ö::|
< & 8::(
< & 9::)
< & -::‒
< & +::±
< & #::•
< & t::_
< & ß::ẞ
< & Numpad0::#
< & NumpadDot::.
< & Left::←
< & Right::→
< & Up::↑
< & Down::↓
; Send [<] if only the [<] key and nothing else is pressed
$*<::send {Blind}{<}
^ & i::SendInput import
^ & e::SendInput export
^ & f::SendInput function
^ & c::SendInput const
^ & l::SendInput let
^ & q::SendInput require
^ & r::SendInput return
^ & x::SendInput @mixin
^ & m::SendInput @media
^ & n::SendInput @include
; Send [^] if only the [^] key and nothing else is pressed
$*^::send {Blind}{^}
; [Win] + Mouse Wheel Up => [Ctrl] + [Shift] + [Tab] (Previous tab)
#WheelUp::Send, ^+{Tab}
; [Win] + Mouse Wheel Down => [Ctrl] + [Tab] (Next tab)
#WheelDown::Send, ^{Tab}
; [Win] + Middle Mouse Button => [Ctrl] + [W] (Close tab)
#MButton::Send, ^w
; [Win] + [Shift] + Middle Mouse Button => [Ctrl] + [Shift] + [T] (Reopen recently closed tab)
#+MButton::Send, ^+t
; [Win] + Right Mouse Button => Minimize active window
#RButton::WinMinimize, A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment