forked from external/yambar
module/cpu: make ‘content’ particle a template
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
This commit is contained in:
parent
2e0e1a402f
commit
b195bc4dcb
4 changed files with 135 additions and 55 deletions
|
@ -70,7 +70,7 @@ if plugin_clock_enabled
|
|||
endif
|
||||
|
||||
if plugin_cpu_enabled
|
||||
mod_data += {'cpu': [[], []]}
|
||||
mod_data += {'cpu': [[], [dynlist]]}
|
||||
endif
|
||||
|
||||
if plugin_disk_io_enabled
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue