Friday, 14 August 2009

Who needs screenlets when you can have Conky?!

I've just finished working on my latest Conky!
From Screenshots

There are two main features...
1) Use a combination of Conky and Compiz to get nifty transparency effects

I have my windows set to 95% transparency in Compiz, which never applied to Conky until recently when I started using the "own_window yes" option (see a couple posts previous). Then it occurred to me that I could use it to create a nifty effect! Here's I did to get the top text transparent whilst keeping the bottom text opaque:

+ Run two Conkys. You might not notice, but the top and bottom of this screenie are actually running two different Conkys simultaneously.
+ Specify the class of the Conky that will be semi-transparent, by using something like "own_window_class Conky-semi" (I used Conky-50 because I'd intended to use 50%, but 75% looks better!).
+ In Compiz Config Settings Manager, go to Opacity, Brightness & Saturation and add a new window type, "class=Conky-semi" and set the transparency to something like 75%:
From My Little Desktop Photos

+ Et voila!

2) Create a battery widget

There are a number of great sets of images you can download as icons for various dock programs; you can use one of these suites, combined with Conky's ${image} function and a big nested ${if_match ${battery_percent}} statement to create a battery widget, like so:
${if_match ${battery_percent BAT1} <= 14}${image /home/alison/Pictures/Batteries/battery_1.png -s 75x100 -p 0,20}${else}${if_match ${battery_percent BAT1} <= 27}${image /home/alison/Pictures/Batteries/battery_2.png -s 75x100 -p 0,20}${else}${if_match ${battery_percent BAT1} <= 41}${image /home/alison/Pictures/Batteries/battery_3.png -s 75x100 -p 0,20}${else}${if_match ${battery_percent BAT1} <= 54}${image /home/alison/Pictures/Batteries/battery_4.png -s 75x100 -p 0,20}${else}${if_match ${battery_percent BAT1} <= 68}${image /home/alison/Pictures/Batteries/battery_5.png -s 75x100 -p 0,20}${else}${if_match ${battery_percent BAT1} <= 82}${image /home/alison/Pictures/Batteries/battery_6.png -s 75x100 -p 0,20}${else}${if_match ${battery_percent BAT1} < 95}${image /home/alison/Pictures/Batteries/battery_7.png -s 75x100 -p 0,20}${else}${image /home/alison/Pictures/Batteries/battery_full.png -s 75x100 -p 0,20}${endif}${endif}${endif}${endif}${endif}${endif}${endif}

Not too pretty, I'll grant you, but it does the trick! Just make sure you've got all the ${endif}s you need :)

And yes, before you ask, I will package this one, and the battery widget separately, once I have permission from the artist to do so. The battery widget icons are by *MrStylo; please click on his DeviantArt account for more info.
One final little nugget: a really nifty, pretty lightweight way to get a nice semi-transparent background for your Conky is to make a small semi-transparent square (I used a 50x50px square I made in GIMP), and stretch it to the size you need using the -s option in the ${image} variable.

Happy Conkying!


  1. thats great!
    can you please post the code to it so
    i can use and modify it? thanks, great work!

  2. The code to what? The whole thing, or just the widget bit?

    I am waiting to release it as a package because I want to get permission from the artist to include the battery icons.

    Glad you like it!

  3. this is really interesting- is there any way that you could post the code sans the battery widget, at least until you get the permission?

    Right now, Im trying to get the same effect that you have on the bottom bar: I have a green grass background, and I want the gray/transparent black background for my conky info. Any tips?


  4. Good idea - having problems though in that the text conky seems to be behind the semi-transparent background. What am i doing wrong?

    Text conky
    own_window yes
    own_window_type desktop
    own_window_transparent yes
    own_window_hints above,undecorated

    own_window_class conky-semi
    own_window yes
    own_window_type normal
    own_window_transparent no
    own_window_hints below,undecorated

    Any ideas pls?