Aller au contenu principal

Batterie

Traduction Bêta Non Officielle

Cette page a été traduite par PageTurner AI (bêta). Non approuvée officiellement par le projet. Vous avez trouvé une erreur ? Signaler un problème →

Description

attention

Ce segment n'est pas pris en charge et est automatiquement désactivé sous Windows lorsque WSL 1 est détecté. Fonctionne correctement avec WSL 2.

Batterie affiche le pourcentage d'énergie restant de votre batterie.

Exemple de configuration

{
"type": "battery",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#ffeb3b",
"background_templates": [
"{{if eq \"Charging\" .State.String}}#40c4ff{{end}}",
"{{if eq \"Discharging\" .State.String}}#ff5722{{end}}",
"{{if eq \"Full\" .State.String}}#4caf50{{end}}"
],
"template": " {{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }} ",
"options": {
"discharging_icon": " ",
"charging_icon": " ",
"charged_icon": " "
}
}

Options

NameTypeDefaultDescription
display_errorbooleanfalseshow the error context when failing to retrieve the battery information
charging_iconstringicon to display when charging
discharging_iconstringicon to display when discharging
charged_iconstringicon to display when fully charged
not_charging_iconstringicon to display when fully charged

Modèle (info)

modèle par défaut
 {{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}

Propriétés

NameTypeDescription
.Statestructthe battery state, has a .String function
.Currentfloat64Current (momentary) charge rate (in mW).
.Fullfloat64Last known full capacity (in mWh)
.Designfloat64Reported design capacity (in mWh)
.ChargeRatefloat64Current (momentary) charge rate (in mW). It is always non-negative, consult .State field to check whether it means charging or discharging (on some systems this might be always 0 if the battery doesn't support it)
.Voltagefloat64Current voltage (in V)
.DesignVoltagefloat64Design voltage (in V). Some systems (e.g. macOS) do not provide a separate value for this. In such cases, or if getting this fails, but getting Voltage succeeds, this field will have the same value as Voltage, for convenience
.Percentagefloat64the current battery percentage
.Errorstringthe error in case fetching the battery information failed
.Iconstringthe icon based on the battery state