mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-22 20:25:39 +02:00
Before this patch, the cpu module instantiated a single particle (the ‘content’ particle), with one tag ("cpu") representing the total CPU usage, and then one tag (cpuN) for each core. This makes it cumbersome to configure, since you need to explicitly reference each cpuN tag to get per-core usage. This patch rewrites this, so that ‘content’ is now a template. It’s instantiated once to represent the total CPU usage, and then once for each core. Each instance has a "cpu" tag, representing the CPU usage of that core (or total usage). It also has an "id" tag. The ID is 0..n for actual cores, and -1 for total usage. This means you can do something like this in your config: - cpu: content: map: conditions: id < 0: {string: {text: "Total: {cpu}%"}} id >= 0: {string: {text: "Core #{id}: {cpu}%"}} Closes #207
79 lines
1.6 KiB
Markdown
79 lines
1.6 KiB
Markdown
yambar-modules-cpu(5)
|
|
|
|
# NAME
|
|
cpu - This module provides the CPU usage
|
|
|
|
# DESCRIPTION
|
|
|
|
This module reports CPU usage, in percent. The _content_ particle is a
|
|
template that is instantiated once for each core, and once for the
|
|
total CPU usage.
|
|
|
|
# TAGS
|
|
|
|
[[ *Name*
|
|
:[ *Type*
|
|
:[ *Description*
|
|
| id
|
|
: int
|
|
: Core ID. 0..n represents individual cores, and -1 represents the
|
|
total usage
|
|
| cpu
|
|
: range
|
|
: Current usage of CPU core {id}, in percent
|
|
|
|
# CONFIGURATION
|
|
|
|
[[ *Name*
|
|
:[ *Type*
|
|
:[ *Req*
|
|
:[ *Description*
|
|
| interval
|
|
: int
|
|
: no
|
|
: Refresh interval of the CPU usage stats in ms (default=500). Cannot
|
|
be less then 500 ms
|
|
|
|
# EXAMPLES
|
|
|
|
## Display total CPU usage as a number
|
|
```
|
|
bar:
|
|
left:
|
|
- cpu:
|
|
interval: 2500
|
|
content:
|
|
map:
|
|
conditions:
|
|
id < 0:
|
|
- string: {text: , font: Font Awesome 6 Free:style=solid}
|
|
- string: {text: "{cpu}%"}
|
|
```
|
|
|
|
## Display a vertical bar for each core
|
|
```
|
|
bar:
|
|
left:
|
|
- cpu:
|
|
interval: 2500
|
|
content:
|
|
map:
|
|
conditions:
|
|
id >= 0:
|
|
- ramp:
|
|
tag: cpu
|
|
items:
|
|
- string: {text: ▁}
|
|
- string: {text: ▂}
|
|
- string: {text: ▃}
|
|
- string: {text: ▄}
|
|
- string: {text: ▅}
|
|
- string: {text: ▆}
|
|
- string: {text: ▇}
|
|
- string: {text: █}
|
|
```
|
|
|
|
|
|
# SEE ALSO
|
|
|
|
*yambar-modules*(5), *yambar-particles*(5), *yambar-tags*(5), *yambar-decorations*(5)
|