Documentation ¶
Index ¶
- func AlertEvent(config *Config, event *Event)
- func AlertIfCritical(config *Config, battery *Battery)
- func AlertNotify(config *Config, event *Event)
- func AlertSet(config *Config, battery *Battery, state bool)
- func AlertSound(config *Config, event *Event)
- func DefaultConfig() string
- func GetBatteries() (*list.List, error)
- func ListIn[T any](l *list.List, m *list.List, compare func(a T, b T) bool, ...)
- func ListMap[T any](l *list.List, callback func(T))
- func ListMirror[T any](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
- type Battery
- 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
- type Config
- type Event
- type EventType
- type ListEvent
- type ListEventType
- type ListResult
- type Logger
- type Snapshot
- type SoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlertEvent ¶
func AlertIfCritical ¶
func AlertNotify ¶
func AlertSound ¶
func DefaultConfig ¶
func DefaultConfig() string
func GetBatteries ¶
func ListMirror ¶
func ListMirror[T any]( l *list.List, m *list.List, compare func(T, T) bool, callback func(ListEvent[T]), )
ListMirror the elements of `m' in `l', i.e., remove elements from `l' that do not belong to `m' and add elements from `m' that do not belong to `l'.
func SetLogDebug ¶
func SetLogDebug(flag bool)
func SetLogFile ¶
Types ¶
type AlertConfig ¶
type Battery ¶
func (*Battery) Discharging ¶
type BatteryConfig ¶
type Config ¶
type Config struct { Batteries []*BatteryConfig `yaml:"batteries"` Alerts AlertConfig `yaml:"alerts"` LogFile string `yaml:"logfile"` Verbose bool `yaml:"verbose"` }
func LoadConfig ¶
func (*Config) Get ¶
func (config *Config) Get(battery *Battery) *BatteryConfig
type ListEvent ¶
type ListEvent[T any] struct { Kind ListEventType Element T }
type ListEventType ¶
type ListEventType int8
const ( ElementAdded ListEventType = iota ElementRemoved )
type ListResult ¶
type SoundError ¶
type SoundError struct {
// contains filtered or unexported fields
}
func (SoundError) Error ¶
func (err SoundError) Error() string
Click to show internal directories.
Click to hide internal directories.