Peppermint | Linux OS Community Forum
 
It is currently Thu Jan 17, 2019 5:51 pm

All times are UTC - 5 hours [ DST ]





Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: [One][Ice][Two] Conky in all its wonder!
PostPosted: Sat Jun 19, 2010 10:34 pm 
Offline
User avatar

Joined: Tue May 25, 2010 9:00 am
Posts: 744
Location: Atlanta Ga
Class: Conky installation and usage
Difficulty: Comfortable with command line and editing conky config files
Time: 15 min to install, endless possibilities tweaking
Desirability: Great way to monitor system

Conky is a wonderful way to display system specs among other things right on your desktop. Here we will cover how to install, what the .conkyrc is and how to make it yours. This was written and tested by both Rich_Roast and myself so hopefully it works for you too.

Installation

Conky can be installed a few different ways. You can install from the software manager, synaptic package manager, or terminal with

Code:
apt install conky


Unfortunately conky won't leave a icon in the menu once it is installed so to get things started we will have to open a terminal, this can be done through the menu>Accessories?LXTerminal or ctl+alt+T. In the terminal enter:

Code:
conky &


This will open conky and leave it running even after you close the terminal. With this you should see something like this on your screen.

Image

Odds are, though, you want it to look different... not a problem, the only limit to what you can do is your imagination. There are quite a few places you can find .conkyrc files.


What is the .conkyrc

Now that I have mentioned the .conkyrc file a few times lets talk about what exactly that is. Like any other file starting with '.' it is hidden and resides in your home directory

Code:
~/ or /home/username/


This file holds all the prefferences conky needs to know what to display and how it should look. The following is a .conkyrc file that I have been using on Peppermint so if you would like you can copy it and change it as you desire.

Code:
# — Conky settings — #
#background yes
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 1440
imlib_cache_size 0

# — Window specifications — #

own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 50 10
maximum_width 1440

alignment bottomleft
gap_x 200
gap_y 20

# — Graphics settings — #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# — Text settings — #
use_xft yes
xftfont Zarautz special:size=24
xftalpha 0.7

uppercase no

default_color 000000
color1 D23000

TEXT

${font Zarautz special:size=20}${uptime_short}${font}${voffset -6}${offset 45}${font Zarautz special:size=24}${if_match ${cpu} >= 90}${color1}Cpu${color}${else}Cpu${endif}${font}${offset 10}${cpu}%${offset 45}${font Zarautz special:size=24}${if_match ${memperc} >= 85}${color1}Ram${color}${else}Ram${endif}${font}${offset 10}${memperc}%${voffset -8}${offset 45}${font Zarautz special:size=30}${time %I}${font Zarautz special:size=16}${voffset -16}${offset 10}${time %M}${font Zarautz special:size=16}${voffset 22}${offset -32}${time %p}${voffset -6}${offset 45}${font Zarautz special:size=20}How To:${offset 10}${font Zarautz special:size=16}${if_existing /proc/net/route wlan0}${texeci 120 python $HOME/.conky/gmailpep.py}${else}X${endif}${voffset -6}${offset 45}${font Zarautz special:size=20}Mail:${offset 10}${font Zarautz special:size=16}${if_existing /proc/net/route wlan0}${texeci 120 python $HOME/.conky/gmail.py}${else}X${endif}


This looks like this on the desktop:

Image

We will look at each part briefly to give you and understanding of what it does.

First we have 'Conky Settings', these define things internally to Conky such as how often to refresh system info and how often to check things on the internet, it also controls how much system resources it is allowed to use. Next are 'Window Specifications'. Conky is really just a specialized window as far as the desktop environment is concerned so this determines what the DE needs to do with Conky in order to display it, including the size of the window and where to position it. On that note, LXDE considers Conky to be a window like any other, so be aware that clicking on the 'minimize all windows' applet will minimize conky too, irretrievably. Following this are 'Graphics Settings', there are a few things here you can change to affect the appearance of the Conky display. The next few lines are 'Text Settings' which set the default font and size. Finally you will see the 'TEXT' area which holds the actual lines of code that will be read from the system and displayed on the desktop. Anything that is after the TEXT line will be interpreted by Conky as an item to display so if it is not in the order you want or formatted in a way Conky can recognize it may not look like you envisioned. Tweaking a .conkyrc file to exactly what you want is an artform and can be frustrating but when done can be anything you want it to be.

I could type forever and not cover everything about Conky so I will only cover the basics and provide resources for you to explore if you feel so inclined. Like any other form of programming there are commands which utilize arguments and options. The syntax works like this:

Code:
${command argument}


For example:

Code:
${voffset -6}${offset 45}${font Zarautz special:size=24}


would tell Conky to display the the next item offset horizontally 45 pixels, vertically -6 pixels and in 24 pt Zaurutz special font. You can find a list of these commands as well as the system parameters you can monitor at the Conky documentation page here.


Pulling in other files

In addition to what is found in the .conkyrc you can call upon other scripts to perform actions and then display them in Conky. This is how the number of emails is achieved above. To do this another file will need to be created somewhere in your home directory. I created a new folder .conky to hold files like this. This is the gmail script used above to display the number of unread mails:

Code:
import os
import string

#Enter your username and password below within double quotes
# eg. username="username" and password="password"
username="username"
password="password"

com="wget -O - https://"+username+":"+password+"@mail.google.com/mail/feed/atom --no-check-certificate"

temp=os.popen(com)
msg=temp.read()
index=string.find(msg,"<fullcount>")
index2=string.find(msg,"</fullcount>")
fc=int(msg[index+11:index2])

if fc==0:
   print "0"
else:
   print str(fc)+""



Once you have this file stored some where in your home directory you can pull it into Conky in the .conkyrc (after the TEXT line) like this:

Code:
${if_existing /proc/net/route wlan0}${texeci 120 python $HOME/.conky/gmail.py}${else}X${endif}


What this will do is display the number of new emails, if there is no connection or an error it will display 'X'. You may need to replace 'wlan0' with 'eth0' if your computer is plugged into the internet instead of running on wireless.


Autostart Conky in Peppermint

There are a couple ways to do this. I have used both and it seems to be that some computers like one way, some the other, and some just don't care. I would suggest you try the first method as it is easier and if that fails to work try the second method.

Method One

Enter the following in a terminal:

Code:
sudo leafpad /etc/xdg/lxsession/Peppermint/autostart


Add
Code:
@conky
as the very last line.

This should work...if it does not look at Method Two.

Method Two

To get Conky to run at startup you can also add a .desktop file to the following directory.

Code:
~/.config/autostart/


The contents of the .desktop that I was able to get working consistantly is this:

Code:
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=conky --config=$HOME/.conkyrc
Terminal=false
Name=Conkyrc
NoDisplay=true


If for some reason Conky isn't loading correctly or requires internet before it launches you can make it wait a specific amount of time before starting. To do this change the 'Exec=' command from

Code:
conky --config=$HOME/.conkyrc


to

Code:
sleep 10 && conky --config=$HOME/.conkyrc


This will force Conky to wait 10 seconds before starting.


Multiple .conkyrc's

That is right, you can run more than one .conkyrc at a time. All you need to do is change the name and set up a second (or third or eleventh .desktop file to start them). The best way to do this is using Method Two to start Conky at startup. The other option requires much more coding and a solid knowledge of how scripts work.

There are a ton of websites with Conky scripts available as well as s thread here on the Peppermint Forum in the Artwork section.

_________________
Peppermint Forums Moderator
Asus Eee PC | Pmint2 | Win XP | Arch (Fluxbox)
Toshiba Sat. P15 | Testing Machine
Custom AMD Desktop | Pmint2 64-bit | Win 7
My Site | Google+| Facebook | Twitter: @eng1nerd


Top
 Profile  
 
 

Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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

Search for:
Jump to:  

Powered by php B.B. © 2000, 2002, 2005, 2007 php B.B. Group
Template made by DEVPPL