DEV Community

Cover image for Light Indicator Status with AutoHotKey
Camilo Martinez
Camilo Martinez

Posted on • Updated on

Light Indicator Status with AutoHotKey

Languages: [🇪🇸] Español - [🇺🇸] English


If you don't have light indicators on your keyboard or device. AutoHotKey can rescue us with a simple script to know the state of modifier keys.

Create a file called key-indicator.ahk with this script:

~*CapsLock::
~*NumLock::
~*ScrollLock::
~*Insert::
Sleep, 10   ; drastically improves reliability on slower systems

msg := ""
msg := msg "Caps: " (GetKeyState("CapsLock", "T") ? "ON" : "OFF") "`n"
msg := msg "Num: " (GetKeyState("NumLock", "T") ? "ON" : "OFF") "`n"
msg := msg "Scroll: " (GetKeyState("ScrollLock", "T") ? "ON" : "OFF") "`n"
msg := msg "Insert: " (GetKeyState("Insert", "T") ? "ON" : "OFF")

ToolTip, %msg%
Sleep, 750  ; SPECIFY DISPLAY TIME (ms)
ToolTip     ; remove
return
Enter fullscreen mode Exit fullscreen mode

Save the file and open it with AutoHotkey. You will get a screen notification status near your mouse pointer.

Alt Text


If you are using the CapsLock as Backspace and CapsLock enabled/disable with Alt key.

CapsLock::Backspace
!CapsLock::CapsLock ; Alt+CapsLock -> Enable/Disable Caps Lock
Enter fullscreen mode Exit fullscreen mode

Change the first line from ~*CapsLock:: to ~*!CapsLock:: on script file.


Sources:


That’s All Folks!
Happy Coding 🖖

beer

Top comments (0)