🌡️ temperatures

October 23, 2025 · View on GitHub

A lightweight, zero-dependency plugin that shows your machine’s CPU and (optionally) GPU temperatures directly in your Zsh prompt.
Originally designed for Raspberry Pi but works on any Linux system exposing /sys/class/thermal/.

Perfect for quick system health checks — no watch, no htop, just glance at your prompt.


🚀 Features

  • 📊 Displays CPU and GPU temperatures in °C or °F
  • 🎨 Auto-colorizes temperatures (green / yellow / red) based on thresholds
  • ⚙️ User-configurable decimals, format, units, and position
  • ⚡ Lightweight (no polling daemon; reads on prompt render)
  • 🧠 Smart caching to keep your prompt snappy
  • 🔁 Resilient to source ~/.zshrc reloads (auto-reattaches)
  • 🧩 Compatible with any theme (manual or auto placement)

🧰 Installation

git clone https://github.com/groberth/temperatures-zsh   "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/temperatures-zsh"

Then in your ~/.zshrc:

plugins+=(temperatures-zsh)
# optional configuration below

Reload your shell:

exec zsh

Option 2 — Manual sourcing (without Oh My Zsh)

git clone https://github.com/groberth/temperatures-zsh ~/.zsh/temperatures-zsh
source ~/.zsh/temperatures-zsh/temperatures-zsh.plugin.zsh

Add $(temperatures_prompt) anywhere in your PROMPT or RPROMPT.


⚙️ Configuration

All options are set via environment variables before the plugin loads (usually in .zshrc).
Each has a default, so you can override only what you need.

VariableDefaultDescription
TEMPERATURES_AUTOtrueWhether to automatically inject the temperature display into your prompt. Set to false if you want to place it manually in your theme.
TEMPERATURES_POSITIONrightPosition when auto-inserting. right puts it in RPROMPT, left prepends it to PROMPT.
TEMPERATURES_UNITCUnit of measurement — C for Celsius or F for Fahrenheit.
TEMPERATURES_DECIMALS1Number of decimal places (e.g. 0 for integers, 2 for high precision).
TEMPERATURES_POLL_INTERVAL2Number of seconds to cache readings between prompt draws (performance trade-off).
TEMPERATURES_FORMATCPU:%s°%s GPU:%s°%sprintf-style format string (cpu, unit, gpu, unit). Collapses gracefully if GPU is disabled/unavailable.
TEMPERATURES_THRESHOLDS50 70Two numeric thresholds (in °C) that separate low → medium → high temperature coloring.
TEMPERATURES_COLOR_LOW%F{green}Zsh color for “cool” temperatures (below first threshold).
TEMPERATURES_COLOR_MED%F{yellow}Color for medium temperatures.
TEMPERATURES_COLOR_HIGH%F{red}Color for hot temperatures (above second threshold).
TEMPERATURES_SHOW_GPUautoControls GPU reading. auto enables only if vcgencmd exists, true always tries, false disables.

🧩 Manual usage (themes & Powerlevel10k)

You can manually insert the output anywhere in your prompt:

RPROMPT='$(temperatures_prompt)  %~'

Powerlevel10k integration

Add this to ~/.p10k.zsh:

function prompt_temperatures() {
  local s="$(temperatures_prompt)"
  [[ -n "$s" ]] || return
  p10k segment -t "$s"
}

POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=(temperatures-zsh)

🧪 Example configuration

# ~/.zshrc
plugins+=(temperatures-zsh)

# show in °F with no decimals
TEMPERATURES_UNIT=F
TEMPERATURES_DECIMALS=0

# make it appear on the left of the prompt
TEMPERATURES_POSITION=left

# longer cache for faster prompts
TEMPERATURES_POLL_INTERVAL=5

# hide GPU
TEMPERATURES_SHOW_GPU=false

Result:

CPU:118°F  ~/projects

🛠️ Requirements

  • CPU: any Linux system exposing /sys/class/thermal/thermal_zone0/temp
  • GPU (optional): Raspberry Pi or similar, with vcgencmd in PATH
  • Shell: Zsh ≥ 5.0
  • Framework: optional (works with or without Oh My Zsh)

🧾 License

MIT © 2025 Groberth See the LICENSE file for details.