I'm a VIM user, and there's one thing that is very annoying: accidentally pressing CapsLock which quite changes VIM's behaviour. So I wanted an OSD that shows me, when CapsLock was pressed. This is the result: a little program using the xosd library that just shows the message "Capslock is ON" in bold green letters.
I also use the awesome window manager, which is where I bound the CapsLock key to execute this program (see below).
The xosd library
Just start the program. Nothing will happen at first, but with the SIGUSR1 signal the OSD can be toggled.
I put this in my rc.lua:
caps_pid = awful.util.spawn("/home/sh/bin/caps-osd")
and in the key binding section
awful.key({}, "Caps_Lock",
NULL,
function()
awful.util.spawn("kill -USR1 " .. caps_pid)
end),
GPL