神刀安全网

A Beginner's Guide To Conky

A Beginner's Guide To Conky

Conky Sample Output. 

Updated May 05, 2016 .

Introduction

Conky is a graphical tool which displays system information to your screen in real time. You can customise the Conky look and feel so that it displays the information you need it to.

By default the sort of information you will see is as follows:

  • Computer Name
  • Uptime
  • Frequency (In MHz)
  • Frequency (In GHz)
  • RAM Usage
  • SWAP Usage
  • CPU Usage
  • Processes / Running Processes
  • File Systems
  • Networking
  • Top Running Processes

In this guide I will show you how to install Conky and how to customise it.

Installing Conky

If you are using a Debian based Linux distribution such as any of the Ubuntu family (Ubuntu, Ubuntu MATE, Ubuntu GNOME, Kubuntu, Xubuntu, Lubuntu etc), Linux Mint, Bodhi etc then use the followingapt-get command:

sudo apt-get install conky

If you are using Fedora or CentOS use the followingyum command:

sudo yum install conky

For openSUSE you would use the following zypper command

sudo zypper install conky

For Arch Linux user the followingPacMan command

sudo pacman -S conky

In each of the cases above I have includedsudo to elevate your privileges. 

Running Conky

You can run conky straight from the terminal by running the following command:

conky

On its own it isn’t very good and you might find the screen flickers.

To get rid of the flicker run conky in the following way:s

conky -b

To get conky to run as a background process use the following command:

conky -b &

Getting Conky to run at start up differs for each Linux distribution.

This page shows how to do it for the most popular Ubuntu variants .

Creating A Configuration File

By default the Conky configuration file is located in  /etc/conky/conky.conf. You should create your own configuration file.

To create a configuration file for Conky open a terminal window and navigate to your home directory:

cd ~

From there you now need to navigate to the hidden config folder.

cd .config

You could have just typed (cd ~/.config) if you so wished. Read my guide on the cd command for more information about navigating the file system.

Now that you are in the .config folder run the following command to copy the default config file.

sudo cp /etc/conky/conky.conf .conkyrc

Create A Script To Run Conky At Startup

Adding conky by itself to the startup routine for whichever distribution and graphical desktop you are using doesn’t work very well.

You need to wait for the desktop to fully load. The best way to do this is to create a script to launch conky and run the script at startup.

Open a terminal window and navigate to your home folder.

Create a file called conkystartup.sh usingnano or eventhe cat command. (If you so wish you can make it hidden by placing a dot in front of the file name).

Enter these lines into the file

#!/bin/bash

sleep 10

conky -b &

Save the file and make it executable using the following command.

sudo chmod a+x ~/conkystartup.sh

Now add the conkystartup.sh script to the list of startup applications for your distribution.

By default Conky will now use your .conkyrc file in the .config folder. You can however specify a different config file if you so wish and this is useful if you intend to run more than one conky. (Perhaps 1 on the left side and 1 on the right).

First of all create two conky configuration files as follows:

sudo cp /etc/conky/conky.conf ~/.config/.conkyleftrcsudo cp /etc/conky/conky.conf ~/.config/.conkyrightrc

Now edit your conkystartup.sh and edit it as follows:

#!/bin/bash

sleep 10

conky -b -c ~/.config/.conkyleftrc &

conky -b -c ~/.config/.conkyrightrc &

Save the file.

Now when your computer reboots you will have two conkys running. You can have more than 2 running but remember that conky will in itself be using resources and there is a limit to how much system information you will want to show.

Changing The Configuration Settings

To change the configuration settings edit the conky configuration file you created in the .config folder.

To do this open a terminal and run the following command:

sudo nano ~/.config/.conkyrc

Scroll past the warranty statement until you see the words conky.config.

All the settings between the { and } within the conky.config section define how the window itself is drawn.

For instance to move the Conky window to the bottom left you would set the alignment to ‘bottom_left’. Going back to the concept of a left and right Conky window you would set the alignment on the left config file to ‘top_left’ and the alignment on the right config file to ‘top_right’.

You can add a border to the window by setting the border_width value to any number greater than 0 and by setting the draw_borders option to true.

To change the main text colour edit the default_color option and specify a colour such as red, blue, green.

You can add an outline to the window by setting the draw_outline option to true. You can change the outline colour by amending the default_outline_colour option. Again you would specify red, green, blue etc.

