My system:

  • OS: Manjaro Linux x86_64
  • Kernel: 5.6.7-1-MANJARO
  • CPU: AMD Ryzen 9 3950X (32) @ 3.500GHz
  • GPU1: AMD ATI Radeon RX 5600 OEM/5600 XT / 5700/5700 XT
  • GPU2: AMD ATI Radeon RX 5600 OEM/5600 XT / 5700/5700 XT

First, we need to get a source for our temperatures. Simply invoke sensors after installing lm-sensors.

Your output will look something like this:

amdgpu-pci-0c00
Adapter: PCI adapter
vddgfx:      800.00 mV
fan1:        1154 RPM  (min =    0 RPM, max = 4950 RPM)
edge:         +48.0°C  (crit = +118.0°C, hyst = -273.1°C)
                       (emerg = +99.0°C)
junction:     +49.0°C  (crit = +99.0°C, hyst = -273.1°C)
                       (emerg = +99.0°C)
mem:          +54.0°C  (crit = +99.0°C, hyst = -273.1°C)
                       (emerg = +99.0°C)
power1:       32.00 W  (cap = 150.00 W)


Adapter: PCI adapter
Vcore:         1.48 V  
Vsoc:          1.08 V  
Tdie:         +36.8°C  
Tctl:         +36.8°C  
Tccd1:        +35.5°C  
Tccd2:        +35.5°C  
Icore:        20.00 A  
Isoc:         10.75 A  

nvme-pci-0100
Adapter: PCI adapter
Composite:    +47.9°C  (low  =  -0.1°C, high = +84.8°C)
                       (crit = +89.8°C)

amdgpu-pci-0f00
Adapter: PCI adapter
vddgfx:      775.00 mV
fan1:        1172 RPM  (min =    0 RPM, max = 4950 RPM)
edge:         +34.0°C  (crit = +118.0°C, hyst = -273.1°C)
                       (emerg = +99.0°C)
junction:     +34.0°C  (crit = +99.0°C, hyst = -273.1°C)
                       (emerg = +99.0°C)
mem:          +36.0°C  (crit = +99.0°C, hyst = -273.1°C)
                       (emerg = +99.0°C)
power1:       10.00 W  (cap = 150.00 W)

nvme-pci-0400
Adapter: PCI adapter
Composite:    +42.9°C  (low  = -273.1°C, high = +84.8°C)
                       (crit = +84.8°C)
Sensor 1:     +42.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 2:     +42.9°C  (low  = -273.1°C, high = +65261.8°C)

The k10temp-pci-00c3 section is provided by the k10temp kernel module, which handles AMD CPUs. In order to find a file for our temperature model to get information from, execute the following:

for i in /sys/class/hwmon/hwmon*/temp*_input; do echo "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*})) $(readlink -f $i)"; done | grep k10temp

which should result in something like:

k10temp: Tdie /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp1_input
k10temp: Tctl /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp2_input
k10temp: Tccd1 /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp3_input
k10temp: Tccd2 /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp4_input

Normally, you’d be wanting the Tdie temperature, but feel free to include more if you’re interested.

Now include the following module in your ~/.config/polybar/config file, and reload.

[module/temperature]
type = internal/temperature
interval = 2
hwmon-path = /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp1_input
base-temperature = 20
warn-temperature = 90