DEV Community

loading...
Cover image for Light Indicator Status with AutoHotKey

Light Indicator Status with AutoHotKey

Camilo Martinez
['Family Man', 'Engineer', 'Software Developer', 'Metalhead', 'English Student' ]
Updated on ・1 min read

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 🖖

Buy me a coffee

Discussion (0)