SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2010-03-29 09:03:21

gruen
#! Member
From: Germany
Registered: 2008-12-03
Posts: 55

conky if_existing-endif problem

After playing a lot with Statler on my test partition, I decided to start from the beginning with a fresh install. So everything is up and running now (and some issues still unsolved on this particular machine).

But conky doesn't work as expected. The problem seems to be in the if_existing - endif section of my config file.

background yes
double_buffer yes
use_xft yes
xftfont Sans:size=8
override_utf8_locale yes
update_interval 4
own_window no
maximum_width 160
draw_shades no
draw_outline no
draw_borders no
default_color gray75
alignment bottom_right
gap_x 12
gap_y 30
no_buffers yes
uppercase no

TEXT
uptime $alignr $uptime_short

cpu $alignr ${cpu cpu1}% $alignr ${acpitemp}°

${if_existing /proc/net/route wlan0}wireless  $alignr ${wireless_essid wlan0} $alignr ${wireless_link_qual_perc wlan0}%

up $alignr ${upspeed wlan0}
down $alignr ${downspeed wlan0}${endif}

public $alignr ${execi 600 whatip}
${if_existing /proc/net/route wlan0}local $alignr ${addr wlan0}${endif}

Any ideas what's wrong?

Edit: Moderators: if this is the wrong forum please move my post to Tips, Tricks & Scripts/Conky Help. Thank you!

Last edited by gruen (2010-03-29 09:39:04)


Samsung N220 | Ubuntu 10.04 LTS | #! 11 "Waldorf" & Xfce
http://twitter.com/herrgruen

Offline

Help fund CrunchBang, donate to the project!

#2 2010-03-29 11:41:40

rich
#! Junkie
From: barcelona
Registered: 2009-01-26
Posts: 413
Website

Re: conky if_existing-endif problem

I had this on one of my old Conkys. It told me I had a problem with endifs as well regarding my wireless script.

Not being that much of a Conky hacker, I just used a different setup and it's ok.

Here is the offending code (which usually works ok)

WIRELESS ${hr 2}
${if_existing /proc/net/route wlan0}
${voffset -6}${font PizzaDude Bullets:size=14}O${font}   Up: ${upspeed
wlan0} kb/s ${alignr}${upspeedgraph wlan0 8,60 BEBEBE BEBEBE}
${voffset 4}${font PizzaDude Bullets:size=14}U${font}   Down: ${downspeed wlan0$
BEBEBE}
${voffset 4}${font PizzaDude Bullets:size=14}N${font}   Upload: ${alignr}${tota$
${voffset 4}${font PizzaDude Bullets:size=14}T${font}   Download: ${alignr}${to$
${voffset 4}${font PizzaDude Bullets:size=14}Z${font}   Signal: ${wireless_link$
${voffset 4}${font PizzaDude Bullets:size=14}a${font}   Essid: ${alignr}${wirel$
${voffset 4}${font PizzaDude Bullets:size=14}a${font}   Local Ip: ${alignr}${ad$
${else}${if_existing /proc/net/route wlan0}
${endif}${else}

So I would also be interested to see if the more experienced Conky hackers know why this happens on Conky 1.8

Offline

#3 2010-03-29 12:49:43

jpope
#! Junkie
From: USA
Registered: 2009-09-20
Posts: 276
Website

Re: conky if_existing-endif problem

I had this break in Statler also, and I use conky 1.8.0 in 9.04 also so I'm not certain that it's a conky thing...

I was able to get around the ${if_existing ...} by using ${if_up wlan0} instead.


--
...old school #! user now running Arch
jpope.org

Offline

#4 2010-03-29 13:46:23

rich
#! Junkie
From: barcelona
Registered: 2009-01-26
Posts: 413
Website

Re: conky if_existing-endif problem

jpope wrote:

I had this break in Statler also, and I use conky 1.8.0 in 9.04 also so I'm not certain that it's a conky thing...

I was able to get around the ${if_existing ...} by using ${if_up wlan0} instead.

That did it smile

I also had the /proc/net/route to remove as well as the ${if_existing ...}.

Changed to - ${if_up wlan0} and bingo!

I think we'll probably see a few changed commands in the new Conky, I may have to keep a cheat sheet posted somewhere.

Thanks for the help jpope!

@gruen
I don't actually see any "if_existing" or "endif" arguments in the code you posted. Can you copy and paste the full .conkyrc ?

Last edited by rich (2010-03-29 13:57:11)

Offline

#5 2010-03-29 19:43:40

gruen
#! Member
From: Germany
Registered: 2008-12-03
Posts: 55

Re: conky if_existing-endif problem

jpope wrote:

I had this break in Statler also, and I use conky 1.8.0 in 9.04 also so I'm not certain that it's a conky thing...

I was able to get around the ${if_existing ...} by using ${if_up wlan0} instead.

That does it, thanks! smile

@richs-lxh The complete code is already there!


Samsung N220 | Ubuntu 10.04 LTS | #! 11 "Waldorf" & Xfce
http://twitter.com/herrgruen

Offline

#6 2010-03-29 19:49:03

rich
#! Junkie
From: barcelona
Registered: 2009-01-26
Posts: 413
Website

Re: conky if_existing-endif problem

gruen wrote:
jpope wrote:

I had this break in Statler also, and I use conky 1.8.0 in 9.04 also so I'm not certain that it's a conky thing...

I was able to get around the ${if_existing ...} by using ${if_up wlan0} instead.

That does it, thanks! smile

@richs-lxh The complete code is already there!

Mybad! roll

I'm using a light theme, and I didn't see the scrollbar on the code box to see the hidden code at the bottom. I just scrolled down and saw what you meant. Sorry about that.

Offline

#7 2010-03-29 23:10:40

anonymous
The Mystery Member
From: Arch Linux Forums
Registered: 2008-11-29
Posts: 8,905

Re: conky if_existing-endif problem

richs-lxh wrote:

I may have to keep a cheat sheet posted somewhere.

Something like this?

http://conky.sourceforge.net/variables.html


Note: ** Please read before posting **

BTW if you wish to contact me, send me an e-mail instead of a PM.

Offline

#8 2010-04-01 03:55:28

vrkalak
#! Die Hard
From: Santa Fe, NM, USA
Registered: 2009-09-14
Posts: 1,490

Re: conky if_existing-endif problem

I don't understand this and have tried everything I can think of to 'fix it'

But, for the past 2 days my single-line across the top Conky has switched from being on the top to being on the bottom, behind tint2.

I have gone in and changed the settings in .Conkyrc files and I just plain deleted the whole Conky file, re-booted and made a new .Conkyrc file.

alignment top_center
gap_x 80
gap_y 00

Nothing has worked so far.  Still on the bottom behind tint2. 
I did change the gap 'y' and 'x' parts of the Conky source files so that Conky is just above tint2 now.

I have used the same Conky files for months ... this has not happened until now.

Advice on how to fix/change this, back to having my Conky on the top of the screen?

Last edited by vrkalak (2010-04-01 03:57:45)


Registered Linux User: #497030
DeviantART pageAsk.Debian
#!Crunchbang 'Waldorf' (Openbox) -- Mint-Debian Fluxbox Edition

Offline

#9 2010-04-03 17:55:48

Tunafish
#! Die Hard
From: the Netherlands
Registered: 2010-03-07
Posts: 1,201

Re: conky if_existing-endif problem

replacing ${if_existing /proc/net/route wlan0} by ${if_up wlan0} worked for me as well.
what to do with ${if_existing /proc/net/route eth0}   ? Anyone has a replacement for that (apart from looking if a cable is attached to my laptop)?

thanks...


sed 's/stress/relaxation/g'
Privacy & Security on #!

Offline

#10 2010-04-03 19:11:22

rich
#! Junkie
From: barcelona
Registered: 2009-01-26
Posts: 413
Website

Re: conky if_existing-endif problem

Tunafish wrote:

replacing ${if_existing /proc/net/route wlan0} by ${if_up wlan0} worked for me as well.
what to do with ${if_existing /proc/net/route eth0}   ? Anyone has a replacement for that (apart from looking if a cable is attached to my laptop)?

thanks...

Maybe i'm simplifying this too much, but ${if_up eth0} ?

Offline

#11 2010-04-03 19:13:06

rich
#! Junkie
From: barcelona
Registered: 2009-01-26
Posts: 413
Website

Re: conky if_existing-endif problem

anonymous wrote:
richs-lxh wrote:

I may have to keep a cheat sheet posted somewhere.

Something like this?

http://conky.sourceforge.net/variables.html

Yeah, similar, but with a little more information tongue

Actually, I meant a cheat sheet with the more common variables that my humble, basic Conkys I use.

Thanks for the link, bookmarked. smile

Last edited by rich (2010-04-03 19:13:28)

Offline

#12 2010-04-03 19:20:21

slapfish
#! Die Hard
From: Athens, Greece
Registered: 2009-10-22
Posts: 601

Re: conky if_existing-endif problem

I use this setup to print the ethernet or wireless or no network info:

alignment top_right
background yes
border_inner_margin 0
border_outer_margin 0
cpu_avg_samples 2
default_color white
default_shade_color black
default_outline_color white
double_buffer yes
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
short_units yes
gap_x 12
gap_y 12
maximum_width 500
max_port_monitor_connections 64
max_specials 512
max_user_text 16384
minimum_size 204 224
net_avg_samples 2
no_buffers yes
out_to_console no
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type desktop
own_window yes
update_interval 1.0
uppercase no
use_spacer none
use_xft yes
xftalpha 0.8
xftfont  Santana:size=10:style=bold
override_utf8_locale yes
if_up_strictness address
 
 
TEXT
${if_up eth0}${font dearjoe 5 CASUAL trial:size=26:style=bold}$alignc}Ethernet$font

$alignc}IP: ${addr eth0}
$alignc}GW: $gw_ip

${offset 75}${font RsbillsDng :size=14}w$font} ${upspeed eth0}/s
${offset 75}${font RsbillsDng :size=14}F$font} ${downspeed eth0}/s $else
${if_up wlan0}${font dearjoe 5 CASUAL trial:size=22:style=bold}$alignc}Wifi$font
${voffset 5}${font Webdings:size=6}$alignc${if_match ${wireless_link_qual_perc wlan0} >= 80}${color green}nnnnn$else${if_match ${wireless_link_qual_perc wlan0} >= 60}${color light green}nnnn$else${if_match ${wireless_link_qual_perc wlan0} >= 40}${color yellow}nnn$else${if_match ${wireless_link_qual_perc wlan0} >= 20}${color orange}nn$else${if_match ${wireless_link_qual_perc wlan0} >= 0}${color red}n$endif$endif$endif$endif$endif$font$color
$alignc}${wireless_essid wlan0}

