yambar/modules
Daniel Eklöf b195bc4dcb
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
2022-12-14 12:06:00 +01:00
..
alsa.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
backlight.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
battery.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
clock.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
cpu.c module/cpu: make ‘content’ particle a template 2022-12-14 12:06:00 +01:00
disk-io.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
dwl.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
foreign-toplevel.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
i3-common.c modules: Implement workspace move event 2022-12-13 16:21:55 +01:00
i3-common.h modules: Implement workspace move event 2022-12-13 16:21:55 +01:00
i3-ipc.h module/i3: use our own copy of i3/ipc.h 2019-03-31 12:08:44 +02:00
i3.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
label.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
mem.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
meson.build module/cpu: make ‘content’ particle a template 2022-12-14 12:06:00 +01:00
mpd.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
network.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
pipewire.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
pulse.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
removables.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
river.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
script.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
sway-xkb.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
xkb.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
xwindow.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00