As `Scroll Lock` may interfere with your keyboard shortcuts when active (named `F12`, `Ctrl+Space` won't work as expected), I decided to match the `Scroll Lock` key to a manual launch of `xset`, toggling the LED state regarding it previous state.

I create a executable script named `toggle_keyb_led.sh`:

 xset q | awk '/LED/{ if ($10 ~ "00000000") print "led"; else print "-led" }' | xargs xset


This parses the output of `xset q`, matching line with `LED mask`.

_Note 1_: If doesn't work for you, please verify with `xset -led; xset q | grep 'LED'` what is the current mask value.

_Note 2_: Some users need to run `xset led 3` to activate the light. In this case, please rewrite above script.


---

Then you can launch this script as Custom Shortcut using your Desktop Environment like (here is with a Cinnamon):

[![enter image description here][1]][1]
 [1]: https://i.sstatic.net/9GS6U.png