Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Conky, break up the output of addrs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
jserink
Veteran
Veteran


Joined: 30 Jan 2004
Posts: 1008

PostPosted: Mon May 11, 2015 5:29 am    Post subject: Conky, break up the output of addrs Reply with quote

Hi All:

On my laptop I have conky set for a max width of 162 pixels which allows for:
1. The XFCe4 menu bar along the vertical left side,
2. My Win7 Pro KVM session with resolution of 1680 x 1050.

My problem is, in the office I have 2-5 IP addresses on my Ethernet interface and with this max width, the scroll off the end of the screen.
$color ${addrs enp0s25}

The above command outputs the IPs sequentially in the same row with no apparent way to break the row up. I messed a bit with sed and grep but no luck.
What I want is 1 IP on top of the other.
So here is my work around:
$color${texeci 30 ip addr show enp0s25 | grep -Po 'inet \K[\d.]+'}

That beautiful little grep regex which I googled cleans up the output of 'ip addr show enp0s25' nicely and gives all the ips one of top of the other. I call this every 30 seconds in its own thread, works a treat.

My whole conky config is shown below:
alignment bottom_right
background no
border_width 1
cpu_avg_samples 2
default_color green
default_outline_color yellow
default_shade_color green
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
use_xft yes
xftfont DejaVu Sans Mono:size=8
gap_x 5
gap_y 5
minimum_size 5 5
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline no
#window bits that make conky fully transparent
#own_window yes
#own_window_class Conky
#own_window_type override
#own_window_transparent yes
#window bits for semi transparent
own_window yes
own_window_transparent no
own_window_argb_visual yes
own_window_argb_value 90
own_window_class Conky
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#Finish window bits
stippled_borders 0
update_interval 1.0
uppercase no
use_spacer right
show_graph_scale no
show_graph_range no
double_buffer yes
pad_percents 3
maximum_width 162

