Versions in this module Expand all Collapse all v0 v0.1.0 Aug 17, 2023 Changes in this version + func AlertEvent(config *Config, event *Event) + func AlertIfCritical(config *Config, battery *Battery) + func AlertNotify(config *Config, event *Event) — linux/amd64 + func AlertSet(config *Config, battery *Battery, state bool) + func AlertSound(config *Config, event *Event) + func DefaultConfig() string — linux/amd64 + func GetBatteries() (*list.List, error) + func ListIn(l *list.List, m *list.List, compare func(a T, b T) bool, ...) + func ListMap(l *list.List, callback func(T)) + func ListMirror(l *list.List, m *list.List, compare func(T, T) bool, ...) + func ListRepr(l *list.List) string + func Play(filename string) error + func PlaySafe(filename string) + func SetLogDebug(flag bool) + func SetLogFile(filename string) error + func Update(batteries *list.List, callback func(Event)) + type AlertConfig struct + Added string + Charging string + Critical string + Discharging string + Empty string + Full string + Idle string + Removed string + type Battery struct + Api *impl.Battery + Id int + Last Snapshot + Name string + func (battery *Battery) Capacity() float64 + func (battery *Battery) Charging() bool + func (battery *Battery) Compare(c float64) float64 + func (battery *Battery) Discharging() bool + func (battery *Battery) Full() bool + func (battery *Battery) Glyph() string + func (battery *Battery) GoString() string + func (battery *Battery) String() string + func (battery *Battery) Update() (bool, error) + type BatteryConfig struct + Alerted bool + Critical float64 + Name string + type Config struct + Alerts AlertConfig + Batteries []*BatteryConfig + LogFile string + Verbose bool + func LoadConfig(filename string) (Config, error) + func (config *Config) Get(battery *Battery) *BatteryConfig + func (config *Config) Load(filename string) error + type Event struct + Battery *Battery + Kind EventType + func (event Event) String() string + type EventType int8 + const Added + const Charging + const Discharging + const Empty + const Full + const Idle + const Removed + func (eventType EventType) String() string + type ListEvent struct + Element T + Kind ListEventType + type ListEventType int8 + const ElementAdded + const ElementRemoved + type ListResult struct + Element *list.Element + Found bool + type Logger struct + var Log Logger = Logger{} + func (l Logger) Dbg(format string, args ...any) + func (l Logger) Err(format string, args ...any) + func (l Logger) ErrWrap(err error) + func (l Logger) Info(format string, args ...any) + func (l Logger) Warn(format string, args ...any) + type Snapshot struct + State impl.AgnosticState + When time.Time + type SoundError struct + func (err SoundError) Error() string