diff --git a/system.rc b/system.rc deleted file mode 100644 index eed8b0e..0000000 --- a/system.rc +++ /dev/null @@ -1,65 +0,0 @@ -background no - -cpu_avg_samples 2 -net_avg_samples 2 -diskio_avg_samples 2 -double_buffer yes -no_buffers yes -text_buffer_size 2048 -total_run_times 0 -update_interval 1.0 - -alignment tr -gap_x 20 -gap_y 10 -border_inner_margin 0 -border_outer_margin 0 -border_width 0 - -maximum_width 172 -minimum_size 172 12 - -own_window yes -own_window_class conky_system_monitor -own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager -own_window_argb_visual yes -own_window_transparent yes -own_window_type normal - -default_color E1E7CD -default_outline_color 281C06 -default_shade_color 281C06 -default_bar_size 172 4 - -draw_borders no -draw_graph_borders yes -draw_outline no -draw_shades no - -override_utf8_locale yes -use_xft yes -xftalpha 0.8 -xftfont DejaVu Sans:size=8 - -short_units yes - -lua_load system.lua - -TEXT -${color 2A403D}${font Poky:size=16}P${font} ${color B53C27}${hr}${color} -${voffset -20}${alignr}${offset -3}Intel Core i3 CPU 550 -${voffset 5}${alignr}${offset -3}3.20GHz -${voffset -3}${alignr}${offset -120}${font Open Sans Condensed Light:size=14}${cpu cpu0}%${font} -${voffset -22}${alignr}${offset -3}${cpugraph cpu0 16,110} -${goto 30}${lua cpu_temperature 0}${alignr}${offset -3}${lua cpu_temperature 1} -${voffset -4}${goto 30}${cpubar cpu1 3,60}${alignr}${offset -3}${cpubar cpu2 3,60} -${goto 30}${lua cpu_temperature 2}${alignr}${offset -3}${lua cpu_temperature 3} -${voffset -4}${goto 30}${cpubar cpu3 3,60}${alignr}${offset -3}${cpubar cpu4 3,60} -${voffset -4}${goto 30}${color 7F8484}${stippled_hr}${color} -${color 2A403D}${font Poky:size=16}M${font} ${color B53C27}${hr}${color} -${voffset -20}${alignr}${offset -3}⛂ ${mem} │ ⛀ ${memfree} -${voffset 5}${alignr}${offset -3}⛃ ${memmax} -${goto 30}RAM:${alignr}${offset -15}${memperc}%${offset -172}${alignr}${offset -3}${membar 3,60} - -${goto 30}SWAP:${alignr}${offset -15}${swapperc}%${offset -172}${alignr}${offset -3}${swapbar 3,60} -${voffset -4}${goto 30}${color 7F8484}${stippled_hr}${color} diff --git a/system.sh b/system.sh index dc74ff7..fc978af 100755 --- a/system.sh +++ b/system.sh @@ -13,6 +13,7 @@ CPU_SPEED="`sysctl -n hw.model | \ CPU_CORES="`sysctl -n hw.ncpu`" CPU_LOAD="" +NET_LOAD="" if [ ${CPU_CORES} -eq 1 ]; then CPU_LOAD='${goto 30}[cpu_temp]\ @@ -44,12 +45,36 @@ else done fi +case "$( uname )" in + "FreeBSD" ) + IFACES=$( ifconfig -lu | sed 's/lo[0-9]*//' );; + "Linux" ) + IFACES=$( ifconfig -s | awk '{print $1}' | sed '1d;/lo/ c\' );; + * ) + ;; +esac + +for IFACE in ${IFACES}; do + ETHER=$( ifconfig ${IFACE} | grep ether | awk '{print $2}' ) + INET=$( ifconfig ${IFACE} | grep inet | awk '{print $2}' ) + NL='${color 2A403D}${font Poky:size=16}w${font} ${color B53C27}${hr}${color}\ +${voffset -20}${goto 30}'${IFACE}'${alignr}${offset -3}'${INET}'\ +${voffset 5}${alignr}${offset -3}'${ETHER}'\ +${voffset 5}${goto 30}↑${alignr}${offset -15}${upspeed '${IFACE}'}${offset -172}${alignr}${offset -3}${voffset -7}${upspeedgraph '${IFACE}' 16,60}\ +${goto 30}↓${alignr}${offset -15}${downspeed '${IFACE}'}${offset -172}${alignr}${offset -3}${voffset -7}${downspeedgraph '${IFACE}' 16,60}\ +${voffset -4}${goto 30}${color 7F8484}${stippled_hr}${color}' + + NET_LOAD=${NET_LOAD}${NL}'\ +' +done + rm -f system.rc cat templates/system.tmpl | \ sed -E "s/\[cpu_name\]/${CPU_NAME}/; s/\[cpu_speed\]/${CPU_SPEED}/; - s/\[cpu_load\]/${CPU_LOAD}/" >> ./system.rc + s/\[cpu_load\]/${CPU_LOAD}/; + s/\[net_load\]/${NET_LOAD}/" >> ./system.rc conky -c system.rc & exit 0 diff --git a/templates/system.tmpl b/templates/system.tmpl index 9ea9db0..24292da 100644 --- a/templates/system.tmpl +++ b/templates/system.tmpl @@ -57,6 +57,6 @@ ${color 2A403D}${font Poky:size=16}M${font} ${color B53C27}${hr}${color} ${voffset -20}${alignr}${offset -3}⛂ ${mem} │ ⛀ ${memfree} ${voffset 5}${alignr}${offset -3}⛃ ${memmax} ${goto 30}RAM:${alignr}${offset -15}${memperc}%${offset -172}${alignr}${offset -3}${membar 3,60} - ${goto 30}SWAP:${alignr}${offset -15}${swapperc}%${offset -172}${alignr}${offset -3}${swapbar 3,60} ${voffset -4}${goto 30}${color 7F8484}${stippled_hr}${color} +[net_load]