I recently purchased a backlit keyboard that requires Scroll Lock for toggling the lights. I quickly came into some issues that can be worked around with a few simple bash commands - See this thread.
In short, the command I found that fixed this issue was:
xset led named "Scroll Lock"
To enabled Scroll Lock (and turn the lights on), and
xset -led named "Scroll Lock"
To disable Scroll Lock and turn the lights off.
What options are available if I want to issue the former command if a Scroll Lock key event is received and the (Scroll Lock) function is turned off, and the latter in the other case? That is,
if(ScrollLockIsEnabled) systemCommand('xset -led named "Scroll Lock"); else systemCommand('xset led named "Scroll Lock"`);
I was thinking, at the very least, perhaps doing some sort of a Bash script that kept a variable (if possible) that allowed me to retain the last state of Scroll Lock. I could then execute this script using
xbindkeys (which issues commands based on key events input by the user).