On this page
hs.razer
Razer device support.
This extension currently only supports the 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 Tartarus V2 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 other 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:
API Overview
- Functions - API calls offered directly by the extension
- Methods - API calls which can only be made on an object returned by a constructor
API Documentation
Functions
discoveryCallback
Signature | hs.razer.discoveryCallback(fn) -> none |
---|---|
Type | Function |
Description | Sets/clears a callback for reacting to device discovery events |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 48 |
getDevice
Signature | hs.razer.getDevice(num) -> razerObject | nil |
---|---|
Type | Function |
Description | Gets an hs.razer object for the specified device |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 92 |
init
Signature | hs.razer.init(fn) |
---|---|
Type | Function |
Description | Initialises the Razer driver and sets a discovery callback. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/razer/librazer.m line 23 |
numDevices
Signature | hs.razer.numDevices() -> number |
---|---|
Type | Function |
Description | Gets the number of Razer devices connected |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 75 |
unitTests
Signature | hs.razer.unitTests() -> none |
---|---|
Type | Function |
Description | Runs some basic unit tests when a Razer Tartarus V2 is connected. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/razer/razer.lua line 81 |
Methods
backlightsBreathing
Signature | hs.razer:backlightsBreathing([color], [secondaryColor]) -> razerObject, boolean, string | nil |
---|---|
Type | Method |
Description | Changes the keyboard backlights to the breath mode. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/razer/librazer.m line 625 |
backlightsCustom
Signature | hs.razer:backlightsCustom(colors) -> razerObject, boolean, string | nil |
---|---|
Type | Method |
Description | Changes the keyboard backlights to custom colours. |
Parameters |
|
Returns |
|
Notes |
hs.razer.new(0):backlightsCustom({hs.drawing.color.red, nil, hs.drawing.color.green, hs.drawing.color.blue}) |
Source | extensions/razer/librazer.m line 665 |
backlightsOff
Signature | hs.razer:backlightsOff() -> razerObject, boolean, string | nil |
---|---|
Type | Method |
Description | Turns all the keyboard backlights off. |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 450 |
backlightsReactive
Signature | hs.razer:backlightsReactive(speed, color) -> razerObject, boolean, string | nil |
---|---|
Type | Method |
Description | Changes the keyboard backlights to the reactive mode. |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 541 |
backlightsSpectrum
Signature | hs.razer:backlightsSpectrum() -> razerObject, boolean, string | nil |
---|---|
Type | Method |
Description | Changes the keyboard backlights to the spectrum mode. |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 517 |
backlightsStarlight
Signature | hs.razer:backlightsStarlight(speed, [color], [secondaryColor]) -> razerObject, boolean, string | nil |
---|---|
Type | Method |
Description | Changes the keyboard backlights to the Starlight mode. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/razer/librazer.m line 576 |
backlightsStatic
Signature | hs.razer:backlightsStatic(color) -> razerObject, boolean, string | nil |
---|---|
Type | Method |
Description | Changes the keyboard backlights to a single static color. |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 424 |
backlightsWave
Signature | hs.razer:backlightsWave(speed, direction) -> razerObject, boolean, string | nil |
---|---|
Type | Method |
Description | Changes the keyboard backlights to the wave mode. |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 475 |
blueStatusLight
Signature | hs.razer:blueStatusLight(value) -> razerObject, boolean | nil, string | nil |
---|---|
Type | Method |
Description | Gets or sets the blue status light. |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 374 |
brightness
Signature | hs.razer:brightness(value) -> razerObject, number | nil, string | nil |
---|---|
Type | Method |
Description | Gets or sets the brightness of a Razer keyboard. |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 221 |
callback
Signature | hs.razer:callback(callbackFn) -> razerObject |
---|---|
Type | Method |
Description | Sets or removes a callback function for the |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/razer/librazer.m line 147 |
defaultKeyboardLayout
Signature | hs.razer:defaultKeyboardLayout(enabled) -> boolean |
---|---|
Type | Method |
Description | Allows you to remap the default Keyboard Layout on a Razer device so that the buttons no longer trigger their factory default actions, or restore the default keyboard layout. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/razer/razer.lua line 43 |
greenStatusLight
Signature | hs.razer:greenStatusLight(value) -> razerObject, boolean | nil, string | nil |
---|---|
Type | Method |
Description | Gets or sets the green status light. |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 326 |
name
Signature | hs.razer:name() -> string |
---|---|
Type | Method |
Description | Returns the human readable device name of the Razer device. |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 125 |
orangeStatusLight
Signature | hs.razer:orangeStatusLight(value) -> razerObject, boolean | nil, string | nil |
---|---|
Type | Method |
Description | Gets or sets the orange status light. |
Parameters |
|
Returns |
|
Source | extensions/razer/librazer.m line 278 |
© 2014–2017 Hammerspoon contributors
Licensed under the MIT License.
https://www.hammerspoon.org/docs/hs.razer.html