Documentation
¶
Overview ¶
Package patterns include types that describe how colors and/or brightness should change. All should implement the Pattern interface and the BasePattern type will handle common logic across all patterns.
Index ¶
Constants ¶
const AllKeysLabel = "all-keys"
AllKeysLabel is used to get the all keys value from configuration.
const DefaultIdlePeriod = 30 * time.Second
DefaultIdlePeriod is the amount of time the TypingPattern will wait before declaring idle and, if configured, starting another pattern until keys are pressed again.
const DelayLabel = "delay"
DelayLabel is used to get the pattern delay from configuration.
const IdleLabel = "idle"
IdleLabel is used to get the idle pattern from configuration.
const IdlePeriodLabel = "idle-period"
IdlePeriodLabel is used to get the idle period from configuration.
const InputEventIDLabel = "input-event-id"
InputEventIDLabel is used to get the event ID from configuration.
const MonitorLabel = "monitor"
Variables ¶
var Events = &events.Manager{}
Events are where Watchers can be created and ChangeEvents are emitted.
Functions ¶
func DesktopPatternEnv ¶ added in v0.5.0
DesktopPatternEnv returns an encoded environment variable needed to be passed along when run as root to preserve access to to the parent user's desktop configuration (gsettings).
Types ¶
type BasePattern ¶
type BasePattern struct { Name string // contains filtered or unexported fields }
BasePattern is part of all patterns that provides common attributes and implementation.
func (*BasePattern) GetBase ¶
func (p *BasePattern) GetBase() *BasePattern
GetBase will return the BasePattern of any pattern.
func (*BasePattern) GetDefaultDelay ¶
func (p *BasePattern) GetDefaultDelay() time.Duration
GetDefaultDelay will return the pattern's default delay.
func (*BasePattern) Run ¶
Run will begin executing a pattern. If the context passed in is canceled, the running pattern will stop.
func (*BasePattern) Stop ¶
func (p *BasePattern) Stop()
Stop will terminate the currently running pattern.
func (*BasePattern) String ¶
func (p *BasePattern) String() string
String will return a readable representation of the pattern.
type CPUPattern ¶
type CPUPattern struct { BasePattern // contains filtered or unexported fields }
CPUPattern is used when changing colors from "cold" (blue) to "hot" (red) according to the CPU utilization. The "delay" configuration value expresses the amount of time to wait between samples.
type ChangeEvent ¶ added in v0.4.9
type ChangeEvent struct {
Pattern string
}
ChangeEvent is an event that is emitted when the running pattern is changed.
type Config ¶ added in v0.4.6
type Config interface { GetBool(string) bool GetDuration(string) time.Duration GetString(string) string }
Config is the expected interface for retrieving configuration values.
type DesktopPattern ¶
type DesktopPattern struct { BasePattern // contains filtered or unexported fields }
DesktopPattern is used when setting colors according to the dominant color of the active Gnome Desktop background picture.
func (*DesktopPattern) SetEnv ¶ added in v0.5.3
func (p *DesktopPattern) SetEnv(env string) error
SetEnv is invoked when the DesktopPattern needs additional environment values to pass along to the gsettings process (e.g. to ensure it monitors the right user desktop).
type Pattern ¶
type Pattern interface { GetDefaultDelay() time.Duration GetBase() *BasePattern Run(context.Context, *zerolog.Logger) error Stop() String() string }
Pattern is the expected interface all patterns implement.
func GetRunning ¶
func GetRunning() Pattern
GetRunning will return nil or the currently running pattern.
type PulsePattern ¶
type PulsePattern struct {
BasePattern
}
PulsePattern is used when stepping the brightness values up and down to emulate a slow "pulsing" effect. The "delay" configuration value expresses the amount of time to wait between changes of the brightness.
type RainbowPattern ¶
type RainbowPattern struct {
BasePattern
}
RainbowPattern is used when changing colors through the traditional colors of a rainbow. The "delay" configuration value expresses the amount of time to wait between changes of color.
type RandomPattern ¶
type RandomPattern struct {
BasePattern
}
RandomPattern is used when changing colors by randomly selecting a color value. The "delay" configuration value expresses the amount of time to wait between changes of color.
type TypingPattern ¶
type TypingPattern struct { BasePattern // contains filtered or unexported fields }
TypingPattern is used when changing when changing colors from "cold" (blue) to "hot" (red) according to the speed of key presses occurring. The "delay" configuration value expresses the amount of time to wait between evaluating the number of keys recently pressed.
func (*TypingPattern) String ¶
func (p *TypingPattern) String() string
String is a customized version of the BasePattern String that also includes information about the idle settings.
type WaitPattern ¶
type WaitPattern struct {
BasePattern
}
WaitPattern is a special kind of pattern that doesn't do anything, instead, waiting on external commands to be issued (by the menu or another cli) to trigger a pattern.
type WatchPattern ¶ added in v0.4.9
type WatchPattern struct { BasePattern Out io.Writer }
WatchPattern will report every color, brightness, and pattern change to the Out writer.