Skip to content

cpu

CPU usage, frequency, and temperature.

Add it to your layout with cpu:

toml
[[bar.layout]]
monitor = "*"
right = ["cpu"]

General

FieldTypeDefaultDescription
poll-interval-msu642000Polling interval in milliseconds.
temp-sensorstring"auto"Temperature sensor label.
formatstring"{{ percent }}%"Format string for the label.
icon-namestring"ld-cpu-symbolic"Icon name.
border-showboolfalseDisplay border around button.
icon-showbooltrueDisplay module icon.
label-showbooltrueDisplay label.
label-max-lengthu320Max label characters before truncation. Set to 0 to disable.
thresholdsarray of ThresholdEntry[]Dynamic color thresholds based on CPU usage percentage.
More about poll-interval-ms

Faster polling increases CPU usage.

More about temp-sensor

Use "auto" for automatic detection, or specify a label (e.g., "Tctl", "Package id 0").

Run sensors to see available labels.

More about format

Placeholders

  • {{ percent }} - CPU usage (0-100)
  • {{ freq_ghz }} - Frequency of the busiest core (highest usage)
  • {{ avg_freq_ghz }} - Average frequency across cores
  • {{ max_freq_ghz }} - Maximum frequency among cores
  • {{ temp_c }} - Temperature in Celsius (if available)
  • {{ temp_f }} - Temperature in Fahrenheit (if available)

Examples

  • "{{ percent }}%" - "45%"
  • "{{ percent }}% @ {{ freq_ghz }}GHz" - "45% @ 3.2GHz"
  • "{{ percent }}% {{ temp_c }}C" - "45% 62C"
More about thresholds

Entries are checked in order; the last matching entry wins for each color slot. Use above for high-value warnings (e.g., high CPU usage).

Example

toml
[[modules.cpu.thresholds]]
above = 70
icon-color = "status-warning"
label-color = "status-warning"

[[modules.cpu.thresholds]]
above = 90
icon-color = "status-error"
label-color = "status-error"

Colors

FieldTypeDefaultDescription
border-colorColorValue"blue"Border color token.
icon-colorColorValue"auto"Icon foreground color.
icon-bg-colorColorValue"blue"Icon container background color token.
label-colorColorValue"blue"Label text color token.
button-bg-colorColorValue"bg-surface-elevated"Button background color token.

Click actions

FieldTypeDefaultDescription
left-clickClickAction""Action on left click.
right-clickClickAction""Action on right click.
middle-clickClickAction""Action on middle click.
scroll-upClickAction""Action on scroll up.
scroll-downClickAction""Action on scroll down.

Default configuration

toml
[modules.cpu]
poll-interval-ms = 2000
temp-sensor = "auto"
format = "{{ percent }}%"
icon-name = "ld-cpu-symbolic"
border-show = false
border-color = "blue"
icon-show = true
icon-color = "auto"
icon-bg-color = "blue"
label-show = true
label-color = "blue"
label-max-length = 0
button-bg-color = "bg-surface-elevated"
left-click = ""
right-click = ""
middle-click = ""
scroll-up = ""
scroll-down = ""
thresholds = []

Released under the MIT License.