Last edited by -=hazard=-; August 5th, 2009 at 10:38 PM. Reason: Added Screen
I'm having a lot of trouble with this one. I'd like the wireless to display only if eth1 is connected, the wired only if wlan0 is connected, and I want it to display "NO CONNECTION" if neither is connected. Right now it displays the wireless regardless of what is connected. Here is what I have so far:
Code:${font Arial:bold:size=10}${color Tan1}NETWORK: WIRELESS ${color DarkSlateGray}${hr 2}${color}${font}${execi 600 rm *index.html* & wget http://www.showmyip.com/simple/} Public IP: ${alignr}${execi 600 cat index.html} Local IP: ${alignr}${addr eth1} ${color red}Down${alignr}${downspeed eth1}/s ${color green}Up${alignr}${upspeed eth1}/s${endif}${if_up wlan0} ${font Arial:bold:size=10}${color Tan1}NETWORK: WIRED ${color DarkSlateGray}${hr 2}${color}${font}${execi 600 rm *index.html* & wget http://www.showmyip.com/simple/} Public IP: ${alignr}${execi 600 cat index.html} Local IP: ${alignr}${addr wlan0} ${red}Down${alignr}${downspeed wlan0}/s ${green}Up${alignr}${upspeed wlan0}/s${endif}${color}
${if_existing /proc/net/route wlan0}$ ... 1st line of wlan0 code
..............
..............
last line of wlan0 code${else}$ ... 1st line of eth0 code
..............
..............
last line of eth0 code${endif}
${conky continues}
I'm almost certain that will do it after looking at Uncertain's little tip and these:
if_existing file (string) if FILE exists, display everything between if_existing and the matching $endif. The optional second paramater checks for FILE containing the specified string and prints everything between $if_existing and the matching $endif.I don't need any IF_ statements so I cannot say with 100% certainty that it will work, but logically it looks OK.else Text to show if any of the above are not true
EDIT: - did a TEST:
With a "slight" change in the above suggestion:
I get the results you see in the image attached.Code:wan0 - eth0 ${if_existing /proc/net/route wlan0}$ ... 1st line of wlan0 code .............. .............. last line of wlan0 code${else}first line of eth0 code .............. .............. last line of eth0 code${endif} conky continues
I do NOT have wan anything let alone wan0.
Good luck.
Bruce
Last edited by Bruce M.; August 5th, 2009 at 11:47 PM. Reason: adding info
Am I sure I'm reading this right? You want the Wireless information to display if you are connected with eth0 (wired I assume), and the Wired eth0 information to show if you are connected to the net with your wireless connection?
That would result in no information being shown.
See the post just above your post.
After the ${endif}"NO CONNECTION"
next line of your conky file
Have a nice day.
Bruce
Last edited by Bruce M.; August 5th, 2009 at 11:58 PM.
On line 5 of the code you end with ${endif}${if_up wlan0}
But you show NO ${if_up}
Try this:
have a good one.Code:${if_existing /proc/net/route eth1}${font Arial:bold:size=10}${color Tan1}NETWORK: WIRELESS ${color DarkSlateGray}${hr 2}${color}${font}${execi 600 rm *index.html* & wget http://www.showmyip.com/simple/} Public IP: ${alignr}${execi 600 cat index.html} Local IP: ${alignr}${addr eth1} ${color red}Down${alignr}${downspeed eth1}/s ${color green}Up${alignr}${upspeed eth1}/s${else}${if_existing /proc/net/route wlan0}${font Arial:bold:size=10}${color Tan1}NETWORK: WIRED ${color DarkSlateGray}${hr 2}${color}${font}${execi 600 rm *index.html* & wget http://www.showmyip.com/simple/} Public IP: ${alignr}${execi 600 cat index.html} Local IP: ${alignr}${addr wlan0} ${red}Down${alignr}${downspeed wlan0}/s ${green}Up${alignr}${upspeed wlan0}/s${endif}${color}
Bruce
Thanks for pointing $else out to me. Now I can do 3 colors
It turned out that ${if_match "battery_percent" < "31"} should have been ${if_match $battery_percent < 31}. Oh well. I made some bars for my 2 cores too.
Finally changing colors without having to run a extra scriptCode:${if_match $battery_percent < 11}${color red}${battery_bar BAT0}$color$else${if_match $battery_percent > 30}${battery_bar BAT0}$else${color yellow}${battery_bar BAT0}$color$endif$endif ${if_match ${cpu cpu1} > 89}${color red}${cpubar cpu1}$color$else${ifedit_match ${cpu cpu1} < 60}${cpubar cpu1}$else${color yellow}${cpubar cpu1}$color$endif$endif ${if_match ${cpu cpu2} > 89}${color red}${cpubar cpu2}$color$else${if_match ${cpu cpu2} < 60}${cpubar cpu2}$else${color yellow}${cpubar cpu2}$color$endif$endif
Last edited by miegiel; August 6th, 2009 at 02:32 AM. Reason: more code edits :-|
Bookmarks