Transparent Conky in KDE, part 2

I posted earlier about getting Conky to be transparent in KDE. Unsetting and resetting the "Show icons on desktop" and "Allow programs in desktop window" options would allow Conky to look correct when transparent. Otherwise it would be a black box.

This is OK but it's a hassle to do this every time I restart KDE. Via various posts on the Gentoo forums I finally realized WHY this works (I think). Conky's pseudo-transparency works by reading the root window, and then compositing itself onto that. The root window is apparently not what normally shows in KDE when you're looking at your desktop background. KDE apparently draws another window on top of the root window and displays the desktop window there (including your background wallpaper and icons). Underneath that is the REAL root window, and it's entirely blank by default. Conky sees that real root window and composites itself on top, resulting in blackness.

When you tell KDE not to "Show icons on desktop", apparently KDE then defaults to setting the background of the REAL root window. So switching this option on and off results in the real root window's appearance matching KDE's "fake" root window.

Interestingly, in KDE if you do this:

  1. Set "Show icons on desktop" to true.
  2. Set a background.
  3. Set "Show icons on desktop" to false, then back to true.
  4. Change your background.
  5. Start a transparent Conky.

Conky will be properly transparent, but it will use the FIRST background you selected, not the second. This leads me to believe I'm right.

So the real way to get a nice transparent Conky in KDE is to set the background of the root window using a program like feh.

ppurka posted in this thread a great automated way to do this in KDE:

feh --bg-scale `dcop kdesktop KBackgroundIface currentWallpaper 1`

If you're like me and use centered wallpaper, use --bg-center instead. Incidentally this is the relevant section of my Conky config file:

own_window yes
own_window_type desktop
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
August 25, 2006 @ 3:21 AM PDT
Cateogory: Linux

43 Comments

Reinmar
Quoth Reinmar on September 09, 2006 @ 7:54 AM PDT

First, I start conky without config file, and it was working good - icons were on my desktop and it has transparent window. So, I had been adding lines from config, which I know it made icons hide and when I added 'double_buffer yes', icons disappeared. Unfortunately - without double buffering conky blinks on my desktop, what looks awful...

Reinmar
Quoth Reinmar on September 09, 2006 @ 8:21 AM PDT

Ok - I set own_window like you, wallpaper using feh and double buffering on. Now everything is OK :) THX

Logan
Quoth Logan on February 07, 2007 @ 6:56 PM PST

Brilliant! I had some trouble seemingly due to the fact that my wallpaper had a space in the filename, but I changed it, reset the default wallpaper, ran feh, and all is well. You have no idea how long I was looking for this solution.

Brian
Quoth Brian on February 09, 2007 @ 1:17 AM PST

Glad it could be of help.

Dmitriy
Quoth Dmitriy on March 06, 2007 @ 10:04 AM PST

Genius, you are simply genius! hehe

demon
Quoth demon on March 19, 2007 @ 12:29 AM PDT

Just to thanks your contribution. It works in opensuse 10.2 + kde3.5.5 + beryl 0.1.4 To make it works at start, just make a script in your $HOME/.kde/Autostart

Thx

Ewilly
Quoth Ewilly on May 22, 2007 @ 10:52 PM PDT

i found an easiest way to have conky transparent without installing / using feh on KDE :

OLDWALLPAPER=dcop kdesktop KBackgroundIface currentWallpaper 1 killall conky sleep 10 && conky -d dcop kdesktop KBackgroundIface setBackgroundEnabled false sleep 1 && dcop kdesktop KBackgroundIface setBackgroundEnabled true dcop kdesktop KBackgroundIface setWallpaper "$OLDWALLPAPER" 7

Brian
Quoth Brian on May 27, 2007 @ 2:49 PM PDT

Looks similar to what I was doing by hand before I started with feh. That's a good idea.

Ed Daniel
Quoth Ed Daniel on May 28, 2007 @ 11:49 PM PDT

Sorry to throw a spanner in the works... is there a hack for those using the 'gradient' desktop background feature i.e. wallpaper set to 'none'?

calraith
Quoth calraith on May 31, 2007 @ 4:22 PM PDT

For what it's worth, appending this line to the bottom of .conkyrc works as well as autostarting feh; but since it only executes when conky launches, I think it's a little more graceful.

${exec feh --bg-scale `dcop kdesktop KBackgroundIface currentWallpaper 1`}

Yes, I'm slightly obsessive at times. =)

Ed Daniel: I would guess you could theoretically accomplish the same task by using Esetroot or gsetroot or some other ?setroot utility capable of setting gradients.

Zach
Quoth Zach on June 13, 2007 @ 8:56 AM PDT

Thanks for the solution, conky drove me nuts trying to get it properly transparent.

dragon_788
Quoth dragon_788 on June 21, 2007 @ 9:30 AM PDT

Thanks Brian and calraith. I ended up using feh from within conky with a direct link to the wallpaper since the dcop command wasn't working properly.

Anonymous Cow
Quoth Anonymous Cow on June 29, 2007 @ 3:27 PM PDT

NOTE with Beryl/Compiz:

If you're going to put the command in your .conkyrc file use $texeci instead of $exec. Personally for me on kdemod + compiz-fusion it caused some lag when using the compiz-fusion toys. Something like this

${texeci feh --bg-scale dcop kdesktop KBackgroundIface currentWallpaper 1}

Anonymous Cow
Quoth Anonymous Cow on June 29, 2007 @ 3:47 PM PDT

Actually scratch last post. my bad.

Brian
Quoth Brian on July 01, 2007 @ 5:00 AM PDT

:)

TommyHot
Quoth TommyHot on July 12, 2007 @ 10:59 PM PDT

Even if I use feh and my conky gets transparent, after I click anywhere on the screen, conky diseappears. But I can still find it in ps -auxe =(

TommyHot
Quoth TommyHot on July 12, 2007 @ 11:03 PM PDT

Ok it seems I've solved my problem. I have to change: own_window_type desktop

to

own_window_type normal

circuit_breaker
Quoth circuit_breaker on July 22, 2007 @ 9:00 AM PDT

for the beryl+emerald+kde users:

own_window yes own_window_transparent yes own_window_hints desktop,undecorated,below,sticky,skip_taskbar,skip_pager own_window_type override

and use the feh recipe. now they stick to the fake KDE root background and don't drag either.

sammael
Quoth sammael on September 25, 2007 @ 2:38 PM PDT

oh my god thank you my saviour i finally can get some sleep!!! this was nagging me ever since i discovered conky, thanks a lot once again

jirka
Quoth jirka on October 26, 2007 @ 7:14 AM PDT

Woks for me, thank you very much :)

jirka
Quoth jirka on October 26, 2007 @ 7:17 AM PDT

Works for me, thank you very much :)

Al
Quoth Al on November 03, 2007 @ 2:36 AM PDT

I googled upon this site, I use gnome, with the default conkyrc it didn't display icons on the desktop. This line: own_window_type desktop seemed to fix the icon issue.

nrwilk
Quoth nrwilk on December 10, 2007 @ 8:08 AM PST

This works for me, but after I instantiate the transparent conky, if I click on the desktop, conky disappears.

How can I fix this?

chepioq
Quoth chepioq on April 06, 2008 @ 2:40 AM PDT

I use your "feh --bg-scale dcop kdesktop KBackgroundIface currentWallpaper 1" for my conky for a long time but now with Kde4 it is not working and I know why... dcop in kde4 is replaced by d-bus and I don't know how replaced dcop by d-bus. Can you help me?

chepioq
Quoth chepioq on July 21, 2008 @ 4:13 AM PDT

You know (or not...) but with kde 4 ?feh --bg-scale dcop kdesktop KBackgroundIface currentWallpaper 1? don't work because dcop is replaced by dbus. And with dbus I don't know how replace this command. But I find an other way.

1) Install feh

2) Create a script in /home/~/.kde4/Autostart with:

!/bin/bash

eval cat $HOME/.fehbg conky -c .conkyrc/.conkyrc1 &

adapt path of your conkyrc (mine is conkyrc1 because I have a conkyrc for gnome) and give it executable

3)Add in your .conkyrc file just under "TEXT":

${execi 100 feh --bg-scale "grep 'wallpaper=' ~/.kde4/share/config/plasma-appletsrc | tail --bytes=+11"}

