yambar-modules-cpu(5)

✨ yambar-modules-cpu(5) ✨

okay bestie, so this is a page from the File Formats Manual β€” it's yambar-modules-cpu(5), and it's literally the whole guide to the cpu module. let's get into it πŸ’…


🌸 NAME 🌸

cpu β€” this module provides the CPU usage. that's it, that's the vibe 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so this module reports CPU usage, in percent πŸ’―. here's the cute part: the content particle is a template that gets instantiated once for each core, and then once more for the total CPU usage. so yeah, you get one copy per core plus a bonus total one. icon behaviour honestly πŸ‘‘


πŸŽ€ TAGS πŸŽ€

here's what tags you get to play with:

  • id β€” type int πŸ’œ β€” the Core ID. 0..n represents individual cores, and -1 represents the total usage. so -1 is the main character of the whole CPU ngl.
  • cpu β€” type range πŸ“ β€” the Current usage of CPU core {id}, in percent.

🌈 CONFIGURATION 🌈

the config options, one (1) of them, she's lowkey the only one:

  • poll-interval β€” type int, required? no πŸ™… β€” this is the Refresh interval of the CPU usage stats in milliseconds (default=500).
⚠️ heads up bestie: it Cannot be less then 250ms. that's a hard no, the module will not be speeding past 250ms for you, no cap 😭

πŸ’– EXAMPLES πŸ’–

🌟 Display total CPU usage as a number

bar:
  left:
    - cpu:
        poll-interval: 2500
        content:
          map:
            conditions:
              id < 0:
                - string: {text: , font: Font Awesome 6 Free:style=solid}
                - string: {text: "{cpu}%"}

so id < 0 catches the total-usage instantiation (-1), drops the icon, then prints {cpu}% as a number. slay ✨


🧚 Display a vertical bar for each core

bar:
  left:
    - cpu:
        poll-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: β–ˆ}

this one's id >= 0 so it hits every individual core, and the ramp on tag: cpu gives you those little block characters β€” β–β–‚β–ƒβ–„β–…β–†β–‡β–ˆ β€” rising with usage. it's giving sparkline energy fr fr πŸ“ˆπŸ”₯


⭐ SEE ALSO ⭐

go read these next, bestie, they're all part of the lore:


πŸ’€ and that's the whole page!! this was yambar-modules-cpu(5) dated 2024-04-22, straight from the File Formats Manual β€” stay hydrated, poll responsibly (β‰₯250ms pls), and go touch some cores πŸ§šπŸ’–πŸ‘‘

πŸ“¦ where this page comes from