Monday, 31 August 2009

Troubleshooting own_window_type panel...One thing to watch out for!

For those of you who haven't seen my post over at the Conky Blog, my latest creation is a panel-like Conky to sit at the top of my screen and show my processes, date/time and battery state:
From Screenshots

From Screenshots

As I alluded to in the post, however, you need to make sure that if your panel text is all on one line, your code must ALSO be all on one line, or it will make your Conky too fat!

For example, the code that produced the panel in the screenie is:
TEXT
${goto 5}${voffset 3}CPU ${cpu}%${goto 60}${voffset -1}${font saxMono:size=8}[${top name 1} (${top cpu 1})] [${top name 2} (${top cpu 2})] [${top name 3} (${top cpu 3})]${font}${goto 425}${voffset -1}MEM ${memperc}%${goto 485}${voffset -1}${font saxMono:size=8}[${top_mem name 1} (${top_mem mem 1})] [${top_mem name 2} (${top_mem mem 2})] [${top_mem name 3} (${top_mem mem 3})]${font}${voffset -2}${font Sawasdee Bold:size=10}${alignr 5}${time %a, %d %b %Y %H.%M}${image ~/Pictures/bk_semi_trans_sq.png -s 1024x18 -p 0,0}${if_match ${battery_percent BAT1} <= 14}${image ~/Pictures/Batteries/battery_1.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} <= 27}${image ~/Pictures/Batteries/battery_2.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} <= 41}${image ~/Pictures/Batteries/battery_3.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} <= 54}${image ~/Pictures/Batteries/battery_4.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} <= 68}${image ~/Pictures/Batteries/battery_5.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} <= 82}${image ~/Pictures/Batteries/battery_6.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} < 95}${image ~/Pictures/Batteries/battery_7.png -s 16x16 -p 845,1}${else}${image ~/Pictures/Batteries/battery_full.png -s 16x16 -p 845,1}${endif}${endif}${endif}${endif}${endif}${endif}${endif}

...uh, kind of a mess. HOWEVER, if you try to clean it up by putting line breaks in between the text and each of the two $image calls, a la:
TEXT
${goto 5}${voffset 3}CPU ${cpu}%${goto 60}${voffset -1}${font saxMono:size=8}[${top name 1} (${top cpu 1})] [${top name 2} (${top cpu 2})] [${top name 3} (${top cpu 3})]${font}${goto 425}${voffset -1}MEM ${memperc}%${goto 485}${voffset -1}${font saxMono:size=8}[${top_mem name 1} (${top_mem mem 1})] [${top_mem name 2} (${top_mem mem 2})] [${top_mem name 3} (${top_mem mem 3})]${font}${voffset -2}${font Sawasdee Bold:size=10}${alignr 5}${time %a, %d %b %Y %H.%M}
${image ~/Pictures/bk_semi_trans_sq.png -s 1024x18 -p 0,0}
${if_match ${battery_percent BAT1} <= 14}${image ~/Pictures/Batteries/battery_1.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} <= 27}${image ~/Pictures/Batteries/battery_2.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} <= 41}${image ~/Pictures/Batteries/battery_3.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} <= 54}${image ~/Pictures/Batteries/battery_4.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} <= 68}${image ~/Pictures/Batteries/battery_5.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} <= 82}${image ~/Pictures/Batteries/battery_6.png -s 16x16 -p 845,1}${else}${if_match ${battery_percent BAT1} < 95}${image ~/Pictures/Batteries/battery_7.png -s 16x16 -p 845,1}${else}${image ~/Pictures/Batteries/battery_full.png -s 16x16 -p 845,1}${endif}${endif}${endif}${endif}${endif}${endif}${endif}

...Conky will think that your output should be three lines wide, and will size your window accordingly, and you won't be able to shrink it back to that one line. Believe me, I tried! (And nearly threw my netbook out the window out of frustration before I figured it out.) You will get something that looks like this:
From My Little Desktop Photos

So, in short, it's a little bit of a pain to have to code it all on one line (and more than a little confusing!), but it's definitely worth it.

Special thanks go out to *MrStylo for his battery icons and =mrcool256 for his wallpaper.

Saturday, 29 August 2009

Can someone please teach me (instantly) how to program Lua/Cairo?!

Weeeeeellll. Another feature of Conky 1.7.2 that, it has to be said, makes it closer to TAKING OVER THE ENTIRE WORLD, is the built-in set of Cairo & imlib2 bindings for Lua. (Don't worry, I'm not entirely sure what that means either...) What it does is make things, like the following, possible:
From Screenshots

