mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
parent
0daeb9829d
commit
e392ab667d
|
@ -38,9 +38,10 @@ Battery displays the remaining power percentage for your battery.
|
|||
## Properties
|
||||
|
||||
- display_error: `boolean` - show the error context when failing to retrieve the battery information - defaults to `false`
|
||||
- charging_icon: `string` - icon to display on the left when charging - defaults to empty
|
||||
- discharging_icon: `string` - icon to display on the left when discharging - defaults to empty
|
||||
- charged_icon: `string` - icon to display on the left when fully charged - defaults to empty
|
||||
- charging_icon: `string` - icon to display when charging - defaults to empty
|
||||
- discharging_icon: `string` - icon to display when discharging - defaults to empty
|
||||
- charged_icon: `string` - icon to display when fully charged - defaults to empty
|
||||
- not_charging_icon: `string` - icon to display when fully charged - defaults to empty
|
||||
|
||||
## Template ([info][templates])
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ const (
|
|||
DischargingIcon properties.Property = "discharging_icon"
|
||||
// ChargedIcon to display when fully charged
|
||||
ChargedIcon properties.Property = "charged_icon"
|
||||
// NotChargingIcon to display when on AC power
|
||||
NotChargingIcon properties.Property = "not_charging_icon"
|
||||
)
|
||||
|
||||
func (b *Battery) Template() string {
|
||||
|
@ -48,8 +50,10 @@ func (b *Battery) Enabled() bool {
|
|||
}
|
||||
|
||||
switch b.BatteryInfo.State {
|
||||
case battery.Discharging, battery.NotCharging:
|
||||
case battery.Discharging:
|
||||
b.Icon = b.props.GetString(DischargingIcon, "")
|
||||
case battery.NotCharging:
|
||||
b.Icon = b.props.GetString(NotChargingIcon, "")
|
||||
case battery.Charging:
|
||||
b.Icon = b.props.GetString(ChargingIcon, "")
|
||||
case battery.Full:
|
||||
|
|
|
@ -371,19 +371,25 @@
|
|||
"charging_icon": {
|
||||
"type": "string",
|
||||
"title": "Charging Icon",
|
||||
"description": "Text/icon to display on the left when charging",
|
||||
"description": "Text/icon to display when charging",
|
||||
"default": ""
|
||||
},
|
||||
"discharging_icon": {
|
||||
"type": "string",
|
||||
"title": "discharging Dcon",
|
||||
"description": "Text/icon to display on the left when discharging",
|
||||
"description": "Text/icon to display when discharging",
|
||||
"default": ""
|
||||
},
|
||||
"charged_icon": {
|
||||
"type": "string",
|
||||
"title": "Charged Icon",
|
||||
"description": "Text/icon to display on the left when fully charged",
|
||||
"description": "Text/icon to display when fully charged",
|
||||
"default": ""
|
||||
},
|
||||
"not_charging_icon": {
|
||||
"type": "string",
|
||||
"title": "Not Charging Icon",
|
||||
"description": "Text/icon to display when on AC power",
|
||||
"default": ""
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue