Conky Configuration

conky

A conky script displays system information on the desktop for easy reference. This is a variation of a conky script I found at Crunch Bang Linux which I adapted for use on my Ubuntu/Mint Linux systems. The script can be adapted as needed. A Web search for conky will turn up a plethora of scripts and creative ideas. You can find more information on conky at conky.sourceforge.net and conky.sf.net.

Installation

To install this script, open a terminal and enter the following commands: (Copy to the clipboard then paste to the terminal with Crtl-Shift-V)

  1. Check device names and processor information (Battery, processor, and network interfaces).
    upower -e
    cat /proc/cpuinfo
    ifconfig or ifconfig or ip link
  2. Install conky.
    sudo apt-get install conky
  3. Download the conky script to your home directory.
    wget -O .conkyrc https://www.dropbox.com/s/cppwf9dqyumjih3/conkyrc.txt?dl=0
  4. Download conky.desktop to your autostart folder.
    wget -O ~/.config/autostart/conky.desktop https://www.dropbox.com/s/gwq4l80rswwsjjm/conky.desktop?dl=0
  5. Open .conkyrc in a text editor and make any necessary adjustments to the script (see notes at the bottom of the page).
    gedit .conkyrc
  6. Start conky. Once the display appears, you may need to enter Crtl-c to get back to the command prompt. Since conky is in the autostart directory, it will start automatically at boot up.
    conky

You can edit .conkyrc while conky is running to fine tune it. When you save the file, the display will disappear momentarily and be redrawn.

Alternatively you can do any of the following:

  • Create .conkyrc in your home directory with a text editor, using the script below as a template (typing or copying & pasting).
  • Download conkyrc.txt, copy it to your home directory, and rename it as .conkyrc.
  • Add conky to your Startup Applications through the Ubuntu/Mint GUI:
    • Menu -> Preferences -> Startup Applications
    • The command path is: /usr/bin/conky

Rick’s conky script

background yes
use_xft yes
xftfont Sans:size=8
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 200
maximum_width 200
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
default_color white
default_shade_color black
default_outline_color white
alignment top_right
gap_x 12
gap_y 12
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no

TEXT
${font sans-serif:bold:size=8}SYSTEM ${hr 2}
$sysname $kernel $alignr $machine
Host:$alignr$nodename
Uptime:$alignr$uptime
File System: $alignr${fs_type}

${if_existing /sys/class/power_supply/BAT0/present} ${font sans-serif:bold:size=8}BATTERY ${hr 2}
$alignr${battery_percent BAT0}% remaining
${battery_bar}${battery_percent BAT0}
${endif}

${font sans-serif:bold:size=8}PROCESSORS ${hr 2}
Processor: ${execi 1000 cat /proc/cpuinfo | grep ‘model name’ | sed -e ‘s/model name.*: //’ | uniq | cut -c 1-24}
CPU Frequency:$alignr $freq_g GHz
CPU1: ${cpu cpu1}% ${cpubar cpu1}
# CPU2: ${cpu cpu2}% ${cpubar cpu2}
# CPU3: ${cpu cpu3}% ${cpubar cpu3}
# CPU4: ${cpu cpu4}% ${cpubar cpu4}

${font sans-serif:bold:size=8}MEMORY ${hr 2}
${font sans-serif:normal:size=8}RAM $alignc $mem / $memmax $alignr $memperc%
$membar

${font sans-serif:bold:size=8}DISKS ${hr 2}
${font sans-serif:normal:size=8}/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_used_perc /}%
${fs_bar /}
SWAP $alignc ${swap} / ${swapmax} $alignr ${swapperc}%
${swapbar}

${font sans-serif:bold:size=8}TOP PROCESSES ${hr 2}
${font sans-serif:normal:size=8}${top_mem name 1}${alignr}${top mem 1} %
${top_mem name 2}${alignr}${top mem 2} %
$font${top_mem name 3}${alignr}${top mem 3} %
$font${top_mem name 4}${alignr}${top mem 4} %
$font${top_mem name 5}${alignr}${top mem 5} %

${font sans-serif:bold:size=8}NETWORK ${hr 2}
Public IP: $alignr ${execi 3600 wget -O – -q ipv4.icanhazip.com}

${if_existing /proc/net/route eth0}
Private IP: $alignr ${addr eth0}
${downspeedgraph eth0}
DLS:${downspeed eth0} kb/s $alignr Total: ${totaldown eth0}
${upspeedgraph eth0}
ULS:${upspeed eth0} kb/s $alignr Total: ${totalup eth0}
${endif}

${if_existing /proc/net/route wlan0}
ESSID: $alignr ${wireless_essid wlan0}
Connection quality: $alignr ${wireless_link_qual_perc wlan0}%
Private IP: $alignr ${addr wlan0}
${downspeedgraph wlan0}
DLS: ${downspeed wlan0} kb/s $alignr Total: ${totaldown wlan0}
${upspeedgraph wlan0}
ULS: ${upspeed wlan0} kb/s $alignr Total: ${totalup wlan0}
${endif}

${alignc 35}${color0}${font Arial Black:size=26}${time %H:%M}${font}
${alignc} ${time %A %m-%d-%y}

Notes

14 April 2016 notes:

  • This script has worked well on my Ubuntu and Mint installations for both desktops and laptops. Your results may be different.
  • The script checks for network connections so it can be used for both wired and wireless connections. If your network interface names are something other than eth0 and wlan0, change them in the script as appropriate.
  • If no network connection exists, no network information will be displayed.

4 February 2017 update:

  • Added BATTERY to show the percentage of battery life remaining and a bar graph.
  • Added processor make and model to PROCESSORS. The ‘cut -c 1-xx’ portion should be edited for your processor. Run cat /proc/cpuinfo | grep ‘model name’ | sed -e ‘s/model name.*: //’ | uniq to see how many characters to include, starting from the first character after the colon in the model name line.
  • Added bar graphs for 4 processor cores. For fewer cores, simply delete or comment out the unnecessary entries. If you have more cores, copy the last entry and change the CPU number. Remember that conky counts from 1 while cpuinfo starts from 0. The script will display an error message if it tries to access non-existent processor cores.

11 February 2017 update:

  • The script now checks for the existence of BAT0. From a terminal, run upower -e to confirm the device name for your battery.
  • Starting with Linux kernel 2.6.24 using /proc to store ACPI information was discouraged and deprecated. Battery information should be in /sys/class/power_supply/BAT0/ . Check your own system to confirm directories and files.

14 February 2017 update:

  • I tested the command-line installation procedure and the wget commands worked as expected. Placing the conky.desktop file in the ~/.config/autostart folder will cause conky to run automatically at start-up.
  • I tested the installation with Peppermint 7 on a virtual machine and when I first ran conky, the script displayed an error message about trying to access a non-existent core.

15 February 2017 update:

  • Under PROCESSORS, I listed four cores with cores 2-4 commented out. Uncomment the additional cores as needed.

16 March 2017 update:

  • Under NETWORK, I changed the line to get the public IP address to Public IP: $alignr ${execi 3600 wget -O – -q ipv4.icanhazip.com} so it would display the address in IPv4 format. To display the address in IPv6 format, remove “ipv4.” from the line. Due to its length, the entire IPv6 address is not displayed.

21 March 2017 update:

  • I experienced problems with the conky display in Linux Mint 18.1 Serena Xfce because conky was launching before the desktop screen was completely drawn. I resolved it by modifying the EXEC line in conky.desktop to add a 15 second delay.
  • With a text editor modify ~/.config/autostart/conky.desktop as follows:
    • Exec=/usr/bin/conky -p 15

31 March 2017 update:

  • I change the wget commands to download the .conkyrc and conky.desktop files from my Dropbox account since I’m looking at closing down my hosting account.
  • If the date at the bottom of the display (under the time) is a little right of center, simply change the “${alignc 35}” in the next to last line of the script to read “${alignc}”, ignoring the parentheses of course. I’ve noticed this with Mint 18.x and it probably occurs with other distribution based on the Linux 4 kernel.
Advertisements
%d bloggers like this: