(Conky) How to not show "if_existing" if it's not exist
Hi all,
Im running on slackware 14.0.Im having some issue on conky. I use a few "if_existing" statement in the configuration file to display the network interface information if conky detect eth0/eth1/eth2/eth3. The problem comes when the system only detect one interface. Conky display lots of blank space for the un-detected interface. (Assume it only display eth0 information and show eth1,eth2 and eth3 as blank space) Question: Is there any way to remove those blank space/line? As in, take out the blank line/space if it doesn't detect the interface. I read up the manual page, it seems i can't find any argument to group it up. Advice needed. Thanks in advance. Screenshot: [URL="http://s23.postimg.org/k7umnh9e3/image.jpg"] Code:
alignment bottom_left |
if
then else endif works for conky also, I used it thusly: Code:
${if_mounted /media/flash}${goto 600}${color red}USB$color is ${fs_free_perc /media/flash/}% Free$color${else}${color red}USB Not Mounted$color${endif} If this doesn't provide enough incentive, maybe I'll have a look at it for Christmas, or the day after. http://conky.pitstop.free.fr/wiki/in...ments_%28en%29 |
if you add a new line (= press enter) in conkyrc's TEXT section, it will be displayed as such.
if you don't want spaghetticode, you can use \ at the end of each line (except where needed). |
Quote:
Quote:
|
Hello,
AFAIK, the only way to do that, is to have only one line of code (use \ for better readability), and use goto/voffset to move to the next line when required: Code:
${color red}Server IP:\ Hope this helps. Greetings. -- SeB |
Quote:
For me, vertical offset 23 with this font "xftfont Liberarion Mono:size=14" |
Quote:
Code:
${color red}Networking: "Notice the $endif at the end of the line – that’s how we close the $if_existing statement so that only the information between the two is conditional on the conditions being met" There is NO "then" just Code:
if You won't need the second if_existing for each adapter as the first if_existing would include it, if it exists. |
I think I did something similar by putting the ${endif} after the line feed, so something like:
Code:
${if_existing /proc/net/route eth0}${color darkgreen}eth0 ${color black}Up:$color ${upspeed eth0} kb/s ${color black}Total: $color ${totalup eth0} |
My nasty hack was to append the "if_existing" to the end of the PREVIOUS line, with the code to be executed on it's own line, including the endif and the next if.
That way, if the condition was true, it got a line-feed, if not, it didn't. But now, after a quick facepalm, I'm trying to figure out where to put a load of \'s so it makes sense to read again... :D |
Quote:
I'd just write a shell script and have conky call that, if it were me. |
That's not a hack at all, it's just using the formatting language as it is suppose to be used. The "if_existing...endif" blocks encompass all that will be shown should that condition be true and that includes any whitespace or line feeds. How else do you expect conky to know whether you want a line feed or not without you specifying it?
You were also, in my opinion, using too many "if_existing" blocks are you only need one per condition not one per line of text. |
All times are GMT -5. The time now is 07:45 PM. |