Skip to content

Commit

Permalink
🔧 polybar[module]: add CPU temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianmiranda committed Jan 3, 2024
1 parent 54c6da9 commit 1c56e35
Showing 1 changed file with 75 additions and 3 deletions.
78 changes: 75 additions & 3 deletions home/.config/polybar/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ separator-foreground = ${colors.disabled}

modules-left = logo i3 sxhkd-ipc hotkeys-ipc spotify-now-playing
modules-center =
modules-right = dolarblue dozer microphone pulseaudio-control-output network cpu memory weather custom-date trayseparator spotify owl thunderbird github vpn packages dunst trayseparator
modules-right = dolarblue dozer microphone pulseaudio-control-output network cpu-temperature cpu memory weather custom-date trayseparator spotify owl thunderbird github vpn packages dunst trayseparator

cursor-click = pointer
cursor-scroll = ns-resize
Expand Down Expand Up @@ -312,14 +312,14 @@ type = internal/memory
interval = 2X
format-prefix = ""
format-prefix-foreground = ${colors.primary}
label = %percentage_used:2%%
label = %percentage_used:3:3%%

[module/cpu]
type = internal/cpu
interval = 2
format-prefix = ""
format-prefix-foreground = ${colors.primary}
label = %percentage:2%%
label = %percentage:3:3%%

[module/battery]
type = internal/battery
Expand Down Expand Up @@ -520,4 +520,76 @@ hook-0 = echo ""
hook-1 = echo "%{B#A54242}%{F#FFFFFF} $(cat /tmp/sxhkd-keychord.txt | sed 's/H//')%{F-} %{B-}"
initial = 1

[module/cpu-temperature]
type = internal/temperature

; Seconds to sleep between updates
; Default: 1
interval = 1

; Thermal zone to use
; To list all the zone types, run
; $ for i in /sys/class/thermal/thermal_zone*; do echo "$i: $(<$i/type)"; done
; Default: 0
thermal-zone = 2

; Select thermal zone by name
; The name has to match the contents of /sys/class/thermal/thermal_zone*/type
; for the desired thermal zone.
; New in version 3.7.0
; Default: ""
zone-type = x86_pkg_temp

; Full path of temperature sysfs path
; Use `sensors` to find preferred temperature source, then run
; $ 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
; to find path to desired file
; Default reverts to thermal zone setting
hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input

; Base temperature for where to start the ramp (in degrees celsius)
; Default: 0
base-temperature = 50

; Threshold temperature to display warning label (in degrees celsius)
; Default: 80
warn-temperature = 70

; Whether or not to show units next to the temperature tokens (°C, °F)
; Default: true
units = true

; Available tags:
; <label> (default)
; <ramp>
format = <ramp> <label>

; Available tags:
; <label-warn> (default)
; <ramp>
format-warn = <ramp> <label-warn>

; Available tokens:
; %temperature% (deprecated)
; %temperature-c% (default, temperature in °C)
; %temperature-f% (temperature in °F)
; %temperature-k% (temperature in Kelvin, new in version 3.7.0)
label = %temperature-c%

; Available tokens:
; %temperature% (deprecated)
; %temperature-c% (default, temperature in °C)
; %temperature-f% (temperature in °F)
; %temperature-k% (temperature in Kelvin, new in version 3.7.0)
label-warn = %temperature-c%

; Requires the <ramp> tag
; The icon selection will range from `base-temperature` to `warn-temperature`,
; temperatures at and above `warn-temperature` will use the last icon
; and temperatures at and below `base-temperature` will use `ramp-0`.
; All other icons are distributed evenly between the two temperatures.
ramp-0 = %{F#C5C8C6}%{F-}
ramp-1 = %{F#E0B42F}%{F-}
ramp-2 = %{F#FF4747}%{F-}

; vim:ft=dosini

0 comments on commit 1c56e35

Please sign in to comment.