I'm a wife and mother living in Houston, TX. I have three children, Soli, Alex and Sara. I work full-time and my husband, Marty, stays at home with our children and goes to school at night. Please, don't ever call him "Mr. Mom".

Thursday, October 23, 2008

Customize Conky for Ambient Linux Productivity

Linux often gets criticized by the ease-of-use crowd for making its users occasionally edit a text file to get something working. In the case of the nimble, endlessly extensible desktop monitor Conky, though, a text file is a great thing. You can changed the format, color, font, and output of what Conky shows you any way you want, and using some freely available tools, have Conky monitor your email, Google Calendar, local weather, music, and even keep tabs on your text-based To-Do list. If you were intrigued by how much love Conky gets from our Linux users, read on to learn how to set up your own uber-useful, lightweight embedded monitor.

Basic setup

Most any modern Linux distro should offer Conky in its repositories; if not, you can grab a source package from SourceForge and compile it yourself.

You could launch the default Conky setup at this point if you wanted—simply run conky from a terminal, by pressing Alt and F2, or by setting up a shortcut—but let's get configuring. First up, copy the default Conky config file to our home directory. On Ubuntu systems, at least, the default is stored at /usr/share/doc/conky/examples/conky.conf.gz, so we'll copy the contents of that compressed file into our custom .conkyrc file in our home directory. You can do that graphically with compression tools and drag-and-drop, or run this command in a terminal:

zcat /usr/share/doc/conky/examples/conky.conf.gz > ~/.conkyrc

.conkyrc files tell Conky everything you want displayed, and how to display it. Proud users post and trade them all the time, and they're easy to import. So if you see a nice layout and color scheme at the Conky screenshot page, within the seriously gargantuan Ubuntu Forums trading post, or elsewhere, you can simply copy the contents of that file, dump them in .conkyrc, and restart the app to see how it works on your own desktop. If it doesn't look right, or messes with your 3D effects, you can simply run that decompression command above again to restore a working configuration.

Now, onto the fun stuff—tweaking the text. Open the .conkyrc file in your favorite text editor (sudo gedit ~/.conkyrc or sudo kate ~/.conkyrc should do it for GNOME and KDE systems respectively), and take a look around. The file is basically divided into two sections: The top, where universal settings are changed, and everything after the word TEXT, which is what Conky actually shows.

The settings at the top almost all have numbers, text, or "yes/no" statements after them, which you can, of course, change. Here's a few worth looking at:

  • update_interval: How many seconds Conky waits before refreshing itself. Even a "1.0" value shouldn't affect performance too much on a modern system, but if you're not looking for real-time system stats, you can scale it back or leave as-is.
  • double_buffer: Prevents flickering on systems that have desktops capable of supporting it. If it's not enabled, it most likely should be.
  • own_window: If set to "yes," Conky runs like any other desktop app in a window frame. Set to "no" and Conky embeds itself on the desktop (though other settings may affect this).
  • maximum_width, default_color, and alignment: Sets up Conky's look and feel. Change maximum_width, or add minimum_width if you'd like, to prevent text output from setting Conky's size. default_color controls text that isn't manually switched to another color; using "white" or "lightgrey" works for most desktops. You'll likely find alignment listed four times, with "top_right," "bottom_left" and the like after it, and all but one commented out with a "#" at the beginning of their lines. Uncomment one to change where Conky sits itself on your window.

    If you've found a cool Conky config file that displays email, RSS feeds, and other data, but it just won't work on your system, that's likely because you're lacking a background script the poster has installed. Here's how to put a few of your own in your Conky.

    Adding the cool stuff

    Conky can launch and grab the output of any command-line app and display it the way you want. In other words, if you run across a Python script or terminal app that does something cool and returns text results, it can fit in Conky.

    If you've got a script in mind, head to the lower TEXT section of your .conkyrc file. On a new line, type a line like this:

    ${execi 900 super-awesome-command}

    That tells Conky to run the "super-awesome-command" every 900 seconds (i.e. 15 minutes) and pull the results. Using that type of command in the screenshot above, I'm grabbing my Google Calendar appointments, checking my Gmail, pulling down weather data for Buffalo, NY, and listing what's playing in my Rhythmbox music manager. The scripts come from one super-helpful Ubuntu Forums poster, kaivalagi, who offers both easy-to-install .deb files for Ubuntu users and source packages for anyone else. If your system can run Python scripts (and most can), you can use his tools.

    Here's a Google search of all the Conky-ready tools kaivalagi has put together, and here's the ones I'm using in the screenshot. The packages are attached at the bottom of each post; read the instructions for details on configuring the output:

    Want to monitor a text-based to-do file? You'd use the cat command with the same Conky syntax. Here's an example Conky section provided by Big Oh Software:

    ToDo file
    ${color0}TODO:${color1}
    ${execi 30 cat /home/username/Desktop/TODO.txt | fold -w40 }

    If your to-do file or any other section is getting cut off too soon, that's because Conky has an unseen default text limit for any object. You can tweak it by adding a text_buffer_size 512 to the top section of your .conkyrc, changing that number to fit your needs.

    I'll go ahead and share my .conkyrc file, which uses all of the scripts pasted above. I've stripped my username and password from the Gmail and Google Calendar sections, and the Weather.com widget requires a separate configuration file (installed with the script) that contains your Weather.com sign-up info.

    Now, let's see some of your own awesome Conky setups. If you can paste it in the comments without too much warping, go for it; otherwise, consider using a link from an online storage service that offers a free account. Feel free to point us all to other great Conky-friendly scripts and tools as well.

via Lifehacker

No comments:

Post a Comment