By default in GNOME, you cannot toggle the keyboard light. For GNOME, there is no solution to use the key binding (
XF86KbdLightOnOff) as intended, because gnome-settings-daemon reserves the key at a level that does not allow any further capturing. Other DMs may not suffice from this “feature”.
What you can do is, to put the function on another keyboard shortcut (ex. Winkey+Z) and have it execute this script
That will toggle through the three keyboard states (automatic, on, off). You can put it on suid-root so that you can change the file in the
Update you can also use
acpid and this config file:
(thanks to nulli)