$alignc}IP: ${addr wlan0}
$alignc}GW: $gw_ip

${offset 75}${font RsbillsDng :size=14}w$font} ${upspeed wlan0}/s
${offset 75}${font RsbillsDng :size=14}F$font} ${downspeed wlan0}/s$else
${font dearjoe 5 CASUAL trial:size=22:style=bold}$alignc}No network$font$endif

Offline

#13 2010-04-04 09:43:45

Tunafish
#! Die Hard
From: the Netherlands
Registered: 2010-03-07
Posts: 1,201

Re: conky if_existing-endif problem

richs-lxh wrote:
Tunafish wrote:

replacing ${if_existing /proc/net/route wlan0} by ${if_up wlan0} worked for me as well.
what to do with ${if_existing /proc/net/route eth0}   ? Anyone has a replacement for that (apart from looking if a cable is attached to my laptop)?

thanks...

Maybe i'm simplifying this too much, but ${if_up eth0} ?

that's what i thought, but it doesn't work...  i gave up on this one...


sed 's/stress/relaxation/g'
Privacy & Security on #!

Offline

#14 2010-04-04 12:06:23

slapfish
#! Die Hard
From: Athens, Greece
Registered: 2009-10-22
Posts: 601

Re: conky if_existing-endif problem

Maybe it's not that clear on my post but the key with if_up is the "if_up_strictness address" on the settings (above TEXT). then you can use this template:

${if_up eth0} YOUR SETUP FOR eth0 $else
${if up wlan0} YOUR SETUP FOR wlan0 $else
YOUR SETUP FOR NO NETWORK$endif

[EDIT]
This way if you have an ethernet cable connected you'll get the setup for eth0, if you're connected to wlan0 you'll get the wlan0 setup, and if you are not connected to either of them you can get something like "no network". If you are connecting to both networks simultaneously you have to change it like that:

${if_up eth0} YOUR SETUP FOR eth0 $else}No ethernet connection$endif
${if up wlan0} YOUR SETUP FOR wlan0 $else}No wireless connection$endif
[/EDIT]

When I get the 1.8.0rc1 conky, a couple of months ago, my setup with if_existing stopped to work and then I noticed the if_up strictness.
I hope this will work for you too

Last edited by slapfish (2010-04-04 12:22:08)

Offline

#15 2010-04-04 20:03:56

olembe
#! Junkie
From: Salisbury, England
Registered: 2009-04-29
Posts: 259

Re: conky if_existing-endif problem

My conky also stopped working just now after Synaptic upgraded it, but the if_up trick worked for me: many thanks!

Slapfish: Can you give us a little more information on what the if_up_strictness command does? It seems to be important, but I can't quite work out what exactly it does.

Also, does anybody know if it's possible in conky to do some sort of OR test? That is, would it be possible to have something like ${if_up wlan0 OR eth0} ?

Offline

#16 2010-04-04 20:13:41

slapfish
#! Die Hard
From: Athens, Greece
Registered: 2009-10-22
Posts: 601

Re: conky if_existing-endif problem

I'm quoting from the conky documentation:

How strict should if_up be when testing an interface for being up? The value is one of up, link or address, to check for the interface being solely up, being up and having link or being up, having link and an assigned IP address.

If I remember right without the strictness address I was always getting the setup between if_up and endif because the (eth0) interface was up but without address.

The OR thing you are asking is what you get with the else part. If eth0 is up then do "This" else if wlan0 is up then do "That" else (if none of them is up) do "something else" and if somewhere in the middle or in the end you have done anything continue after the endif.

My English isn't that good so I really hope I was clear enough.

Glad I could help in the first place anyway...

Offline

#17 2010-04-04 20:20:16

Tunafish
#! Die Hard
From: the Netherlands
Registered: 2010-03-07
Posts: 1,201

Re: conky if_existing-endif problem

Thanks, I didn't notice the if_up_strictness command in your setup.
Tonijn


sed 's/stress/relaxation/g'
Privacy & Security on #!

Offline

#18 2010-04-04 20:38:00

olembe
#! Junkie
From: Salisbury, England
Registered: 2009-04-29
Posts: 259

Re: conky if_existing-endif problem

Slapfish: your English is excellent! I was just asking if there was a proper OR command to avoid writing the same code more than once. If OR doesn't exist, it's not a big deal - it just would have been nice. Thanks again.

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo