How to get caps/num/scroll lock keys OSD notification?

I would like to have a OSD notification display briefly everytime the CAPS, Num, or Scroll Lock state toggles.

Is there a way to do this?


Solution 1:

There is already an application that attempts to do this called indicator-keylock. You need a PPA to install it:

sudo add-apt-repository ppa:tsbarnes/indicator-keylock
sudo apt-get update
sudo apt-get install indicator-keylock
setsid indicator-keylock  # to run it the first time

But I'd be interested to see if there's a neat way to bind onto these lock-toggle events.