DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,864 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
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 πŸ––

ko-fi

Top comments (0)

Update Your DEV Experience Level:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›