razer

package module
v0.0.0-...-d001f22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2021 License: MIT Imports: 6 Imported by: 0

README

go-razer

Latest Release Build Status Go ReportCard GoDoc

Control Razer (Chroma) devices from the CLI or your Go apps

Installation

Make sure you have a working Go environment (Go 1.11 or higher is required). See the install instructions.

To install go-razer, simply run:

go get github.com/muesli/go-razer

Lantern CLI

Lantern is a CLI tool (using go-razer) to control your Razer devices. Run the following command to install it:

go get github.com/muesli/go-razer/cmd/lantern
Hardware Effects

Available effects are wave, reactive, spectrum, breath, breathdual, breathrandom, starlight, starlightdual, starlightrandom, ripple and ripplerandom.

$ lantern -effect wave
$ lantern -effect starlightdual -color "#00ff00" -secondary "#aa00aa"
Plain Background Color
$ lantern -color "#6b6b00"
top Mode

Monitor your system's CPU usage by turning your keyboard into a gauge:

$ lantern -top
Themes

There are currently only a few available themes (feel free to submit more!) named happy, soft, warm, rainbow and random. To try them out, run:

$ lantern -theme happy
Brightness

You can change the brightness (value in percent) by running:

$ lantern -brightness 80

The brightness parameter can also be used in combination with any of the modes described above.

Documentation

Index

Constants

View Source
const (
	EffectNone = iota
	EffectStatic
	EffectReactive
	EffectWave
	EffectSpectrum
	EffectBreath
	EffectBreathDual
	EffectBreathRandom
	EffectStarlight
	EffectStarlightDual
	EffectStarlightRandom
	EffectRipple
	EffectRippleRandom
)

Effects known by the keyboard hardware itself

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Name string
	// contains filtered or unexported fields
}

Device represents a single Razer device

func Devices

func Devices() ([]Device, error)

Devices returns the available Razer devices

func (*Device) Brightness

func (d *Device) Brightness() float64

Brightness returns the device's current brightness

func (*Device) Firmware

func (d *Device) Firmware() string

Firmware returns the firmware version of the device

func (*Device) GameMode

func (d *Device) GameMode() bool

GameMode returns whether the device is currently in "game-mode"

func (*Device) HasDedicatedMacroKeys

func (d *Device) HasDedicatedMacroKeys() bool

HasDedicatedMacroKeys returns whether the device has dedicated macro keys

func (*Device) Keys

func (d *Device) Keys() Keys

Keys returns the key-matrix for this device

func (*Device) MatrixDimensions

func (d *Device) MatrixDimensions() (int, int)

MatrixDimensions returns the matrix dimensions of the device (rows & columns)

func (*Device) Serial

func (d *Device) Serial() string

Serial returns the serial no of the device

func (*Device) SetBrightness

func (d *Device) SetBrightness(b float64)

SetBrightness sets the brightness (between 0 and 100, in percent)

func (*Device) SetEffect

func (d *Device) SetEffect(effect Effect)

SetEffect activates an Effect

func (*Device) SetKeys

func (d *Device) SetKeys(k Keys)

SetKeys sets the colors for the entire keyboard

func (*Device) String

func (d *Device) String() string

func (*Device) Type

func (d *Device) Type() string

Type returns the device type (e.g. "keyboard")

type Effect

type Effect struct {
	Name string
	Type EffectType
	// contains filtered or unexported fields
}

Effect represents a hardware effect

func NewEffect

func NewEffect(e EffectType, primary, secondary color.Color) Effect

NewEffect returns a new Effect

type EffectType

type EffectType int

EffectType for type safety

func StringToEffectType

func StringToEffectType(s string) EffectType

StringToEffectType converts a string to an Effect

type Key

type Key struct {
	Row   int
	Col   int
	Color color.Color
}

Key represents a single key

type KeySet

type KeySet []*Key

A KeySet is a set of keys

func (KeySet) SetColor

func (k KeySet) SetColor(c color.Color)

SetColor sets a single color on all keys in the KeySet

type Keys

type Keys struct {
	Letters   KeySet
	FnKeys    KeySet
	Numerics  KeySet
	Symbols   KeySet
	Commandos KeySet
	Actions   KeySet
	Cursor    KeySet
	Arrows    KeySet
	Special   KeySet
	// contains filtered or unexported fields
}

Keys represents all keys (divided in rows) on the keyboard

func (*Keys) Key

func (k *Keys) Key(row, col int) *Key

Key returns a single key

func (*Keys) KeySpan

func (k *Keys) KeySpan(row, startCol, endCol int) KeySet

KeySpan returns a span of keys

func (*Keys) SetColor

func (k *Keys) SetColor(c color.Color)

SetColor sets a single color on all keys

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL