Conky with a little logic

View previous topic View next topic Go down

Conky with a little logic

Post by Dai_trying on Fri Jun 03, 2016 4:18 am

I thought I would put a post containing some information regarding my modification of one of the provided conky configurations, I basically added a few pieces of logic to change the images upon different events, in this case when the network connected/disconnected. Here is the conky without network connection.

And with wifi connected

And with a wired connection

If you would like to use this the configuration file is as follows :-
Code:
update_interval 1.0
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 yes
own_window_transparent yes
#own_window_type normal
#own_window_type desktop
#own_window_type dock
#own_window_type panel
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#own_window_argb_visual yes
#own_window_argb_value 0
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 wlx00225f13a266}${font} ${alignr 15}Total: ${font DejaVu:bold:size=9}${totaldown wlx00225f13a266}${font}
${voffset 10}${goto 96}Up speed${goto 175}: ${font DejaVu:bold:size=9}${upspeed wlx00225f13a266}${font} ${alignr 15}Total: ${font DejaVu:bold:size=9}${totalup wlx00225f13a266}${font}
${voffset 12}${goto 96}Down speed${goto 175}: ${font DejaVu:bold:size=9}${downspeed enp2s0}${font} ${alignr 15}Total: ${font DejaVu:bold:size=9}${totaldown enp2s0}${font}
${voffset 10}${goto 96}Up speed${goto 175}: ${font DejaVu:bold:size=9}${upspeed enp2s0}${font} ${alignr 15}Total: ${font DejaVu:bold:size=9}${totalup enp2s0}${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 wlx00225f13a266}Wireless LAN Address${alignr 10}${font DejaVu:bold:size=9}${addrs wlx00225f13a266}${font}${voffset -4}${else}${if_existing /proc/net/route enp2s0}Wired LAN Address${alignr 10}${font DejaVu:bold:size=9}${addrs enp2s0}${font}${voffset -4}${endif}${endif}
${image ~/conky/img/base.png -p 10,-3 -s 339x86}${image ~/conky/img/base.png -p 10,70 -s 339x86}${image ~/conky/img/base.png -p 10,137 -s 339x140}${image ~/conky/img/base.png -p 10,257 -s 339x86}${image ~/conky/img/cpu.png -p 24,19 -s 40x40}${image ~/conky/img/ram.png -p 24,92 -s 40x40}${image ~/conky/img/web.png -p 24,279 -s 40x40}${if_existing /proc/net/route wlx00225f13a266}${image ~/conky/img/network-wireless-online.png -p 24,162 -s 40x40}${else}${image ~/conky/img/network-wireless-offline.png -p 24,162 -s 40x40}${endif}${if_existing /proc/net/route enp2s0}${image ~/conky/img/network-wired.png -p 24,207 -s 40x40}${else}${image ~/conky/img/network-wired-disconnected.png -p 24,207 -s 40x40}${endif}
You will notice I have used a separate folder for my images, that is just to make it easier for me when I want to transfer this conky to another machine which may not have the correct images for me. Here they are for you.








I hope you will like what conky has to offer, if you look through the man pages
Code:
man conky
or just google conky variables you will find a huge amount of other things that are possible with conky. play around and enjoy. If there is something in the config file you do not understand please feel free to ask

Dai
avatar
Dai_trying

Posts : 77
Join date : 2016-05-20

Back to top Go down

Re: Conky with a little logic

Post by James Tobin on Fri Jun 03, 2016 4:40 am

ok I got it on my desktop with 2 problems. 1: the wifi shows disconnected but I am either connected to wifi or you are not looking at this post (haha). Also can I make it lower so it is not on the duck's head?

p.s. If we can figure those two things out I'll make thread sticky Very Happy





Last edited by James Tobin on Fri Jun 03, 2016 4:48 am; edited 1 time in total

___________________________________________________________________________________________________________________________________

The only good thing about Windows is that it never gives you any terminal illnesses.
Needless to say, Terminal illnesses are the only problem with Linux.
avatar
James Tobin

Posts : 667
Join date : 2016-05-05
Location : United States

https://tobinbridge.zohosites.com/

Back to top Go down

Re: Conky with a little logic

Post by James Tobin on Fri Jun 03, 2016 4:46 am

k never mind the second one. My problem was that I had to make the overlap like 600 instead of 10 to 30 haha. so what about the first one: wifi thing?

___________________________________________________________________________________________________________________________________

The only good thing about Windows is that it never gives you any terminal illnesses.
Needless to say, Terminal illnesses are the only problem with Linux.
avatar
James Tobin

Posts : 667
Join date : 2016-05-05
Location : United States

https://tobinbridge.zohosites.com/

Back to top Go down

Re: Conky with a little logic

Post by Dai_trying on Fri Jun 03, 2016 4:47 am

