no intersection more awesome
Header

Applying Kwin Blur to Transparent Konsole/Yakuake Windows

October 1st, 2013 | Posted by Jason "moofang" in Howto's | KDE | Linux

If you use Konsole or Yakuake with transparency you might have noticed that Kwin’s blur effect, that has been around for awhile and that blurs the background of various transparent elements in the UI (eg panels and plasma popups), does not apply to transparent Konsole or Yakuake windows. This has always irked me a tiny bit, but when I discovered that you can blur transparent terminal windows on OSX, that got me itchy enough to do the token research.

The story is a familiar one: it’s not too hard just to GET WORKING, and patches to do it exist, however getting it to work in a sensible way is non-trivial, and so the patches are rejected and the feature itself is pending future structural changes. Basically, it’s not going to happen on it’s own anytime soon.

Fortunately, there are ways to get it working on your own – and they do not involve applying custom patches and rebuilding anything. Turns out there is a terminal command one can run to immediately apply blur on, for example, current active Konsole windows:

xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id `qdbus org.kde.konsole /konsole/MainWindow_1 winId`

And for a currently active Yakuake:

xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -name Yakuake

Now to do this automatically so that your yakuake and konsole windows are ALWAYS blurred, you can simply add the following lines to your ~/.bashrc:

Spoilered: Old, not so good code Show

Edit: commenters have posted improved versions of the code, thanks commenters! See improved version below:

konsolex=$(qdbus | grep konsole | cut -f 2 -d\ )
if [ -n konsolex ]; then
for konsole in $konsolex
do
xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id `qdbus $konsole /konsole/MainWindow_1 winId`;
done
fi
if [ `qdbus | grep yakuake` ]; then
xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -name Yakuake;
fi

Of course, this often results in the command being run redundantly, but that doesn’t appear to bring any tangible ill-effects. It all works well enough for a quick hackaround. And the results are delicious indeed.


  • Facebook
  • Twitter
  • Identi.ca
  • Delicious
  • Digg
  • Google Buzz
  • StumbleUpon
  • Add to favorites
  • RSS
1316
Rate this post
Thanks!
An error occurred!

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

11 Responses

  • Franco says:

    Great! It works perfect :D
    I don’t understand why this isn’t by default in kde, it improbes readability when transparency is on.
    P.D.: Sorry my bad English, I’m from Argentina :B

    • Jason "moofang" says:

      There are people who prefer it to be non-blurred, probably so they can read text in the window behind the konsole. So they’ll need to probably get the blurring to be configurable or somthing, which apparently isn’t easy to do with the current way things are architectured.

      Well, this is an easy enough workaround until they work that out :)

  • Arthur says:

    Worked like a charm for a few days, but know blur get disabled each time the windows is redrawed and when I type the xprop command, only new lines are blurred …
    Still investigating

  • Arthur says:

    Got it, I was using QtCurve to put transparency everywhere, so I think there was a conflict between konsole part transparency and qtcurve transparency.
    Blacklisting konsole and yakuake in qtcurve > settings > applications > no backgroung opacity for …

    btw your reply seems buggy when you don’t specify a mail adress, the reply is send but I get a “please fill mail” error

  • Marcos says:

    Awesome! Excellent work. It works, but only for the first instance of Konsole. When I open a new one, the blur effect doesn’t apply.

    • Jason "moofang" says:

      Oh man you’re right. I’m too used to just opening lots of tabs on one konsole window that I never noticed that issue! The problem is that a second Konsole window has a different window Id, so some kind of loop will need to be put into the .bashrc code to cycle through and apply the command to the window ids of all existing Konsole windows.

      Don’t have time at the moment, I’ll look into putting up a fixed version as soon as I can.

  • Alex says:

    Great Tip! I too saw it on OSX and was wondering if this would be possible in KDE/Yakuake. I do belong to the people who tend to read text behind the temrinal, but the blurring effect is damn cool. gj & ty !

  • dbb says:

    Nice tip, the only downside is that it will only work on one Konsole window (namely, Mainwindow_1).

    Here is a way to make it work for each new opened Konsole or Yakuake, without looping through all of them.
    It makes use of xdotool.

    yakuake=$(xdotool search –name Yakuake | grep $(xdotool getactivewindow))
    konsole=$(xdotool search –name Konsole | grep $(xdotool getactivewindow))
    if [ "$yakuake" != "" ]; then
    xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $yakuake
    fi
    if [ "$konsole" != "" ]; then
    xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $konsole
    fi

  • Alex Dow says:

    Some versions of Ubuntu may display this error with this workaround:


    qdbus: could not find a Qt installation of ''

    To fix it perform the following:


    sudo apt-get install qt5-default qdbus-qt5

    cheers, and thank you very much for this workaround!

  • Josh Abraham says:

    I created a slightly more robust script. This will get any Konsole process’s main window. I find that the process name of konsole changes if it autoload and, of course, when there is more than one running.


    #!/bin/bash
    konsolex=$(qdbus | grep konsole | cut -f 2 -d\ )
    if [ -n konsolex ]; then
    for konsole in $konsolex
    do
    xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id `qdbus $konsole /konsole/MainWindow_1 winId`;
    done
    fi

    Replace konsole with yakuake and the script will work for yakuake.



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>