Similarly you can add a shade by changing draw_shades to true. You can then amend the colour by setting the default_shade_colour.

It is worth playing with these settings to get it to look the way you like it.

You can change the font style and size by amending the font parameter. Enter the name of a font that is installed on your system and set the size appropriately. This is one of the most useful settings as the default 12 point font is quite big.

If you want to leave a gap from the left side of the screen edit the gap_x setting. Similarly to change the position from the top of the screen amend the gap_y setting.

There are a whole host of configuration settings for the window. Here are some of the most useful ones

  • border_inner_margin – the margin between the border and the text
  • border_outer_margin – the margin between the border and the edge of the window 
  • default_bar_height – the height for bars (graph elements)
  • default_bar_width – the width for bars (graph elements)
  • default_gauge_height  
  • default_gauge_width
  • draw_graph_borders – choose whether graphs have borders
  • minimum_width – minimum width of the window
  • maximum_width – maximum width of the window
  • minimum_height – minimum height of the window
  • maximum_heigh – maximum height of the window
  • own_window_title – Give the conky window a title of your choosing
  • own_window_argb_visual – turn on transparency
  • own_window_argb_value – number between 0 and 255. 0 is opaque, 255 is fully transparent.
  • short_units – make units a single character
  • show_graph_range – shows the time range covered by a graph
  • show_graph_scale – shows the maximum value in scaled graphs
  • uppercase – show all text in uppercase

Configuring The Information Shown By Conky

To amend the information shown by Conky scroll past the conky.config section of the Conky configuration file.

You will see a section which starts like this:

"conky.text = [["

Anything you want displayed goes in this section.

The lines within the text section look something like this:

${color grey}Uptime:$color $uptime

The {color grey} specifies that the word uptime will be grey in colour. You can change this to any colour you wish.

The $color before $uptime specifies that the uptime value will be displayed in the default colour. The $uptime setting will be replaced with your system uptime.

You can scroll text by adding the word scroll in front of the setting as follows:

${scroll 16 $nodename – $sysname $kernel on $machine |}

You can add horizontal lines between settings by adding the following:

$hr

Here are some of the more useful settings that you might wish to add:

  • audacious_bar – Audacious music player progress bar
  • audacious_channels – Number of audacious channels for current tune
  • audacious_file – Filename for current tune
  • audacious_length – Length of current tune
  • audacious_playlist_length – Number of tunes in the playlist
  • battery_percent – Battery percentage
  • battery_time – Battery time remaining
  • cpu – CPU usage
  • cpubar – CPU bar chart
  • cpugauge – CPU gauge
  • desktop_name – Name of the desktop
  • diskio (device) – Displays disk io
  • distribution – Name of the distribution
  • downspeedf (net) – Download speed in kilobytes
  • exec command – Executes a shell command and displays output in conky
  • fs_bar – How much space is used on a file system
  • fs_bar_free – How much free space is available on a file system
  • fs_free – Free space on a file system
  • fs_free_perc – Free space as a percentage
  • image <path> – Displays an image
  • kernel – Kernel version
  • loadavg (1|2|3) – Load average for 1, 5 and 15 minutes
  • mem – Amount of memory in use
  • membar – Bar showing memory in use
  • memfree – Amount of free memory
  • memperc – Percentage of memory in use
  • mpd_album – Album in current MPD song
  • mpd_artist – Artist in current MPD song
  • mpd_bar – Bar of mpd’s progress
  • mpd_file – Filename for current mpd song
  • mpd_length – Song’s length
  • mpd_title – Song’s name
  • mpd_vol – Volume of MPD player
  • nodename – Hostname
  • processes – Total processes
  • running_processes – Processes in action
  • swap – Amount of swap space in use
  • swapbar – Bar showing swap usage
  • swapfree – Amount of free swap
  • swapmax – Total amount of swap
  • swapperc – Percentage of swap in use
  • threads – Total threads
  • time (format) – Local time
  • upspeedf – Upload speed
  • uptime – System uptime
  • user_names – list the users logged in
  • user_number – number of users logged in
  • user_times – length of time users have been logged in
  • utime – Time in UTC format
  • weather – weather info

Summary

There are a whole wealth of Conky configuration settings and you can find the full list by reading the Conky manual page .

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » A Beginner's Guide To Conky

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址