mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
parent
47e6658978
commit
7a60418297
|
@ -13,10 +13,9 @@ Display SysInfo.
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type":"sysinfo",
|
"type":"sysinfo",
|
||||||
"powerline_symbol": "",
|
"powerline_symbol": "\ue0b0",
|
||||||
"foreground": "#ffffff",
|
"foreground": "#ffffff",
|
||||||
"background": "#8f43f3",
|
"background": "#8f43f3",
|
||||||
"invert_powerline": true,
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"precision": 2,
|
"precision": 2,
|
||||||
"template":" \uf85a {{ round .PhysicalPercentUsed .Precision }}% "
|
"template":" \uf85a {{ round .PhysicalPercentUsed .Precision }}% "
|
||||||
|
@ -51,6 +50,8 @@ Display SysInfo.
|
||||||
- `.Load5`: `float64` - is the current load5 (can be empty on windows)
|
- `.Load5`: `float64` - is the current load5 (can be empty on windows)
|
||||||
- `.Load15`: `float64` - is the current load15 (can be empty on windows)
|
- `.Load15`: `float64` - is the current load15 (can be empty on windows)
|
||||||
- `.CPU`: `[]struct` - an array of [InfoStat][cpuinfo] object, you can use any property it has e.g. `(index .CPU 0).Cores`
|
- `.CPU`: `[]struct` - an array of [InfoStat][cpuinfo] object, you can use any property it has e.g. `(index .CPU 0).Cores`
|
||||||
|
- `.Disks`: `[]struct` - an array of [IOCountersStat][ioinfo] object, you can use any property it has e.g. `.Disks.disk0.IoTime`
|
||||||
|
|
||||||
[cpuinfo]: https://github.com/shirou/gopsutil/blob/78065a7ce2021f6a78c8d6f586a2683ba501dcec/cpu/cpu.go#L32
|
[cpuinfo]: https://github.com/shirou/gopsutil/blob/78065a7ce2021f6a78c8d6f586a2683ba501dcec/cpu/cpu.go#L32
|
||||||
|
[ioinfo]: https://github.com/shirou/gopsutil/blob/e0ec1b9cda4470db704a862282a396986d7e930c/disk/disk.go#L32
|
||||||
[templates]: /docs/config-templates
|
[templates]: /docs/config-templates
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"oh-my-posh/properties"
|
"oh-my-posh/properties"
|
||||||
|
|
||||||
cpu "github.com/shirou/gopsutil/v3/cpu"
|
cpu "github.com/shirou/gopsutil/v3/cpu"
|
||||||
|
disk "github.com/shirou/gopsutil/v3/disk"
|
||||||
load "github.com/shirou/gopsutil/v3/load"
|
load "github.com/shirou/gopsutil/v3/load"
|
||||||
mem "github.com/shirou/gopsutil/v3/mem"
|
mem "github.com/shirou/gopsutil/v3/mem"
|
||||||
)
|
)
|
||||||
|
@ -28,6 +29,8 @@ type SystemInfo struct {
|
||||||
Load1 float64
|
Load1 float64
|
||||||
Load5 float64
|
Load5 float64
|
||||||
Load15 float64
|
Load15 float64
|
||||||
|
// disk
|
||||||
|
Disks map[string]disk.IOCountersStat
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -80,4 +83,9 @@ func (s *SystemInfo) Init(props properties.Properties, env environment.Environme
|
||||||
if err == nil {
|
if err == nil {
|
||||||
s.CPU = processors
|
s.CPU = processors
|
||||||
}
|
}
|
||||||
|
// disk
|
||||||
|
diskIO, err := disk.IOCounters()
|
||||||
|
if err == nil {
|
||||||
|
s.Disks = diskIO
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue