A 'Shiny' New Keyboard
I’ve recently switched to a Razer Ornata Chroma, a “mecha-membrane” keyboard, which comes with individually controllable RGB-LED backlights for each key. There are a few GUI tools that let you configure the lighting settings on Linux already, like RazerGenie or RazerCommander, but I really wanted to control it from the command-line and Beehive instead: imagine your keyboard indicating new notifications and events by a cheer- and colorful illumination.
go-razer
Naturally, this meant firing up my editor and hacking on a new Go library, which I’ve aptly named go-razer. Luckily the openrazer drivers provide a dbus interface that is fairly straight-forward to work with, and go-razer is just a thin Go wrapper around the exposed methods. This also means that a whole variety of Razer Chroma products are supported out of the box, since all the hardware specific abstractions are already handled by openrazer.
Lantern
With my convenient little Go package done, I’ve started working on Lantern, a command-line tool to control my shiny new keyboard.
Hardware Effects
The keyboard provides a couple of effects that seem to be baked into the
firmware of the device. The ones available as of firmware 1.0 are called wave
,
reactive
, spectrum
, breath
, breathdual
, breathrandom
, starlight
,
starlightdual
, starlightrandom
, ripple
and ripplerandom
. You can
activate them from the command-line by running:
$ lantern -effect wave
or
$ lantern -effect starlightdual -color "#00ff00" -secondary "#aa00aa"
Plain Background Color
If the effects are bit too much for your liking, you can also set a plain background color for the entire keyboard:
$ lantern -color "#6b6b00"
top Mode
Lantern also supports custom software effects, which means you can turn your keyboard into a fancy gauge, monitoring your system’s CPU usage. This is the mode that people seem to enjoy the most:
$ lantern -top
Themes
There are currently only a few available themes (feel free to submit more!)
named happy
, soft
, warm
, rainbow
and random
. To activate a theme run:
$ lantern -theme happy
Brightness
Last but not least, you can change the entire keyboard’s brightness (values in percent):
$ lantern -brightness 80
This parameter can also be used in combination with any of the modes described above.
Help Me Testing
In theory go-razer and Lantern should work with all kinds of Razer Chroma keyboards, mice and laptops, but I currently only have the Ornata keyboard to test it with. Please get in touch if you tried using it with other Razer products and let me know what works and what needs fixing.
You can check out both projects on GitHub.