Adapt the path of your plasma-appletsrc (in Ubuntu there is in .kde4, but with fedora in .kde...) I use execi 100 because when I change wallpaper, the name of new wallpaper appear after 1 minute in ~/.kde4/share/config/plasma-appletsrc ( I don't know why...)

And that work for me with Fedora9 and for other with Ubuntu. If anybody know how use feh with dbus in kde4...

chepioq
Quoth chepioq on July 28, 2008 @ 1:20 AM PDT

Have you seen my reply #25 in "http://briancarper.net/2006/08/25/transparent-conky-in-kde-part-2/"?

Brian
Quoth Brian on July 28, 2008 @ 2:36 AM PDT

Sorry, I forgot to respond. I'm going to have to try this now that I put KDE4 on my laptop. Maybe there is a dbus equivalent command to set or get the background filename.

chepioq
Quoth chepioq on July 28, 2008 @ 2:46 AM PDT

I don't know if there are and equivalent command but I search with qdbusviewer and I don't find an entry for wallpaper...

chepioq
Quoth chepioq on August 02, 2008 @ 11:08 PM PDT

You know that I am not able to use dbus, but I have solution with inotify (this package is in fedora and I think it is also in ubuntu... In resume I delete the "${execi 60 feh --bg-scale "grep 'wallpaper=' ~/.kde/share/config/plasma-appletsrc | tail --bytes=+11"}" line in my conkyrc and I change the script in my /home/dominique/.kde/Autostart like this: Code:

!/bin/bash

feh --bg-scale "grep 'wallpaper=' ~/.kde/share/config/plasma-appletsrc | tail --bytes=+11" conky -c .conkyrc/.conkyrc1 & while inotifywait /home/dominique/.kde/share/config/plasma-appletsrc; do feh --bg-scale "grep 'wallpaper=' ~/.kde/share/config/plasma-appletsrc | tail --bytes=+11" done

And that work for me... (with 30 seconds of latency when I change wallpaper)

rsff
Quoth rsff on September 21, 2008 @ 10:33 AM PDT

yeah the trick from post 18 worked for me too

thanks

George
Quoth George on October 08, 2008 @ 8:16 AM PDT

Worked fine for me. Had to change 'own_window_type normal' though. Thanks - Been annoying me for a long time :-)

Pablo
Quoth Pablo on October 26, 2008 @ 10:49 AM PDT

Arrgh! this doesn't work with kde4 in a multimonitor setup.

I suspect it is both because "grep ?wallpaper=' ~/.kde/share/config/plasma-appletsrc" returns multiple lines, (one for each screen's wallpaper.)

Also, is feh even multi-monitor capable?

Vaulter
Quoth Vaulter on January 17, 2009 @ 2:29 AM PST

That's real transcendental! I think, this also will be work as cron task, as i have slideshow. But, if conky be real transparent, with rendering against program background too :)

anonymouse
Quoth anonymouse on May 08, 2009 @ 12:18 PM PDT

no, no no .. there is no need to hack the desktop app and mess around with feh like this. The below instructions are for kde4 with desktop effects; in kde3 the process is a bit different but I'm sure it supports all the same per-window effects.

In kde4, run conky normally (as a window), then right-click its menu title and from "Advanced" select:

  • To all desktops
  • Keep below others (or above, if you can find a nice place for it!)
  • Adjust opacity
  • No border

You'll then have to press Alt+F3 to get the menu back, and in "Special window settings" you will probably want "Accept focus" disabled. There are heaps of other options in this area, so keep experimenting.

Then save conky to your KDE session, and you're done! Much better than hacking the desktop, right?

anonymouse
Quoth anonymouse on May 08, 2009 @ 12:29 PM PDT

I should add: once you've disabled the menu and focus, to tune the conky window's behaviour you'll have to go into system settings -> window behavour -> window specific.

xoros
Quoth xoros on May 30, 2009 @ 3:01 AM PDT

@anonymouse...

Conky doesn't show as a normal window for me in KDE4

Is this part of my .conkyrc wrong?

This is the number of times Conky will update before quitting.

Set to zero to run forever.

total_run_times 0

own_window yes own_window_transparent no own_window_type override own_window_type desktop

own_window_type normal #use this if you want a nice shadow to appear around conky

If own_window is yes, these window manager hints may be used

own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

Use double buffering (reduces flicker, may not work for everyone)

double_buffer no

How do I set it so I can work with it like you say?

xoros
Quoth xoros on May 30, 2009 @ 3:08 AM PDT

Can someone please post a pastebin link to a WORKING KDE4 .conkyrc so we can work with it like anonymouse is stating??

xoros
Quoth xoros on May 30, 2009 @ 3:27 AM PDT

Sorry to bother again, but how do you "save conky to your KDE session" ?

I have it working in windowed mode with these settings:

own_window yes own_window_transparent no own_window_type normal double_buffer no

I have all the other window settings how I want. I just wish I knew how to "save it to my session" now. :(

Victor
Quoth Victor on June 26, 2009 @ 12:00 AM PDT

The command:

xsetroot -solid grey // use your desktop color here instead of "grey"

does all the job!

BTW: see your /usr/bin/startkde and look for xsetroot.

Victor
Quoth Victor on June 26, 2009 @ 12:06 AM PDT

NO NO NO !

It's even more easier !!!

simply put : "own_window no" and it will start working transparent in KDE (I use Slax and KDE3.5, also tested in Xfce/Fluxbox/e16).

cheers!

rusty_dragon
Quoth rusty_dragon on September 25, 2009 @ 1:14 AM PDT

Thanks a lot for this post. I think better use zero instead of one in option of currentWallpaper. If you put 1 feh made only picture from first desktop as fake-root. Instead of this 0 is wallpaper of current desktop.
feh --bg-scale `dcop kdesktop KBackgroundIface currentWallpaper 0`
in .conkyrc
${exec feh --bg-scale `dcop kdesktop KBackgroundIface currentWallpaper 0`}
A last we have that conky set

betlog
Quoth betlog on August 04, 2010 @ 10:18 PM PDT

easier in later versions of conky

own_window_transparent yes

own_window_argb_visual yes

Random Googler
Quoth Random Googler on August 27, 2010 @ 7:21 AM PDT

For betlog's way, own_window_type must be set to normal .

Speak your Mind

You can use Markdown in your comment.
Email/URL are optional. Email is only used for Gravatar.

Preview