Ok first the wifi, check your adapters address by typing
Code:
ifconfig
and making a note of the wifi adapters id mine is in the config wlx00225f13a266 yours may be different, if it is replace all occurrences of mine to be yours.
Second the position can be adjusted by changing the setting "gap_x" to be higher, moving it further from the top bar. The amount will depend on how far down you want to go.
avatar
Dai_trying

Posts : 77
Join date : 2016-05-20

Back to top Go down

Re: Conky with a little logic

Post by James Tobin on Fri Jun 03, 2016 4:51 am

I didn't see anything like that... this is all I got

Code:
james@chalet:~$ ifconfig
enp5s0f1  Link encap:Ethernet  HWaddr 08:9e:01:d5:e8:2d 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:461380 errors:0 dropped:0 overruns:0 frame:0
          TX packets:461380 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:28992551 (28.9 MB)  TX bytes:28992551 (28.9 MB)

wlp4s0    Link encap:Ethernet  HWaddr 48:d2:24:83:38:96 
          inet addr:192.168.2.144  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::1f31:6846:ac76:6f1/64 Scope:Link
          inet6 addr: fe80::4951:ca3e:ad3d:476b/64 Scope:Link
          inet6 addr: fe80::904f:381d:7f23:e782/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1853027 errors:0 dropped:0 overruns:0 frame:0
          TX packets:820208 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2315496336 (2.3 GB)  TX bytes:135537872 (135.5 MB)

james@chalet:~$

___________________________________________________________________________________________________________________________________

The only good thing about Windows is that it never gives you any terminal illnesses.
Needless to say, Terminal illnesses are the only problem with Linux.
avatar
James Tobin

Posts : 667
Join date : 2016-05-05
Location : United States

https://tobinbridge.zohosites.com/

Back to top Go down

Re: Conky with a little logic

Post by Dai_trying on Fri Jun 03, 2016 4:52 am

Your wifi adapter appears to be wlp4s0
avatar
Dai_trying

Posts : 77
Join date : 2016-05-20

Back to top Go down

Re: Conky with a little logic

Post by James Tobin on Fri Jun 03, 2016 4:53 am

thanks. Also any way I can imbed a clock onto this one? also I'm marking as sticky Very Happy

___________________________________________________________________________________________________________________________________

The only good thing about Windows is that it never gives you any terminal illnesses.
Needless to say, Terminal illnesses are the only problem with Linux.
avatar
James Tobin

Posts : 667
Join date : 2016-05-05
Location : United States

https://tobinbridge.zohosites.com/

Back to top Go down

Re: Conky with a little logic

Post by James Tobin on Fri Jun 03, 2016 4:59 am

super, used Find and Replace on mousepad and that worked Very Happy I appreciate it, thaks a lot Very Happy

___________________________________________________________________________________________________________________________________

The only good thing about Windows is that it never gives you any terminal illnesses.
Needless to say, Terminal illnesses are the only problem with Linux.
avatar
James Tobin

Posts : 667
Join date : 2016-05-05
Location : United States

https://tobinbridge.zohosites.com/

Back to top Go down

Re: Conky with a little logic

Post by Dai_trying on Fri Jun 03, 2016 5:10 am

I use a script to start multiple conkies, here is my screenshot.

Here is the script I use at the moment, you can modify it to suit your needs.
Code:
#!/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 ~/conky/my01.conkyrc &&
if [[ $1 ]]; then if [ $1 == nowait ]; then :; else sleep 2; fi; else sleep 2; fi
conky -d -c ~/conky/my02.conkyrc &&
if [[ $1 ]]; then if [ $1 == nowait ]; then :; else sleep 2; fi; else sleep 2; fi
conky -d -c ~/conky/my03.conkyrc &&
if [[ $1 ]]; then if [ $1 == nowait ]; then :; else sleep 2; fi; else sleep 2; fi
conky -d -c ~/conky/my04.conkyrc &&
exit
If you change anything in your conkies and want to restart them just
Code:
chmod +x (scriptname)
to make the script executable, and then type
Code:
scriptname nowait
and it will restart immediately, I have a delay put in so that when it starts on bootup the desktop has a chance to set itself before the conkies try to appear.
to make the script run at startup instead of the current conky you can go to Settings Manager -> Session and Startup -> Application Autostart and select the item named "Start ChaletOS desktop clock(Start only one ChaletOS desktop clock and system monitor)" and click on edit, then replace click the file browser link next to the command and locate and select your script to run it when the system starts instead of the ChaletOS conky.
avatar
Dai_trying

Posts : 77
Join date : 2016-05-20

Back to top Go down

Re: Conky with a little logic

Post by James Tobin on Fri Jun 03, 2016 5:16 am

where do you get those .conkyrc files?

___________________________________________________________________________________________________________________________________

The only good thing about Windows is that it never gives you any terminal illnesses.
Needless to say, Terminal illnesses are the only problem with Linux.
avatar
James Tobin

Posts : 667
Join date : 2016-05-05
Location : United States

https://tobinbridge.zohosites.com/

Back to top Go down

Re: Conky with a little logic

Post by Dai_trying on Fri Jun 03, 2016 5:30 am

The clock is in the style changer modified to show day and month, the system info is a modified version of another one from the style changer, the other two are just plain conkies with a background image to make the blend in with the rest.
avatar
Dai_trying

Posts : 77
Join date : 2016-05-20

Back to top Go down

Re: Conky with a little logic

Post by James Tobin on Fri Jun 03, 2016 7:46 am

I actually may just use gdesklets instead for the clock and use conky for sys monitor.

___________________________________________________________________________________________________________________________________

The only good thing about Windows is that it never gives you any terminal illnesses.
Needless to say, Terminal illnesses are the only problem with Linux.
avatar
James Tobin

Posts : 667
Join date : 2016-05-05
Location : United States

https://tobinbridge.zohosites.com/

Back to top Go down

Re: Conky with a little logic

Post by Dai_trying on Fri Jun 03, 2016 8:27 am

That's the thing with Linux, sooo many choices. Smile
avatar
Dai_trying

Posts : 77
Join date : 2016-05-20

Back to top Go down

Re: Conky with a little logic

Post by bluphoenyx on Fri Jun 03, 2016 10:30 am

Choices are great, but every extra conky or gdesklet that is run uses resources. Granted, with modern computers this isn't a terrible burden.

I like Dai_trying's method of launching multiple conkys from a script. Simple and elegant. Still, I prefer desktop simplicity and tend to not run conky. I use gkrellm and the xfce4 panel for most things. Gkrellm can use themes that are easy to create and the program is simple to configure.

If adding the clock or other items to conky is required, then cut and paste from an existing conkyrc file into the user level one. The relevant items are the lines at the bottom of the conkyrc file. Watch for references or definitions to other things in the configuration text. Always work from a backup in case the changes don't give the desired results. The bash script or command line should resemble:

conky -c myconkyrc

 OR

conky --config=~/myconkyrc

To keep the theme changer from trashing any changes, launch conky with the your working config, not ~/.conkyrc.
avatar
bluphoenyx

Posts : 28
Join date : 2016-05-27

Back to top Go down

Re: Conky with a little logic

Post by James Tobin on Sun Jun 05, 2016 11:04 am

That may be a good idea, I may pursue that in the future, although gdesklets is nice Smile

___________________________________________________________________________________________________________________________________

The only good thing about Windows is that it never gives you any terminal illnesses.
Needless to say, Terminal illnesses are the only problem with Linux.
avatar
James Tobin

Posts : 667
Join date : 2016-05-05
Location : United States

https://tobinbridge.zohosites.com/

Back to top Go down

Re: Conky with a little logic

Post by bluphoenyx on Sun Jun 05, 2016 2:03 pm

My only complaint with gdesklets is that they tend to be java apps or python programs and use unnecessary resources. I think the reason that it bugs me is that I'm still used to conserving computer resources even though my current rig has a 4 core cpu and 4 gb or ram. This may also explain why I prefer the XFCE desktop environment to one with a lot of eye candy such as KDE. Plus, I used to help beta test XFCE back when the 4.x series was just beginning and used the 3.x version before that so I have a soft spot for it.
avatar
bluphoenyx

Posts : 28
Join date : 2016-05-27

Back to top Go down

Re: Conky with a little logic

Post by James Tobin on Sun Jun 05, 2016 2:19 pm

i have 12 GB RAM and core i7 so that doesn't bug me Very Happy

___________________________________________________________________________________________________________________________________

The only good thing about Windows is that it never gives you any terminal illnesses.
Needless to say, Terminal illnesses are the only problem with Linux.
avatar
James Tobin

Posts : 667
Join date : 2016-05-05
Location : United States

https://tobinbridge.zohosites.com/

Back to top Go down

Re: Conky with a little logic

Post by bluphoenyx on Mon Jun 06, 2016 4:54 am

Ok, now you're just bragging Smile.
avatar
bluphoenyx

Posts : 28
Join date : 2016-05-27

Back to top Go down

Re: Conky with a little logic

Post by James Tobin on Mon Jun 06, 2016 5:01 am

Neutral

___________________________________________________________________________________________________________________________________

The only good thing about Windows is that it never gives you any terminal illnesses.
Needless to say, Terminal illnesses are the only problem with Linux.
avatar
James Tobin

Posts : 667
Join date : 2016-05-05
Location : United States

https://tobinbridge.zohosites.com/

Back to top Go down

Re: Conky with a little logic

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum