Linux Backlight for CM Storm Devastator Keyboard

The CM Storm keyboard was dirt cheap and looks really cool. The only problem is that on Fedora 21 and other Linux distributions the Scroll Lock key is not enabled by default. And it just happens to be the key that toggles the keyboard backlight. I don’t know why they didn’t just put a switch on the keyboard.

For Fedora 21:

Install A keyboard binding tool

yum install xdotool

Add an easy alias to toggle the backlight from the command line with the ‘k’ key

vim ~/.bashrc

alias k="xmodmap -e 'add mod3 = Scroll_Lock' && xdotool key --delay 10 'Scroll_Lock'"

Even better than that, lets trigger the toggle command on login. This part is Gnome specific and wont work on Ubuntu (Unless you removed Unity)!

vim ~/.bash_profile

dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" | ( while true; do read X; if echo $X | grep "boolean true" &> /dev/null;then :; elif echo $X | grep "boolean false" &> /dev/null; then sh /home/penner/scripts/keyboard.sh; fi done ) &

vim /home/penner/scripts

#!/bin/bash/keyboard.sh

xmodmap -e "add mod3 = Scroll_Lock"
xdotool key --delay 10000 "Scroll_Lock"

You need to adjust the script paths for yourself. Might want to tweak the time outs as well. Good luck.

Published by

Anthony

Anthony loves open source software. Especially Linux and Ruby on Rails. He enjoys tinkering with his Raspberry Pi projects, writing code late at night, and drinking coffee. He aspires to be a Linux guru and software development magician. He is currently reading books on AI.

4 thoughts on “Linux Backlight for CM Storm Devastator Keyboard”

  1. Hi Anthony, I have a Raspberry Pi, using Linux, and have the same backlight problem.

    Is there a script that will just turn the backlight on when the Pi is loading up, and leave it on?

    I am new to all this, but it looks like fun.
    Kind Regards
    Bill

  2. Hey, you could try running it on startup. Assuming you’ve installed the xdotool packages…

    sudo vim /etc/rc.local
    
    # /etc/rc.local
    /usr/bin/xmodmap -e 'add mod3 = Scroll_Lock' &
    /usr/bin/xdotool key --delay 10 'Scroll_Lock' &
    
    #This file should end with return 0
    

    You could also add those two lines to your ~/.bash_profile file.

    1. Pat, I’m running Mint KDE 17.3 and I just had to type:

      /usr/bin/xmodmap -e ‘add mod3 = Scroll_Lock’ &

      and it worked fine… of course I had to touch Scroll Lock for the lights to come on but they’re on 🙂
      Stick it in a startup script and it works every reboot.

      Thanks guys – I just bought this keyboard today and fell in love with the feel but was so disappointed to see the backlight off. Now I’m a happy camper!

Leave a Reply

Your email address will not be published. Required fields are marked *