keyboard

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package keyboard provides helpers to interact with System76 keyboard devices.

Index

Constants

View Source
const RandomColor = "random"

RandomColor is the color name used to pick a randomly generated color code.

Variables

View Source
var Events = &events.Manager{}

Events are where Watchers can be created and ChangeEvents are emitted.

Functions

func BrightnessFileHandler

func BrightnessFileHandler(brightness string) error

BrightnessFileHandler writes a hex value to brightness and returns the bytes written.

func ColorFileHandler

func ColorFileHandler(color string) error

ColorFileHandler writes a string to colorFiles.

func EachPresetColor

func EachPresetColor(cb func(name, value string))

EachPresetColor iterates all the loaded color names and invokes the provided callback for each one.

func GetCurrentBrightness

func GetCurrentBrightness() (string, error)

GetCurrentBrightness reads the brightness value current set and returns its value.

func GetCurrentColors

func GetCurrentColors() (map[string]string, error)

GetCurrentColors reads the color values currently set and returns their values.

func LoadEmbeddedColors

func LoadEmbeddedColors() error

LoadEmbeddedColors will parse the embedded colors file into memory for looking up color hex codes by name.

func StartMonitor added in v0.5.4

func StartMonitor(ctx context.Context, delay time.Duration)

StartMonitor continuously monitors the currently set brightness and color and resets them if changed outside this process. Cancel the provided ctx to stop the monitor.

Types

type ChangeEvent added in v0.4.9

type ChangeEvent struct {
	Color      string
	Brightness string
}

ChangeEvent is an event that is emitted when the current brightness or color is changed.

type RGBColor

type RGBColor struct {
	Red   int
	Green int
	Blue  int
}

RGBColor represents Red Green and Blue values of a color

func (RGBColor) GetColorInHex

func (c RGBColor) GetColorInHex() string

GetColorInHex returns a color in HEX format

Jump to

Keyboard shortcuts

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