Battery
What
caution
The segment is not supported and automatically disabled on Windows when WSL 1 is detected. Works fine with WSL 2.
Battery displays the remaining power percentage for your battery.
Sample Configuration
- json
- yaml
- toml
Options
| Name | Type | Default | Description |
|---|---|---|---|
display_error | boolean | false | show the error context when failing to retrieve the battery information |
charging_icon | string | icon to display when charging | |
discharging_icon | string | icon to display when discharging | |
charged_icon | string | icon to display when fully charged | |
not_charging_icon | string | icon to display when on AC power |
Template (info)
default template
{{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}
Properties
| Name | Type | Description |
|---|---|---|
.State | struct | the battery state, has a .String function |
.Percentage | float64 | the current battery percentage |
.Error | string | the error in case fetching the battery information failed |
.Icon | string | the icon based on the battery state |