# Battery (https://mangowm.github.io/docs/bar/modules/battery)

Shows charge percent and status. By default the first battery found is used;
on multi-battery laptops each battery can be shown separately with
`battery#BAT0`, `battery#BAT1`, ... — each instance is configured and styled
independently, and a battery that is unplugged simply hides its module.

```jsonc
"modules-right": ["battery#BAT0", "battery#BAT1"],

"battery#BAT0": {
    "format": "{icon} {percent}%",
    "hide-on-ac": true
},
"battery#BAT1": {
    "format": "{icon} {percent}%",
    "hide-on-ac": true
}
```

## Options [#options]

| Option          | Type         | Default                      | Description                                        |
| --------------- | ------------ | ---------------------------- | -------------------------------------------------- |
| `format`        | string       | `{icon} {percent}% {status}` | Display format (see placeholders)                  |
| `icons`         | string array | built-in 11 levels           | Icons shown by charge level while discharging      |
| `icon-charging` | string       | —                            | Icon used while charging                           |
| `icon-full`     | string       | —                            | Icon used when full                                |
| `icon-ac`       | string       | —                            | Plug icon shown when on AC                         |
| `hide-on-ac`    | bool         | `false`                      | Hide the module entirely while plugged in          |
| `device`        | string       | first battery                | sysfs battery device (plain `battery` module only) |

## Placeholders [#placeholders]

| Placeholder        | Description                                         |
| ------------------ | --------------------------------------------------- |
| `{}` / `{percent}` | Charge percent                                      |
| `{icon}`           | Icon by state / level                               |
| `{status}`         | Status string (Charging / Full / Discharging / ...) |
| `{ac}`             | AC plug icon when plugged in                        |

## Styling [#styling]

```css
#battery {
  background: linear-gradient(to top, #b8bb26, mix(#b8bb26, #fbf1c7, 0.3));
  color: #1b1a1a;
}
```