Documentation ¶
Overview ¶
Package battery provides a battery status i3bar module.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct { // Capacity in *percents*, from 0 to 100. Capacity int // Energy when the battery is full, in Wh. EnergyFull float64 // Max Energy the battery can store, in Wh. EnergyMax float64 // Energy currently stored in the battery, in Wh. EnergyNow float64 // Power currently being drawn from the battery, in W. Power float64 // Current voltage of the batter, in V. Voltage float64 // Status of the battery, e.g. "Charging", "Full", "Disconnected". Status Status // Technology of the battery, e.g. "Li-Ion", "Li-Poly", "Ni-MH". Technology string }
Info represents the current battery information.
func (Info) Discharging ¶
Discharging returns true if the battery is being discharged.
func (Info) RemainingPct ¶
RemainingPct returns the percentage of battery capacity remaining.
func (Info) RemainingTime ¶
RemainingTime returns the best guess for remaining time. This is based on the current power draw and remaining capacity.
func (Info) SignedPower ¶
SignedPower returns a positive power value when the battery is being charged, and a negative power value when discharged.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module represents a battery bar module. It supports setting the output format, click handler, update frequency, and urgency/colour functions.
func All ¶
func All() *Module
All constructs a battery module that aggregates all detected batteries.
func (*Module) Output ¶
Output configures a module to display the output of a user-defined function.
func (*Module) RefreshInterval ¶
RefreshInterval configures the polling frequency for battery info.
type Status ¶
type Status string
Status represents a normalised battery status.
const ( // Disconnected represents a named battery that was not found. Disconnected Status = "Disconnected" // Charging represents a battery that is actively being charged. Charging Status = "Charging" // Discharging represents a battery that is actively being discharged. Discharging Status = "Discharging" // Full represents a battery that is plugged in and at capacity. Full Status = "Full" // NotCharging represents a battery that is plugged in, // not full, but not charging. NotCharging Status = "Not charging" // Unknown is used to catch all other statuses. Unknown Status = "" )