PROJET AUTOBLOG


Between Linux and Anime

Site original : Between Linux and Anime

⇐ retour index

Mise à jour

Mise à jour de la base de données, veuillez patienter...

Applying Kwin Blur to Transparent Konsole/Yakuake Windows

mardi 1 octobre 2013 à 21:10

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.