King of the Desktop
Total Page:16
File Type:pdf, Size:1020Kb
Confi guration King of the Desktop Turn your desktop into a dashboard that dis- plays system monitoring data, weather updates, news headlines, and more with Conky. BY DMITRI POPOV When it comes to system monitoring tools, You should then see the Conky panel in all its color. In the example below, Conky renders a Conky [1] rules the roost supremely. This light- beauty at the bottom of the screen. transparent 300-pixel-wide window superim- weight utility can help you keep an eye on vir- posed on the desktop in the top right corner of tually any aspect of your system, and it offers a Configuring Conky the screen: long list of options for you to tweak. But dis- By default, Conky’s configuration options are playing various information about your system stored in the .conkyrc file, which is split into maximum_width 300 is only one of Conky’s many talents: You can two parts: the first controls Conky’s appear- own_window_transparent yes use this nifty tool to pull headlines from RSS ance, and the second specifies which parame- own_window_type override feeds, check email, view the weather forecast, ters to monitor and how to display them. To alignment top_right and even execute commands and display out- learn the ropes, I’ll show you how to create a put right on your desktop. In other words, configuration file from scratch. So, fire up your By default, you can place the Conky window Conky lets you turn the desktop into a power- favorite text editor to get ready to go. at any of the four corners of the screen using ful dashboard that feeds you all the important To begin, you must specify the update inter- the alignment top_left, alignment top_right, information. val, or how often Conky “collects” the moni- alignment bottom_left, and alignment bottom_ Configuring Conky can be a daunting prop- tored data. This is done by specifying the up- right options. But what if you want to move the osition, but despair not: I’ll demonstrate how date_interval option in seconds, for example window slightly to the left or a little bit down? to tweak Conky’s settings and put this powerful update_interval 1.0 or update_interval 5.0. You To do this, you can use the gap_x and gap_y tool to some clever uses. must also set the total_run_times option to 0 to options, which specify the distance between let Conky run until you close it. the borders of the screen and the window: Install Conky By default, Conky uses a monospace font, Because Conky is available in Ubuntu software but you can instruct it to use any font installed gap_x 10 repositories, installing it is a matter of running on your system by enabling the use_xft option gap_y 35 the sudo apt-get install conky command. Be- and specifying a font in the xftfont setting. For sides the core package, you might want to in- example, if you want Conky to use Droid Sans If you don’t want text in the Conky window to stall a few third-party additions that extend Mono 9pt font, these options should be: appear in caps, use the uppercase no option. Conky’s functionality. Conky offers many more configuration options To do this, you have to add the conkyhard- use_xft yes for you to tweak, but these will get you started. core personal package archive (PPA) using the xftfont Droid Sans Mono:size=9 With the basic display options in place, you following command: override_utf8_locale yes can start adding and configuring the system parameters you want Conky to monitor. This is sudo apt-add-repository U The last parameter forces Conky to use UTF8 done using so-called variables. For example, to ppa:conkyhardcore/ppa && U encoding when use_xft yes is enabled. display the kernel version of your system, you sudo apt-get update Quite often, the Conky window might flicker can use the kernel variable. Note that each during refreshing, which can be very annoying. variable is preceded by the $ sign. Conky also Conky has two options to help you to combat includes a few variables that allow you to con- Getting a Taste of Conky that problem. The double_buffer option lets trol the appearance of the output. The color Before you get your hands dirty tweaking Con- Conky use the X double-buffer extension that variable allows you to specify text color, ky’s configuration file, you might want to get a can eliminate flickering. If enabling double_ whereas the alignr variable allows you to right- taste of Conky’s capabilities using one of many buffer doesn’t help, you can use the own_win- justify text. To see how this works in practice, ready-to-use solutions like Conky Ubuntu dow option that forces Conky to run in a sepa- take a look at the following example: Lucid Theme (Figure 1) [2]. Grab the latest ver- rate window. To be on the safe side, you might sion of the theme, unpack the downloaded ar- want to enable both options: ${color lightgrey}Uptime:$color U chive and move the resulting .conkytheme $uptime $alignr${color lightgrey}U folder to your home directory. double_buffer yes Load:$color $loadavg Launch the terminal and run the following own_window yes command: The ${color lightgrey} variable sets the text to The next step is to specify the window settings, light gray. To switch to the default color (white), conky -c ~/.conkytheme/conkyrc including its width, alignment, and default use the color variable without a parameter. 86 ISSUE 06 DISCOVERY GUIDE Confi guration Conky sports several graphing variables that If you want to keep an eye on the download use Conky to go out and get the very latest you can use to visualize monitored data. The and upload speed, you can use the headlines from your favorite RSS feed: cpugraph variable, for example, displays CPU downspeedf and upspeedf variables (or usage as a graph. When used without any pa- downspeed and upspeed variables if you don’t ${rss http://www.linux-magazine.com/U rameters, the graph is shown using the default want to display the trailing decimal): rss/feed/productivity_sauce 10 U solid color, but you can use Hex color values item_titles 5} to specify gradients, which make the graph ${color lightgrey}Download speed: U look much better: $color${downspeedf wlan0} Kb/sec In the example above, Conky fetches the five most recent headlines from the Productivity ${cpugraph 000000 ffffff} Alternatively, you can use the downspeed- Sauce blog’s RSS feed every 10 minutes. Be- graph and upspeedgraph variables to display cause Identi.ca and Twitter publish updates via To display the memory-related data, you can the download and upload speeds as graphs. RSS, you can use the rss variable to keep an use the memmax (the total amount of RAM), And if you want to monitor the total amount of eye on updates from people you follow: mem (memory in use), and memperc (percent- downloaded and uploaded data, you can use age of memory in use) variables: the totaldown and totalup variables: ${rss http://identi.ca/api/statuses/U friends_timeline/dmpop.rss U ${color lightgrey}RAM usage:$color U ${color red}Down: U 15 item_titles 7} $mem/$memmax - $memperc% $color${totaldown wlan0} U $alignr ${color green}Up: U Perhaps the most versatile variable in Conky’s When it comes to monitoring disk usage, you $color${totalup wlan0} arsenal is execi. It allows you to run any shell have a few variables from which to choose, in- command and display the output in the Conky cluding fs_free (free space), fs_size (total size), This can come in particularly handy if you are window. You can put this functionality to many and fs_bar (space used bar): using a connection with a download cap. nifty uses. For example, you can create a plain- text file for your to-do list and then use the fol- ${color grey}Disk usage: U Clever Tricks lowing command to display it in the Conky $color${fs_free /} of U Conky includes several conditional variables window: ${fs_size /} that give you even more flexibility. For exam- ${fs_bar 6 /} ple, if your machine has a wired and wireless ${execi 30 cat ~/TODO.txt | fold -w40} interface, you might want to monitor both of Conky also includes several variables that them. But usually you use only one interface at The execi variable can do more advanced allow you to monitor wireless interfaces, in- a time, so you don’t need Conky to display in- tricks too, like displaying the number of in- cluding wireless_essid (returns the ESSID name formation about the inactive interface. This is coming email messages in your inbox. For that, of the access point), wireless_link_qual (returns where the if_existing, else, and endif variables you can use the conkyemail package from the wireless link quality), and wireless_link_bar come into the picture. Using them, you can conkyhardcore repository you installed earlier. (returns the wireless link quality displayed as a specify a condition that displays information Just install the package with sudo apt-get install bar). about a specific interface only when it’s active; conkyemail. Then, issue the conkyEmail --help To obtain the name of the wireless interface otherwise, the condition either hides the un- command to view a list of all available options. you will want to monitor with these variables, necessary data or displays a message like “No You can use these options to create an appro- use the ifconfig command, which returns a list Network Connection”: priate execi command. If you use Gmail, you of available network interfaces. Then, you can can use the command below to poll your use the variables to display the desired infor- ${if_existing /proc/net/route eth0}U Gmail account (replace the USER and PASS- mation about a specific wireless interface as ${color #ffcb48}Ethernet ${hr 1} WORD values with your actual Gmail user follows:: ${color lightgrey}IP address: U name and password): $alignr$color${addr eth0}${else}U U ${color #ffcb48}Wi-Fi ${hr 1} No Network Connection${endif} ${color #ffcb48}${ ${color lightgrey}ESSID: U execi 30 conkyEmail U $color${wireless_essid wlan0} Besides the system-related variables, Conky --servertype=IMAP U ${color lightgrey}Wireless signal: U has several other variables that can be used to --servername=imap.gmail.com U $color${wireless_link_qual wlan0}% pull and to process data from other sources.