Conky temperature

Hi, I was working on my Conky, the sysinfo box was not showing me the temperature, I solved it by inserting the following lines at the end.

#This shows us the temperature of the processors.
${color}Temperature ${color}$hr
Core 1 ${color}$alignr${exec sensors | grep 'Core 1' | cut -c10-21} C
Core 0 ${color}$alignr${exec sensors | grep 'Core 0' | cut -c10-21} C

This is how the result looks like, now I have to find how to modify the colors, I tried with colorizer but I can’t get the expected result, surely I need to touch something in the general configuration.

Translated with DeepL Translate: The world's most accurate translator (free version)

1 Like

Just use variables:${color}, ${color0} , ${color1}, ${color2}. Colorizer will handle them.

2 Likes

Hi, @napcok I tried it but they show in a disordered way, for example the line that follows Temperature is combined with Core below and what I want is that the line and the °C have one color and the rest have the same color. Surely a mistake I am making with the location of the variables. I will find the solution. :+1:

Take a look how those variables are used on lines above.
Hint:
Conky is reloaded automatically on every config file save - that should help to figure this out quickly.

1 Like

Hi again. Yes, I was looking and trying to reproduce what was already in the original code, as I could not get it to behave in the same way, I started to make changes.
Yes, I see that Conky updates every time I save the changes. Thank you.

1 Like

I finally figured out how to do it, defined and added a 3rd color as red, modified the added lines so that each thing has its color as I want it. Now I’m happy.

#Esto nos muestra la temperatura de los procesadores
${color}Temperatura ${color0}$hr
${color1}Core 1 $alignr ${color3}${exec sensors | grep 'Core 1' | cut -c10-21} C
${color1}Core 0 $alignr${color3}${exec sensors | grep 'Core 0' | cut -c10-21} C
${voffset -50}

4 Likes

I modified your file and I stay as follows, I would not have made it without your contribution, thanks

2 Likes

Hi @everardo17

I don’t know why sometimes I can’t reply from my cell phone.
Glad to know I helped :+1::+1::+1::+1::+1::+1::+1::+1::+1::+1::+1:.

1 Like

Yes, I have been away from Linux but I have already returned to good practices

1 Like

Hi @Claudio ,

I added the core temp to my conky. Thanks for the work…

For the exchange two other output tweaks you maybe like.

  • System Uptime, with a pronounceable output.
  • Day’s of Mabox installed on the computer.
    For this, I created “mabox_days_installed.sh” that displays the installed days. inspired by Mabox Control Center.

Conky :

# Uptime pronounceable output with uptime -p
${alignr}${color0}system ${color}${execpi 5 uptime -p}

# How many day's Mabox is installed
${alignr}${color}${alignr}day's installed ${color0}${execpi 20000 mabox_days_installed.sh}${font}${color0}

~/bin/mabox_days_installed.sh

#!/bin/bash

input=$(sed 1q /var/log/pacman.log)

date_part=$(echo "$input" | grep -o -E '\[[0-9]{4}-[0-9]{2}-[0-9]{2}')
start_date=$(echo "$date_part" | awk -F ']' '{print $1}' | tr -d '[]')

# Define the start date and format
date_format="%Y-%m-%d"

# Get the current date in the same format
current_date=$(date +$date_format)

# Convert both dates to UNIX timestamps
start_timestamp=$(date -d "$start_date" +%s)
current_timestamp=$(date -d "$current_date" +%s)

# Calculate the difference in seconds
date_diff=$((current_timestamp - start_timestamp))

# Calculate the difference in days
days_diff=$((date_diff / 86400))

# Output the result


echo "$days_diff"

edit 07-11: add Conky pix with temp bar … noblank … mount …

:bird:

2 Likes

Hi, @muzqs very interesting to calculate the time since the distro was installed. I see that you have to make a script too, I’m still not very proficient in that, I must study a little more and then try it.

1 Like

Install date and days since installation is also shown in mcc (Mabox Control Center)

Here how this is calculated in mcc script (if you like to use it somewhere)

# Install date ($INST)
INST="$(sed 1q /var/log/pacman.log)"
INST="${INST/ */}"
INST="${INST/T*/}" # newer pacman adds a different timestamp (TXX:XX:XX+0000), we just want the date
INST="${INST/\[/}"

# Days ago ($DIFF)
TODAY=$(date +%F)
let DIFF=($(date +%s -d ${TODAY})-$(date +%s -d ${INST}))/86400
2 Likes

Got my inspiration from mcc. I did’t know how to use the lines from mcc script. That’s why i created a seperate script.
:bird:

1 Like