Add CPU sensor script for polybar status
This commit is contained in:
parent
db1c4bc508
commit
1c904a7254
|
@ -26,6 +26,7 @@ export EDITOR='/usr/bin/vim'
|
|||
export VISUAL='/usr/bin/vim'
|
||||
export PROMPT_COMMAND="$TMUX_GITBAR_DIR/update-gitbar; $PROMPT_COMMAND"
|
||||
export PATH=$PATH":$HOME/.local/bin/i3scripts"
|
||||
source cpusensor
|
||||
|
||||
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
|
||||
exec tmux
|
||||
|
|
|
@ -209,38 +209,19 @@ interval = 600
|
|||
; CPU Temp
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
[module/temp-cpu]
|
||||
type = internal/temperature
|
||||
type = custom/script
|
||||
; Seconds to sleep between updates
|
||||
; Default: 1
|
||||
interval = 0.5
|
||||
; 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 = 0
|
||||
; 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/hwmon2/temp1_input
|
||||
; Base temperature for where to start the ramp (in degrees celsius)
|
||||
; Default: 0
|
||||
base-temperature = 20
|
||||
; Threshold temperature to display warning label (in degrees celsius)
|
||||
; Default: 80
|
||||
warn-temperature = 60
|
||||
; Available tokens:
|
||||
; %temperature% (deprecated)
|
||||
; %temperature-c% (default, temperature in °C)
|
||||
; %temperature-f% (temperature in °F)
|
||||
label = %temperature-f%
|
||||
; Available tokens:
|
||||
; %temperature% (deprecated)
|
||||
; %temperature-c% (default, temperature in °C)
|
||||
; %temperature-f% (temperature in °F)
|
||||
label-warn = %temperature-f%
|
||||
label-warn-foreground = #f00
|
||||
exec = exec ~/.local/bin/i3scripts/cpusensor
|
||||
format = <label>
|
||||
tail = true
|
||||
label = %output% F°
|
||||
|
||||
; GPU Temp
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
|
||||
## ##
|
||||
## A script to find and return the CPU package temp sensor ##
|
||||
###############################################################################
|
||||
# bash.sh
|
||||
|
||||
for i in /sys/class/hwmon/hwmon*/temp*_input; do
|
||||
sensors+=("$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*})) $(readlink -f $i)");
|
||||
done
|
||||
|
||||
for i in "${sensors[@]}"
|
||||
do
|
||||
if [[ $i =~ ^coretemp:.Package.* ]]
|
||||
then
|
||||
export CPU_SENSOR=${i#*0}
|
||||
fi
|
||||
done
|
||||
|
||||
temp=$(cat $CPU_SENSOR)
|
||||
imperial=$(((9/5)+32))
|
||||
echo $(((temp/10000)*imperial))
|
||||
|
Loading…
Reference in New Issue