LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (http://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Conky Configuration (http://www.linuxquestions.org/questions/linux-desktop-74/conky-configuration-866764/)

Ipozya 03-06-2011 11:00 AM

Conky Configuration
 
Hi I have two questions regarding conky:

1) On my bar, I include the following information about upload and download:

Code:

${color} Net: ${color e0e0e0}${font}${downspeed eth0}  ${totaldown eth0} ${color} downloaded ${color e0e0e0}  | ${color e0e0e0}${upspeed eth0} ${totalup eth0} ${color} uploaded
This works great but obviously does not display any information if I am using wireless (which I use about half the time). Is there anyway of coding it so that it checks if I am using eth0 or wlan0, instead of always eth0 (maybe look at ifconfig and see what's being used)?

2) My conky runs as a horizontal bar at the top of the screen. Sometimes the end of it gets cut off, however, even though it's only using 80% of screen width. Is there anyway to adjust this? Here is my entire .conkyrc

Code:


#avoid flicker
double_buffer yes

#own window to run simultanious 2 or more conkys
own_window  yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorate,sticky,skip_taskbar,skip_pager

#borders
draw_borders no
#border_inner_margin
#border_outer_margin

#shades
draw_shades yes

# Stippled borders?
stippled_borders 8

# border width
border_width 1

#position
gap_x 0
gap_y 0
alignment top_middle

#behaviour
update_interval 1

#colour
default_color  8f8f8f

#default_shade_color 000000
own_window_colour 262626

#font
use_xft yes
xftalpha 0.8
xftfont bauhaus:pixelsize=10
override_utf8_locale yes

#to prevent window from moving
use_spacer right
minimum_size 1268 0

#mpd
mpd_host localhost
mpd_port 6600

TEXT
CPU: ${color e0e0e0}${font} ${freq}Mhz  ${cpu}% ${cpubar 7,50} ${color} ${color e0e0e0} ${execi 30 acpi -t | head -n 1 | cut -c 16-19}C | ${color} Mem: ${color e0e0e0}${font}${mem} ${membar 7,50}  |  ${color} Root: ${color e0e0e0}${font}${fs_free /} ${color} Home: ${color e0e0e0}${font}${fs_free /home} | ${color} Mpd:  ${color e0e0e0}${font}${mpd_smart} | ${color} Up: ${color e0e0e0}${font}${uptime} | ${color} Battery: ${color e0e0e0}${battery} | ${color} Net: ${color e0e0e0}${font}${downspeed eth0}  ${totaldown eth0} ${color} downloaded ${color e0e0e0}  | ${color e0e0e0}${upspeed eth0} ${totalup eth0} ${color} uploaded

Thank you in advance!

andrewthomas 03-06-2011 02:25 PM

Quote:

Originally Posted by Ipozya (Post 4280541)
Hi I have two questions regarding conky:

1) On my bar, I include the following information about upload and download:

Code:

${color} Net: ${color e0e0e0}${font}${downspeed eth0}  ${totaldown eth0} ${color} downloaded ${color e0e0e0}  | ${color e0e0e0}${upspeed eth0} ${totalup eth0} ${color} uploaded
This works great but obviously does not display any information if I am using wireless (which I use about half the time). Is there anyway of coding it so that it checks if I am using eth0 or wlan0, instead of always eth0 (maybe look at ifconfig and see what's being used)?

Insert a conditional ${if_up eth0} code ${endif} then
add another line substituting wlan0 for eth0 with another conditional ${if_up wlan0} code ${endif}
Quote:

Originally Posted by Ipozya (Post 4280541)
2) My conky runs as a horizontal bar at the top of the screen. Sometimes the end of it gets cut off, however, even though it's only using 80% of screen width. Is there anyway to adjust this?

How big is your screen?

Try adjusting
Code:

#to prevent window from moving
use_spacer right
minimum_size 1268 0

maybe you can add

Code:

maximum_width 1680
just below the above set to whatever your screen width is.

Ipozya 03-06-2011 10:12 PM

Thank you for your response. I edited the config to read as follow:

.conkyrc
Code:

${color} Net: ${color e0e0e0}${font}${if_up eth0}${downspeed eth0}  ${totaldown eth0}${endif}${if_up wlan0}${downspeed wlan0}  ${totaldown wlan0}${endif}
${color} downloaded ${color e0e0e0}  | ${color e0e0e0}${if_up eth0}${upspeed eth0} ${totalup eth0}${endif}${if_up wlan0}${upspeed wlan0} ${totalup wlan0}${endif} ${color} uploaded

The conky bar now has 4 numbers each for downloaded and uploaded (2 for wlan, 2 for eth0), instead of only displaying the relevant one.

Could this be because ifconfig still displays eth0, lo and wlan0, so it thinks that the interface does exist?

EDIT: Solved the wlan0/eth0 issue. I had to add a line to the file:
Code:

if_up_strictness address
This checks that an interface has an ip address before it is considered up.

I am still having issues with the length of conky across top. I added the maximum_width and it did nothing. Still cuts off and only uses ~80% of screen width


All times are GMT -5. The time now is 11:55 PM.