Welcome!
Important information
-- Required MX 15/16 Repository Changes
-- Information on torrent hosting changes
-- Information on MX15/16 GPG Keys
-- Spectre and Meltdown vulnerabilities

News
-- Introducing our new Website
-- MX Linux on social media: here

Current releases
-- MX-18.3 Point Release release info here
-- Migration Information to MX-18 here
-- antiX-17.4.1 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

[SOLVED] Conky help needed

User avatar
JayM
Forum Regular
Forum Regular
Posts: 977
Joined: Tue Jan 08, 2019 4:47 am

[SOLVED] Re: Conky help needed

#11

Post by JayM » Sun Mar 17, 2019 7:49 am

jonnken wrote:
Sun Mar 17, 2019 7:39 am
In Spreadsheet grammar, an IF bracket encapsulates the AND logic result. So if two IF's are used to generate the AND true/false result...then wouldn't a third IF be needed to REDIRECT the AND result of the first two IF's?
I'm not using nested IFs to replicate an AND, I'm only saying IF thisA do this1 ELSE IF thisB do this2 ELSE do this3.
Last edited by JayM on Mon Mar 18, 2019 3:10 am, edited 1 time in total.
New users: Please read this first, and don't forget to add system and hardware information (Quick System Info) to posts!

User avatar
manyroads
Forum Guide
Forum Guide
Posts: 1490
Joined: Sat Jun 30, 2018 6:33 pm

Re: Conky help needed

#12

Post by manyroads » Sun Mar 17, 2019 8:24 am

If you look at the conky I wrote (see /home/,username>/.conky/MX-ManyRoads/) You'll find other (eye candy) ways of doing this sort of thing using graduated color bars. In mine I use it for disk, mem, but not temp.
"Don't believe everything you think."
Pax vobiscum,
Mark Rabideau - http://many-roads.com - Reg. Linux User #449130
MX-18.3 kernel: 5.1.5-antix.1-amd64-smp x86_6
Dell Latitude E5470
Intel i5-6300U~ 24GB RAM ~ SSD: 1TB
Coding since 1974

User avatar
fehlix
Forum Veteran
Forum Veteran
Posts: 3963
Joined: Wed Apr 11, 2018 5:09 pm

Re: Conky help needed

#13

Post by fehlix » Sun Mar 17, 2019 9:55 am

JayM wrote:
Sun Mar 17, 2019 4:46 am
I "unsolved" this because now my hard drive temperatures aren't behaving and I'm not seeing what the problem is. Maybe an extra pair of eyes will see what I'm missing. My drive sdb is currently at 41 degrees but its temp is still showing as green, not yellow.
See this:

Code: Select all

false:${if_match "41°C" <  40 } < 40°C ${else} >=40°C ${endif}
right:${if_match "41°C" < "40"} < 40°C ${else} >=40°C ${endif}
:puppy:
Gigabyte Z77M-D3H, Intel Xeon E3-1240 V2 (Quad core), 32GB RAM,
GeForce GTX 770, Samsung SSD 850 EVO 500GB, Seagate Barracuda 4TB

User avatar
JayM
Forum Regular
Forum Regular
Posts: 977
Joined: Tue Jan 08, 2019 4:47 am

Re: Conky help needed

#14

Post by JayM » Mon Mar 18, 2019 12:25 am

fehlix wrote:
Sun Mar 17, 2019 9:55 am
JayM wrote:
Sun Mar 17, 2019 4:46 am
I "unsolved" this because now my hard drive temperatures aren't behaving and I'm not seeing what the problem is. Maybe an extra pair of eyes will see what I'm missing. My drive sdb is currently at 41 degrees but its temp is still showing as green, not yellow.
See this:

Code: Select all

false:${if_match "41°C" <  40 } < 40°C ${else} >=40°C ${endif}
right:${if_match "41°C" < "40"} < 40°C ${else} >=40°C ${endif}
:puppy:
I didn't get much sleep last night as I had to get up very early to be somewhere by 8:30AM, so my brain isn't functioning well today. But I don't understand what you're saying, or rather, how I can make use of your example. However, you've given me a huge hint: I'd forgotten that "hddtemp /dev/sdb" returns "/dev/sdb: WDC WD5000AAKX-75U6AA0: 42°C" and piping that through "awk '{print $4}'" returns "42°C"" not "42". So what I need to figure out is how to pipe awk's results through something that removes the "°C"" from the end so the end result is just "42" in order to make my if statement work for the hard drive temps, or else use something other than that awk statement to extract just the temperature's number from the entire string produced by hddtemp (remove everything but the third and fourth characters from the end of the string. Please, please don't make me have to use sed, God!)

