herbstluftwm: panel: add cpu-temp + show it

This commit is contained in:
Thomas Preisner 2016-12-08 23:30:25 +01:00
parent 0e66bbc27a
commit 93bc6e4e45

View file

@ -77,6 +77,12 @@ function icon() {
echo -n "^fg(#000000)^ro(1x$height)^fg()^bg(${color[${2}]})^fg(#151515) ^i(${iconpath}/${1}.xbm) ^fg(#000000)^ro(1x$height)^fg()^bg()" echo -n "^fg(#000000)^ro(1x$height)^fg()^bg(${color[${2}]})^fg(#151515) ^i(${iconpath}/${1}.xbm) ^fg(#000000)^ro(1x$height)^fg()^bg()"
} }
# CPU
function cpu() {
cpu=$(sensors | grep "Core" | cut -b 18-21)
echo -n $(icon temp yellow) ${cpu}
}
hc pad $monitor $panel_height hc pad $monitor $panel_height
{ {
@ -143,6 +149,12 @@ hc pad $monitor $panel_height
echo -n "^bg()^fg() ${windowtitle//^/^^}" echo -n "^bg()^fg() ${windowtitle//^/^^}"
# small adjustments # small adjustments
right="" right=""
# custom functions
for func in cpu; do
right="${right} $(${func})"
done
right="${right} ^bg() $(icon clock2 green) $date" right="${right} ^bg() $(icon clock2 green) $date"
right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g') right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g')
# get width of right aligned text.. and add some space.. # get width of right aligned text.. and add some space..