You are not logged in.

#1 2016-05-27 20:02

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Display images in conky

I have been trying to get this to work properly for some time now and just cannot get the proper effect. What I am trying to achieve is display my conky with transparent background and an image embedded. To best explain this here is a picture of what it looks like :--
Normal conky
I have the images change when I unplug network like this :--
Normal conky
This all works well except that I cannot maintain the transparency effect when the image changes, what I end up with is this :--
Normal conky
if I change the desktop wallpaper the image re-gains it's transparency and all is well until another image change (connect wifi for example).
I have tried many variations of the configuration in conky itself but cannot get this working. If I try to use the argb_visual from conky I have to change the window type to normal and then I get this :--
Normal conky
which at least this stays transparent when the image changes, although it doesn't look how it should.
My conky is like this :--

update_interval 1
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1
imlib_cache_size 0
double_buffer yes
no_buffers yes
use_xft yes
xftfont DejaVu Sans:size=9
text_buffer_size 2048
own_window_class Conky
own_window yes
own_window_type override
#own_window_type normal
own_window_transparent yes
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#own_window_argb_visual yes
alignment top_right
gap_x 10
gap_y 10
minimum_size 350 250
maximum_width 350
draw_shades no
default_color efefef
default_shade_color 1d1d1d
short_units yes

TEXT
${voffset 17}${goto 96}CPU1: ${font DejaVu:bold:size=9}${cpu cpu1}%${font} ${alignr 15}Temp: ${font DejaVu:bold:size=9}${execi 30 sensors | grep 'Core 0' | cut -c16-17}°C${font}
${voffset 10}${goto 96}CPU2: ${font DejaVu:bold:size=9}${cpu cpu2}%${font} ${alignr 15}Temp: ${font DejaVu:bold:size=9}${execi 30 sensors | grep 'Core 1' | cut -c16-17}°C${font}
${voffset 34}${goto 96}RAM: ${font DejaVu:bold:size=9}${memperc}%${font}    Free: ${font DejaVu:bold:size=9}${memeasyfree} ${font}${alignr 22}Used: ${font DejaVu:bold:size=9}${mem}${font}
${voffset 10}${goto 96}Swap: ${font DejaVu:bold:size=9}${swapperc}%${font}    Free: ${font DejaVu:bold:size=9}${swapfree}${font} ${alignr 22}Used: ${font DejaVu:bold:size=9}${swap}${font}
${voffset 28}${goto 96}Down speed${goto 175}: ${font DejaVu:bold:size=9}${downspeed wlan0}${font} ${alignr 15}Total: ${font DejaVu:bold:size=9}${totaldown wlan0}${font}
${voffset 10}${goto 96}Up speed${goto 175}: ${font DejaVu:bold:size=9}${upspeed wlan0}${font} ${alignr 15}Total: ${font DejaVu:bold:size=9}${totalup wlan0}${font}
${voffset 12}${goto 96}Down speed${goto 175}: ${font DejaVu:bold:size=9}${downspeed eth0}${font} ${alignr 15}Total: ${font DejaVu:bold:size=9}${totaldown eth0}${font}
${voffset 10}${goto 96}Up speed${goto 175}: ${font DejaVu:bold:size=9}${upspeed eth0}${font} ${alignr 15}Total: ${font DejaVu:bold:size=9}${totalup eth0}${font}
${voffset 30}${goto 96}${if_gw}Public WAN Address ${alignr 10}${font DejaVu:bold:size=9}${execi 300 dig +short myip.opendns.com @resolver1.opendns.com}${font}${else}No Wan Connection Available${endif}
${voffset 10}${goto 96}${if_existing /proc/net/route eth0}Wired LAN Address${alignr 5}${font DejaVu:bold:size=9}${addrs eth0}${font}${voffset -4}${endif}
${image ~/Documents/conky/img/base.png -p 10,-3 -s 339x86}${image ~/Documents/conky/img/base.png -p 10,70 -s 339x86}${image ~/Documents/conky/img/base.png -p 10,137 -s 339x140}${image ~/Documents/conky/img/base.png -p 10,257 -s 339x86}${image ~/Documents/conky/img/cpu.png -p 24,19 -s 40x40}${image ~/Documents/conky/img/ram.png -p 24,92 -s 40x40}${if_existing /proc/net/route wlan0}${image ~/Documents/conky/img/network-wireless-online.png -p 24,162 -s 40x40}${else}${image ~/Documents/conky/img/network-wireless-offline.png -p 24,162 -s 40x40}${endif}${if_existing /proc/net/route eth0}${image ~/Documents/conky/img/network-wired.png -p 24,207 -s 40x40}${else}${image ~/Documents/conky/img/network-wired-disconnected.png -p 24,207 -s 40x40}${endif}${image ~/Documents/conky/img/web.png -p 24,279 -s 40x40}

and I start it with this script at boot time :--

#!/bin/bash
if pgrep conky > /dev/null
then
	killall conky
fi
if [[ $1 ]]; then if [ $1 == nowait ]; then :; else sleep 20; fi; else sleep 20; fi
conky -d -c ~/Documents/conky/my01.conkyrc &&
if [[ $1 ]]; then if [ $1 == nowait ]; then :; else sleep 2; fi; else sleep 2; fi
conky -d -c ~/Documents/conky/my02.conkyrc &&
if [[ $1 ]]; then if [ $1 == nowait ]; then :; else sleep 2; fi; else sleep 2; fi
conky -d -c ~/Documents/conky/my03.conkyrc &&
if [[ $1 ]]; then if [ $1 == nowait ]; then :; else sleep 2; fi; else sleep 2; fi
conky -d -c ~/Documents/conky/my04.conkyrc &&
if [[ $1 ]]; then if [ $1 == nowait ]; then :; else sleep 2; fi; else sleep 2; fi
conky -d -c ~/Documents/conky/my05.conkyrc &&

# this is required to allow the conkies to set before refreshing the wallpaper
sleep 2

# These two lines get the current wallpaper and re-apply it to refresh the desktop
variable=$(grep -rn -i -e "wallpaper\[\$e\]" ~/.trinity/share/config/kdesktoprc | awk -F"=" '{print $2}')
dcop kdesktop KBackgroundIface setWallpaper "${variable}" 6

exit

And in case anyone is wondering what the if statements are about, I use them so I get a delay loading when the machine first starts, but if I need to re-load them instantly I just type at the command line

$ ./multiple_conky nowait

So after all that does anyone have any suggestions that might get it functioning correctly?

Offline

Board footer

Powered by FluxBB