I'll take a little nap then see if I can figure this out.
New users: Please read this first, and don't forget to add system and hardware information (Quick System Info) to posts!

User avatar
JayM
Forum Regular
Forum Regular
Posts: 977
Joined: Tue Jan 08, 2019 4:47 am

Re: Conky help needed

#15

Post by JayM » Mon Mar 18, 2019 2:20 am

In bash

Code: Select all

$ hddtemp /dev/sda | awk '{print $3}' | sed 's/..$//'
38
and

Code: Select all

$ hddtemp /dev/sdb | awk '{print $4}' | sed 's/..$//'
43
give me the results I'm looking for, yet

Code: Select all

alignment top_right
background yes
background_color 000000
border_inner_margin 0
border_width 0
default_color FFFFFF
default_outline_color black
default_shade_color black
double_buffer yes
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
gap_x 0
gap_y 50
minimum_size 250 150
no_buffers yes
override_utf8_locale yes
own_window yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_argb_visual no
own_window_argb_value 255
own_window_class Conky
own_window yes
own_window_transparent no
own_window_type normal
pad_percents 2
short_units yes
stippled_borders 0
top_name_width 5
update_interval 1
uppercase yes
use_spacer right
use_xft yes
xftalpha 1.0 #0.2
xftfont Cure:bold:size=12

# Color scheme #
default_color ffffff

color1 FFFFFF
color2 FF9616
color3 1CE3BB
color4 FFFF00 #yellow
color5 009900 #green
color6 FF0000 #red
###########################
own_window_colour 000000
TEXT

${if_match ${hwmon 0 temp 1} <"40"}${color5}${hwmon 0 temp 1}°C${color}
	${else}
${if_match ${hwmon 0 temp 1} >"50"} ${color6}${hwmon 0 temp 1}°C${color}
	${else}
${color4}${hwmon 0 temp 1}°C${color}
${endif}
${endif}
${if_match ${exec /usr/sbin/hddtemp /dev/sda | awk '{print $3}' | sed 's/..$//'} <"40"}${color5}${exec /usr/sbin/hddtemp /dev/sda | awk '{print $3}'}${color}
	${else}
${if_match ${exec /usr/sbin/hddtemp /dev/sda | awk '{print $3}' | sed 's/..$//'} >"50"}${color6}${exec /usr/sbin/hddtemp /dev/sda | awk '{print $3}'}${color}
	${else}  
${color4}${exec "/usr/sbin/hddtemp /dev/sda | awk '{print $3}'"}${color}
${endif}
${endif}
		
${if_match ${exec /usr/sbin/hddtemp /dev/sdb | awk '{print $4}' | sed 's/..$//'} <"40"}${color5}${exec /usr/sbin/hddtemp /dev/sdb | awk '{print $4}'}${color}
	${else}
${if_match ${exec /usr/sbin/hddtemp /dev/sdb | awk '{print $4}' | sed 's/..$//'} >"50"}${color6}${exec /usr/sbin/hddtemp /dev/sdb | awk '{print $4}'}${color}
	${else}  
${color4}${exec /usr/sbin/hddtemp /dev/sdb | awk '{print $4}'}${color}
gives me Image
Why is 42°C still green instead of yellow?
New users: Please read this first, and don't forget to add system and hardware information (Quick System Info) to posts!

User avatar
JayM
Forum Regular
Forum Regular
Posts: 977
Joined: Tue Jan 08, 2019 4:47 am

Re: Conky help needed

#16

Post by JayM » Mon Mar 18, 2019 2:25 am

Solved it. I had to remove the quotation marks around the numbers 40 and 50 so they'll be treated as actual numeric values, not strings.
New users: Please read this first, and don't forget to add system and hardware information (Quick System Info) to posts!

Post Reply

Return to “Desktop Environment”