TEXT
#${scroll 16 $nodename - $sysname $kernel on $machine | }
${color yellow}$nodename
$sysname $kernel
$hr
${color yellow}Uptime:$color $uptime
${color yellow}Localtime:$color $time
${color yellow}CPU1:$color ${freq_g 1} GHz ${execi 10 sensors | grep "Core 0" | cut -c17-24}
${cpu cpu1}% ${cpugraph cpu1 11,85}
${color yellow}CPU2:$color ${freq_g 2} GHz ${execi 10 sensors | grep "Core 0" | cut -c17-24}
${cpu cpu2}% ${cpugraph cpu2 11,85}
${color yellow}CPU3:$color ${freq_g 3} GHz ${execi 10 sensors | grep "Core 1" | cut -c17-24}
${cpu cpu3}% ${cpugraph cpu3 11,85}
${color yellow}CPU4:$color ${freq_g 4} GHz ${execi 10 sensors | grep "Core 1" | cut -c17-24}
${cpu cpu4}% ${cpugraph cpu4 11,85}
${color yellow}CPU5:$color ${freq_g 5} GHz ${execi 10 sensors | grep "Core 2" | cut -c17-24}
${cpu cpu5}% ${cpugraph cpu5 11,85}
${color yellow}CPU6:$color ${freq_g 6} GHz ${execi 10 sensors | grep "Core 2" | cut -c17-24}
${cpu cpu6}% ${cpugraph cpu6 11,85}
${color yellow}CPU7:$color ${freq_g 7} GHz ${execi 10 sensors | grep "Core 3" | cut -c17-24}
${cpu cpu7}% ${cpugraph cpu7 11,85}
${color yellow}CPU8:$color ${freq_g 8} GHz ${execi 10 sensors | grep "Core 3" | cut -c17-24}
${cpu cpu8}% ${cpugraph cpu8 11,85}
${color yellow}RAM :$color $mem $memmax
$memperc% ${membar 4,85}
${color yellow}Swap:$color $swap/$swapmax
$swapperc% ${swapbar 4,85}
${color yellow}CPU :$color $cpu% ${cpubar 4}
${color yellow}Processes:$color $processes
${color yellow}Running :$color $running_processes
${color yellow}Threads :$color $threads
$hr
${color yellow}Networking
${if_up wlp3s0}wlp3s0
$color${addrs wlp3s0}
${color yellow}Up:$color ${upspeed wlp3s0} ${upspeedgraph wlp3s0 11,70}
${color yellow}Dn:$color ${downspeed wlp3s0} ${downspeedgraph wlp3s0 11,70}${endif}
${if_up wlp0s29u1u2}wlp0s29u1u2
$color${addrs wlp0s29u1u2}
${color yellow}Up:$color ${upspeed wlp0s29u1u2} ${upspeedgraph wlp0s29u1u2 11,70}
${color yellow}Dn:$color ${downspeed wlp0s29u1u2} ${downspeedgraph wlp0s29u1u2 11,70}${endif}
${if_up enp0s25}${color yellow}enp0s25
#$color ${addrs enp0s25}
$color${texeci 30 ip addr show enp0s25 | grep -Po 'inet \K[\d.]+'}
${color yellow}Up:$color ${upspeed enp0s25} ${upspeedgraph enp0s25 11,70}
${color yellow}Dn:$color ${downspeed enp0s25} ${downspeedgraph enp0s25 11,70}${endif}
${if_up tap0}${color yellow}tap0
$color${addrs tap0}
${color yellow}Up:$color ${upspeed tap0} ${upspeedgraph tap0 11,70}
${color yellow}Dn:$color ${downspeed tap0} ${downspeedgraph tap0 11,70}${endif}
${if_up ppp0}${color yellow}ppp0
$color${addrs ppp0}
${color yellow}Up:$color ${upspeed ppp0} ${upspeedgraph ppp0 11,70}
${color yellow}Dn:$color ${downspeed ppp0} ${downspeedgraph ppp0 11,70}${endif}
${if_up ppp1}${color yellow}ppp1 Up:$color ${upspeed ppp1} ${upspeedgraph ppp1 11,23}
${color yellow}Dn:$color ${downspeed ppp1} ${downspeedgraph ppp1 11,23}${endif}
${if_up wlp3s0}$hr${color yellow}Wireless Information:
${color yellow}AP : $color${wireless_essid wlp3s0}
${color yellow}Bitrate: $color${wireless_bitrate wlp3s0}
${color yellow}Link : $color${wireless_link_qual_perc wlp3s0}%
${endif}
${if_up wlp0s29u1u2}
$hr${color yellow}Wireless Information:
${color yellow}Mode : $color${wireless_mode wlp0s29u1u2}
${endif}

$hr
${color yellow}Temperatures
${color yellow}HDD:${color} +${hddtemp /dev/sda} °C
${color yellow}ATI:${color} ${execi 5 sensors | grep -A 2 'radeon-pci-0100'| grep 'temp1'|cut -c15-22}
${color yellow}CPU:${color} ${execi 5 sensors | grep "Physical id 0: "|cut -c17-24}
$hr
${color yellow}Power
${color yellow}AC Adapter: ${color}${acpiacadapter}
${color yellow}Bat State : ${color}${battery}%
${color yellow}Bat Cap : ${color}${battery_percent}%
${color yellow}Time Left : ${color}${battery_time}
$hr
${color yellow}sda wrt:$color ${diskio_write /dev/sda} ${diskiograph /dev/sda 12,35} ${color yellow}
rd:$color ${diskio_read /dev/sda} ${diskiograph_read /dev/sda 11,35}
${color yellow}sdb wrt:$color ${diskio_write /dev/sdb} ${diskiograph /dev/sdb 12,35} ${color yellow}
rd:$color ${diskio_read /dev/sdb} ${diskiograph_read /dev/sdb 11,35}


Cheers,
John
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum