Any way to get Linux to deal with ScrlLock?

VirtualLarry

No Lifer
Aug 25, 2001
56,570
10,202
126
For some reason, Linux apparently simply totally ignores a valid PS/2 keyboard scancode sequence, that of the scroll lock key. True, very few things actually use that key, but that's not a valid reason to simply ignore it.

This is a clear defect in Linux (Mint 17.2 Mate tested).

Why do I care? I just bought three various colored backlit CoolerMaster Devastator keyboard + mouse sets. They use the scroll lock key to control the backlight. The keyboard is mostly un-usable without this functionality.

Why does Linux hate valid key sequences and backlit keyboards???
 

VirtualLarry

No Lifer
Aug 25, 2001
56,570
10,202
126
Thanks. I found that this command seems to work, to enable the light:
xset led named "Scroll Lock"

Bingo! The LED lighting turns on. Maybe the solution is more complicated if you want to be able to actually toggle the light, but this works for me.

Any suggestions on where to stick that command? Is there some sort of user-specific startup script to stick it in?
 

Essence_of_War

Platinum Member
Feb 21, 2013
2,650
4
81
Any suggestions on where to stick that command? Is there some sort of user-specific startup script to stick it in?

Crontab @reboot should work fine, and is probably the easiest.

I think the "correct" way to do this on Debian based systems is to add it to /etc/init.d/. There should be a template at /etc/init.d/skeleton, you could copy it to /etc/init.d/my_super_cool_keyboard_script and adapt it. Make sure it is executable!
 

Gryz

Golden Member
Aug 28, 2010
1,551
204
106
That's user specific stuff. Putting it in init.d or crontab is madness !

You need to put it in a user-specific config file related to X. Which one ? That depends on your version of Linux, KDE or Gnome, etc. It'll be a hidden file in your home directory (starting with a dot), like .xsession or .xinitrc.

xmodmap is a tool that allows you to remap any key to any function you want. Should work with all linuxes. I haven't used Linux in the last few years. But I used to use xmodmap heavily, changing the windows-key into an extra alt-key, disabling caps-lock altogether ("we don't need no stinking caps-lock!", etc. Anything is possible.
 
Last edited:
Feb 25, 2011
16,975
1,607
126
The last time I took note of my Scroll Lock key was when I'd press it while playing MechWarrior 4 and it would bounce me back to Explorer.
 

Essence_of_War

Platinum Member
Feb 21, 2013
2,650
4
81
That's user specific stuff. Putting it in init.d or crontab is madness !

Good point


xmodmap is a tool that allows you to remap any key to any function you want. Should work with all linuxes. I haven't used Linux in the last few years. But I used to use xmodmap heavily, changing the windows-key into an extra alt-key, disabling caps-lock altogether ("we don't need no stinking caps-lock!", etc. Anything is possible.

https://www.jwz.org/xkeycaps/

I wrote this program in 1991 when I found myself having to use Yet Another Different Keyboard, and finding that yet again I had forgotten the syntax of xmodmap since the last time I needed to figure out how to get the Caps-Lock and Control keys to be in the right places.

So, in full-tilt pique at the fact that the crummy computers I had to use still didn't have this basic utility that my 128k Macintosh had in 1984, I hacked it together, taught it about the four or five keyboards I had access to, and about the half dozen more I was able to find descriptions of in manuals, and released the result. Since then, I've been sent new keyboard descriptions with great regularity, so that it now knows about (at final count) 208 different configurations! (Isn't it sick that so many different configurations even exist?)


If our hearts are pure, we can stamp out xmodmap in our lifetime.