#
hs.razer
Razer device support.
This extension supports the following Razer keypad devices:
- Razer Nostromo
- Razer Orbweaver
- Razer Orbweaver Chroma
- Razer Tartarus
- Razer Tartarus Chroma
- Razer Tartarus Pro
- Razer Tartarus V2
It allows you to trigger callbacks when you press buttons and use the scroll wheel, as well as allowing you to change the LED backlights on the buttons and scroll wheel, and control the three status lights.
By default, the Razer keypads triggers regular keyboard commands
(i.e. pressing the "01" key will type "1"). However, you can use the
:defaultKeyboardLayout(false)
method to prevent this. This works by
remapping the default shortcut keys to "dummy" keys, so that they
don't trigger regular keypresses in macOS.
Like the hs.streamdeck
extension, this extension has been
designed to be modular, so it's possible for others to develop support
for additional Razer devices later down the line, if there's interest.
This extension was thrown together by Chris Hocking for CommandPost.
This extension is based off the hs.streamdeck
extension by Chris Jones.
Special thanks to the authors of these awesome documents & resources:
- Information on USB Packets
- AppleUSBDefinitions.h
- hidutil key remapping generator for macOS
- macOS function key remapping with hidutil
- HID Device Property Keys
#
API Overview
Functions - API calls offered directly by the extension
discoveryCallback getDevice init numDevices unitTests
Methods - API calls which can only be made on an object returned by a constructor
backlightsBreathing backlightsCustom backlightsMode backlightsOff backlightsReactive backlightsSpectrum backlightsStarlight backlightsStatic backlightsWave blueStatusLight brightness callback defaultKeyboardLayout greenStatusLight name orangeStatusLight redStatusLight yellowStatusLight
#
API Documentation
#
Functions
#
discoveryCallback
| | |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| Signature | hs.razer.discoveryCallback(fn) -> none
|
| Type | Function |
| Description | Sets/clears a callback for reacting to device discovery events |
| Parameters |
- fn - A function that will be called when a Razer device is connected or disconnected. It should take the following arguments: A boolean, true if a device was connected, false if a device was disconnected An hs.razer object, being the device that was connected/disconnected
- None
#
getDevice
#
init
| | |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| Signature | hs.razer.init(fn)
|
| Type | Function |
| Description | Initialises the Razer driver and sets a discovery callback. |
| Parameters |
- fn - A function that will be called when a Razer device is connected or disconnected. It should take the following arguments: A boolean, true if a device was connected, false if a device was disconnected An hs.razer object, being the device that was connected/disconnected
- None
- This function must be called before any other parts of this module are used
#
numDevices
#
unitTests
#
Methods
#
backlightsBreathing
#
backlightsCustom
#
backlightsMode
#
backlightsOff
#
backlightsReactive
#
backlightsSpectrum
#
backlightsStarlight
#
backlightsStatic
#
backlightsWave
#
blueStatusLight
| | |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| Signature | hs.razer:blueStatusLight(value) -> razerObject, boolean | nil, string | nil
|
| Type | Method |
| Description | Gets or sets the blue status light. |
| Parameters |
- value -
true
for on,false
for off</li></ul> | | **Returns** | <ul><li>The
hs.razerobject.</li><li>
truefor on,
falsefor off
, ornil
if something has gone wrong - A plain text error message if not successful.
#
brightness
#
callback
#
defaultKeyboardLayout
#
greenStatusLight
| | |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| Signature | hs.razer:greenStatusLight(value) -> razerObject, boolean | nil, string | nil
|
| Type | Method |
| Description | Gets or sets the green status light. |
| Parameters |
- value -
true
for on,false
for off</li></ul> | | **Returns** | <ul><li>The
hs.razerobject.</li><li>
truefor on,
falsefor off
, ornil
if something has gone wrong - A plain text error message if not successful.
#
name
#
orangeStatusLight
| | |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| Signature | hs.razer:orangeStatusLight(value) -> razerObject, boolean | nil, string | nil
|
| Type | Method |
| Description | Gets or sets the orange status light. |
| Parameters |
- value -
true
for on,false
for off</li></ul> | | **Returns** | <ul><li>The
hs.razerobject.</li><li>
truefor on,
falsefor off
, ornil
if something has gone wrong - A plain text error message if not successful.
#
redStatusLight
| | |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| Signature | hs.razer:redStatusLight(value) -> razerObject, boolean | nil, string | nil
|
| Type | Method |
| Description | Gets or sets the red status light. |
| Parameters |
- value -
true
for on,false
for off</li></ul> | | **Returns** | <ul><li>The
hs.razerobject.</li><li>
truefor on,
falsefor off
, ornil
if something has gone wrong - A plain text error message if not successful.
#
yellowStatusLight
| | |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| Signature | hs.razer:yellowStatusLight(value) -> razerObject, boolean | nil, string | nil
|
| Type | Method |
| Description | Gets or sets the orange status light. |
| Parameters |
- value -
true
for on,false
for off</li></ul> | | **Returns** | <ul><li>The
hs.razerobject.</li><li>
truefor on,
falsefor off
, ornil
if something has gone wrong - A plain text error message if not successful.