The pies in this little beauty were accomplished with a script by Conky's own main dev, Brenden, using Cairo in a Lua script. The .conkyrc, Brenden's original script, the modified version that got me the screenie above, along with the screenie to guide you, are all packaged together over on my gnome-look.org site.

I only WISH I had this kind of skill!!! (Hence begging for someone to teach me!) But alas, I have no patience, and my brain is already onto the next thing. I must admit, I depend on y'all, my loyal Conky fans, to come up with something brilliant instead...

Happy Conkying!

Thursday, 27 August 2009

Conky is Growing!

I'm living proof that it does happen, kids! Because of the work I've done with Conky, I've been roped into the project to help those lovely chaps expand their web presence. We've just set up an Official Conky Blog, and the Official Conky Forums are on their way!

One of Conky's biggest strengths (besides being generally awesome, that is!) is its fantastic community of users, who keep pushing the boundaries of what you can do with this little program. Our aim is to bring everyone together and create a cross-platform community of support and inspiration! So if you are Conkily-inclined, do head on over. I'll keep you posted.

In the meantime, check out these awesome active threads for cutting-edge Conky technology:
...You get the picture. I found a forum thread for pretty much every distro I could think of (although I've only included the most recently active ones here).

Finally, one of the most exciting Conky websites out there:
If the name wasn't enough to tempt you, then its extensive library of Conky tips and tricks surely will.

One small problem with Conky 1.7.2, through no fault of its own

So Conky 1.7.2 was released on Monday...Among the new features is $desktop (and a couple similar functions), which I was excited about particularly because I thought that if you combined it with the $if_match variable, you might be able to create a different Conky on each workspace!

So I dove straight in and started testing the $desktop variable with
Desktop ${desktop}/${desktop_number}

which should output "Desktop 1/4", etc. Uh, except that it didn't. It only gave me "Desktop 1/1". On every desktop.

First thing I did was treble-check the syntax, since I'm notorious for screwing it up (!), but it was right...So what was the problem? I decided to test and see if ${desktop_name} worked, but realised that my desktops didn't have names, and I didn't actually know how to name them!

A quick Google search later, I came up with this bug over at Launchpad. It's an old one, but I still seem to be getting the same problem: whilst running Compiz, all of my desktops are "Desk 1", despite the fact that hovering over the desktop switcher on the panel shows them all having different names. If I turn off desktop effects, no problemo, and the Conky ${desktop} variables work fine.

I guess I'll just have to do without for now, as I care for my eye-candy more than knowing my desktop name!

If any of you clever clogs out there aren't using Compiz and want to have a go with the "different Conky for each desktop" idea, do let me know how you get on!!!

EDIT: As it turns out, the root of the problem with desktop names actually has to do with how Compiz controls your desktops. Compiz actually uses "virtual desktops", all drawn on the same "actual desktop"...The default Compiz settings (if you use desktop cube) are
Horizontal Virtual Size 4
Vertical Virtual Size 1
Number of Desktops 1

It would appear that Conky only sees that "one" desktop rather than the four virtual ones. It's unclear at this point whether adjusting some of these values will allow you to use the $desktop variable and still have your lovely spinning cube...

Tuesday, 25 August 2009

More playing...And how to change upper- to lower-case

One of the other things I've wanted to play with for a while is sideways text...Just to broaden the look of Conky that much more!

With the help of Johnny B, I used BlockyCounterClockwise to get the following:
From Screenshots

One of the challenges of this was that this particular font reverses the rotation of letters if you type in captials, so when you run the ${execi 60 date} command, the capitals in the output look upside down! I tried setting the "uupercase yes" config variable, but that just made all the text be the opposite rotation from the numbers!

So I had to figure out how to take any single capitals in the date output and change them to lowercase...After a quick Google search, I found:
sed y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz

Not the prettiest method, but it works! To use it, simply pipe the date output into it, like so:
${execi 60 date | cut -c5 | sed y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz}

(The cut -c5 here just grabs the first letter of the month name.)

Now all we need are some more interesting sideways fonts :) (No offense of course, to Johnny B.)

Monday, 24 August 2009

Playing with Individual Character Placement

Thanks to the guys over at ubuntuforums.org, I found out that I can pipe the output from the 'date' command into cut in order to get control over individual characters in the date or time. It gives you that much more flexibility if you want to do some fancy-schmancy integration into your desktop.

A word of warning, however: it is a SERIOUS pain to code, very manual, and you must use a monospace font or else the spacing between letters won't look right. Anyway, an example first, and then the code for it:
From Screenshots

${voffset 190}${font saxMono:size=150}${execi 60 date +%a | cut -c1}${font}
${voffset -120}${goto 110}${font saxMono:size=110}${execi 60 date +%a | cut -c2}${font}
${voffset -122}${goto 190}${font saxMono:size=105}${execi 60 date +%a | cut -c3}${font}
${voffset -115}${goto 268}${font saxMono:size=98}${font}
${voffset -113}${goto 340}${font saxMono:size=92}${execi 60 date +%d | cut -c1}${font}
${voffset -110}${goto 408}${font saxMono:size=88}${execi 60 date +%d | cut -c2}${font}
${voffset -108}${goto 472}${font saxMono:size=82}${font}
${voffset -105}${goto 535}${font saxMono:size=76}${execi 60 date +%b | cut -c1}${font}
${voffset -98}${goto 595}${font saxMono:size=70}${execi 60 date +%b | cut -c2}${font}
${voffset -90}${goto 650}${font saxMono:size=62}${execi 60 date +%b | cut -c3}${font}
${voffset -85}${goto 700}${font saxMono:size=52}${font}
${voffset -88}${goto 740}${font saxMono:size=62}${execi 60 date +%Y | cut -c1}${font}
${voffset -88}${goto 785}${font saxMono:size=65}${execi 60 date +%Y | cut -c2}${font}
${voffset -90}${goto 835}${font saxMono:size=68}${execi 60 date +%Y | cut -c3}${font}
${voffset -94}${goto 885}${font saxMono:size=75}${execi 60 date +%Y | cut -c4}${font}
${voffset 25}${goto 720}${font saxMono:size=85}${execi 60 date +%R | cut -c1}${font}
${voffset -105}${goto 785}${font saxMono:size=92}${execi 60 date +%R | cut -c2}${font}
${voffset -120}${goto 850}${font saxMono:size=110}${execi 60 date +%R | cut -c4}${font}
${voffset -125}${goto 920}${font saxMono:size=125}${execi 60 date +%R | cut -c5}${font}

Tuesday, 18 August 2009

How to make Conky play nicely with KDE 4.3

Up till recently, I stuck fervently to Gnome DE, since it was the default on Ubuntu 8.10. After I upgraded to Ubuntu 9.04, I decided to give Kubuntu a whirl (the current version of Kubuntu is KDE 4.2), but I could barely get it to run for an hour without a total system freeze, so I ditched that idea!

When KDE 4.3 came out, I was willing to give it another try, especially as a number of folks on the August Screenie Thread at the Ubuntu Forums said that it was much faster and better all around than 4.2...Well, they didn't let me down! However, this is not an I LOVE KDE thread...

Since I depend heavily on Conky to keep my system running, I needed KDE and Conky to play nicely together or I wouldn't be able to use it full-time. Since I already used a startup script to run Conky, I just let that run in KDE and, uh, got this:
From My Little Desktop Photos

After a bit of investigation (thank you, Internet), I discovered that the reason was twofold: first, Conky uses pseudo-transparency instead of ACTUAL transparency; second, KDE doesn't draw wallpaper to the root window, only to the plasma desktop. To clarify these points:
1) Pseudo-transparency in Conky means that it peeks at the root desktop and draws it as the background of the Conky window.
2) KDE draws wallpapers to the plasma desktop only, which is the lowest window on top of the root window. Instead, the root window is empty, which shows up in Conky as black. Yuck. Well, unless you really like black.

Anyway, after much tinkering, I have gotten my desktop to look like this:
From My Little Desktop Photos

Yay!

To get your Conky and KDE to cooperate, rather than pugilate (is that a word?):

Use feh to draw the current background to the root window.

Feh is a lightweight image viewer, but that's really irrelevant, since it does what we need it to here! To install it (if you haven't already), use:
sudo apt-get install feh

I will assume for the moment that you are already using a startup script to launch your Conky from the startup programs menu...Mine initially looked like this:
#!/bin/bash
sleep 15
conky &

I wanted to run feh just once before Conky started up, so that the root window was already drawn before Conky tried to peek at it, so I modified my conky_start.sh to be:
#! /bin/bash
feh --bg-scale `grep 'wallpaper=' ~/.kde/share/config/plasma-desktop-appletsrc | tail --bytes=+11`
sleep 15
conky -&

A couple of notes...The "--bg-scale" option assumes that you use "scale" to draw your wallpaper (as opposed to center, tile, etc.). If you do use another method, you can also use --bg-tile --bg-center, etc. instead. The feh looks at the plasma-desktop-appletsrc file to see what wallpaper is currently being used, and draws that to the background.

And as with all tweaks, there are a couple of pitfalls. First, because we're running feh just once before Conky starts, if you change backgrounds during your session, it won't change in Conky, a la this:
From My Little Desktop Photos

I would recommend doing a
killall conky
~/scripts/conky_start.sh

and restarting the plasma-desktop to redraw your Conky (I just log out and back in).

Another pitfall is that if you use the stock KDE wallpapers, this method may not work. That's because the "wallpaper=" field in plasma-desktop-appletsrc in this case points to a directory, not a file, and somehow KDE figures out which of several resolutions to use. Feh can't figure that out, so it draws nothing, and you're back to the black background. The workaround is to find the wallpaper you want, copy it into, say ~/Pictures/Wallpapers/ and select it from there with the Desktop Settings dialog.

Ensure that your Conky window doesn't overlap any plasmoids.

Regardless of whether you use own_window_hints below (see my previous post), plasmoids will always draw still lower. So if your Conky window overlaps, you'll get something like this:
From My Little Desktop Photos

(Keep in mind that I use Compiz to make my Conky semi-transparent, as in another previous post...)

Enjoy KDE!!!


Well, that's pretty self-explanatory...!

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!

Thursday, 13 August 2009

It's not just Linux!

Yes, desktop customisation is an actual ADDICTION. Wherever there's a desktop-like interface, I can't help but customise it!!! An example: my T-Mobile G1:

My main screen:
From Screenshots


My left screen, with calendar and photo frame widgets:
From Screenshots


My right screen, with my most common apps, Twidget Lite and Google Voice Search:
From Screenshots


I use Open Home (available for $4.99 from the Android Market), with the Aero skin and Creature Pack icons, all available for free on the Market.

Sunday, 9 August 2009

Don'cha wish your desktop was hot like mine?

...Well now it can be!

I've started packaging my Conkys and uploading them over on my account at gnome-look.org. So what are you waiting for, go download them and have a go! Okay, so I've only put up two so far, but I'll put up more as I go along.

Happy conky-ing!

Friday, 7 August 2009

Fun with the new Conky 1.7.1.1

So, I've just downloaded the new Conky 1.7.1.1, primarily because everyone else seemed to be using it, and I wanted to keep up with the Joneses...Well, primarily to keep up with narf41 over at ubuntuforums.org. Moving on.

I built a new Conky around a wallpaper I found recently. The concept was that the Conky would interact with the desktop like a notification system...Hard to explain, so I'll just show you some screenies:
From Screenshots

This is the "normal" mode, where the announcement board has all the basic info, such as the battery and file system bars and the CPU and memory usage.

Then, when the wireless is turned on:
From Screenshots


And when Rhythmbox is playing:
From Screenshots

This is my favourite bit, actually, as in addition to the ${image} function, I've also discovered the ${scroll} function, which keeps the artist & track names inside the speech bubble by scrolling them.

You can download the entire package, with graphics and config files from my gnome-look.org profile.

(Please note that I can't take any credit for the artwork as the only part of this I did was the .conkyrc and the conkyForecast.template! As many of the credits I could find are contained in the README.txt file.)

Tuesday, 4 August 2009

So what *are* all those window options in Conky, anyway???

At the risk of sounding completely ignorant, I never really did get why everyone seems to use "own_window yes" in their Conky config settings...Until now! So I'm going to enlighten y'all, with a couple examples.

I have always, in my Conkys, used "own_window no" because it was simpler. I didn't have to worry about setting the hints correctly or transparency...It was just one line.

However, I've just now upgraded to Conky 1.7.1.1 as per the DEB file here. And when I used my normal Conky with "own_window no", precisely nothing happened.

Yikes!

After consulting the official Conky documentation for config settings, I decided to try:
own_window yes
own_window_transparent yes
own_window_type desktop

as it seemed the simplest method.

And that gave me this:

From My Little Desktop Photos


Uh, still not right.

So then I tried:
own_window yes
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

but even that wasn't right because it then gave me shadows around my desktop, thanks to Compiz.

From My Little Desktop Photos


Turns out, though, there is an option in Compiz Config Settings Manager to let you select the windows to decorate or to shadow. If you specify the class of your Conky window as "Conky", you can then exclude that from shadows, by changing it to "any& !(class=Conky)", as below:

From My Little Desktop Photos


So, to summarise, to get the same effect as using "own_window no", you have to use the following in your Conky config:
own_window yes
own_window transparent
own_window_class Conky
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

and add "any& !(class=Conky)" to the Shadow windows option in the Window Decorations screen of Compiz Config Settings Manager.

So here's my final screenie:

From My Little Desktop Photos