Module i3status_rs::blocks::battery

source ·
Expand description

Information about the internal power supply

This block can display the current battery state (Full, Charging or Discharging), percentage charged and estimate time until (dis)charged for an internal power supply.

§Configuration

KeyValuesDefault
devicesysfs/UPower: The device in /sys/class/power_supply/ to read from (can also be “DisplayDevice” for UPower, which is a single logical power source representing all physical power sources. This is for example useful if your system has multiple batteries, in which case the DisplayDevice behaves as if you had a single larger battery.). apc_ups: IPv4Address:port or hostname:portsysfs: the first battery device found in /sys/class/power_supply, with “BATx” or “CMBx” entries taking precedence. apc_ups: “localhost:3551”. upower: DisplayDevice
driverOne of "sysfs", "apc_ups", or "upower""sysfs"
modelIf present, the contents of /sys/class/power_supply/.../model_name must match this value. Typical use is to select by model name on devices that change their path.N/A
intervalUpdate interval, in seconds. Only relevant for driver = “sysfs” or “apc_ups”.10
formatA string to customise the output of this block. See below for available placeholders." $icon $percentage "
full_formatSame as format but for when the battery is full" $icon "
charging_formatSame as format but for when the battery is chargingLinks to format
empty_formatSame as format but for when the battery is empty" $icon "
not_charging_formatSame as format but for when the battery is not charging. Defaults to the full battery icon as many batteries report this status when they are full." $icon "
missing_formatSame as format if the battery cannot be found." $icon "
infoMinimum battery level, where state is set to info60
goodMinimum battery level, where state is set to good60
warningMinimum battery level, where state is set to warning30
criticalMinimum battery level, where state is set to critical15
full_thresholdPercentage above which the battery is considered full (full_format shown)95
empty_thresholdPercentage below which the battery is considered empty7.5
PlaceholderValueTypeUnit
iconIcon based on battery’s stateIcon-
percentageBattery level, in percentNumberPercents
time_remainingTime remaining until (dis)charge is complete. Presented only if battery’s status is (dis)charging.Duration-
timeTime remaining until (dis)charge is complete. Presented only if battery’s status is (dis)charging.String DEPRECATED-
powerPower consumption by the battery or from the power supply when chargingString or FloatWatts

time has been deprecated in favor of time_remaining.

§Examples

Basic usage:

[[block]]
block = "battery"
format = " $icon $percentage "
[[block]]
block = "battery"
format = " $percentage {$time_remaining.dur(hms:true, min_unit:m) |}"
device = "DisplayDevice"
driver = "upower"

Hide missing battery:

[[block]]
block = "battery"
missing_format = ""

§Icons Used

  • bat (as a progression)
  • bat_charging (as a progression)
  • bat_not_available

Structs§

Enums§

Functions§