Module battery

Source
Expand description

Gets the status (charging, discharging, unknown, full), percentage, remaining time and power consumption (in Watts) of the given battery and when it’s estimated to be empty.

§Configuration

KeyDescriptionValuesDefault
numberBattery index as reported in /sysAn integer0
pathSet this property if your battery is represented in a non-standard path in /sys. The first occurrence of %d gets replaced with number, but you can also hardcode the battery index in the pathString representing a path"/sys/class/power_supply/BAT%d/uevent"
formatA string used to customize the output of this moduleSee available placeholders below"$status $percentage $remaining"
format_downA string to customize the output when there are no metricsA string of UTF-8 characters"No battery"
status_chrCustom string to represent charging state.String with any UTF-8 symbols"CHR"
status_batsame as above, but for discharging.same as above"BAT"
status_unksame as above, but for unknownsame as above"UNK"
status_fullsame as above, but for fullsame as above"FULL"
low_thresholdCauses the widget state to change to WidgetState::CriticalInteger10
threshold_typeAn integer representing either time or percentage. If you define percentage and your battery percentage goes below low_threshold, the widget state will change accordingly.time, percentagepercentage
PlaceholderValue
$statusStatus (charging, discharging, unknown, full) of the battery. Will be replaced by one of the status_* properties defined above.
$percentageBattery left percentage
$remainingRemaining time
$emptytimeTime when it’s estimated to be empty
$consumptionPower consumption in Watts

§Example

[[module]]
module = "battery"
number = 0
format = "$status $percentage $remaining"
format_down = "No battery"
status_chr = "⚇ CHR"
status_bat = "⚡ BAT"
status_full = "☻ FULL"
low_threshold = 20
threshold_type = "percentage"

Structs§

Config

Enums§

ChargingStatus
Represents the operating status. Corresponds to POWER_SUPPLY_STATUS_*, as defined in power_supply.h.
ThresholdType