[HowTo] Toggle Compositor for Active Window

The following will be a little How To to toggle compositing for an active window.

In my case it is for KDE, but I think it would work for other distros. First turn off the KDE compositor.

Next download and install the git version of xcompmgr:
xcompmgr-git. (In the repo it says version 1.1.7x but it is actually 1.1.9x. Someone needs to fix that typo.)

Next download and install its companion utility: transset-df. The df version has enhanced features.

Put xcompmgr-git in your autostart. Xcompmgr has a lot of cool arguments to tweak it. I like the fade in fade out feature. Here are the arguments I use: -c -f -O .0.37 to get you started.

Once you know it is working as you new compositor you are ready to up its game with transset-df.

Is transset-df installed? Ok. Try this command in a terminal: transset-df -t -p.

The terminal turned translucent. Run the command again. It turned off. Cool, right?

Transset is often mentioned as a companion to xcompmgr but it is dismissed as being so basic that it limits its usefulness. NOT SO!

Well the trick is the combination of the -t -p arguments.

Now that you know that this works to toggle compositing you can create a one line bash script.

Mine looks like this:

#toggle active window transparency with Alt + C Keys
transset-df -t -p

I named it xcomp_toggle.sh

You will want to chmod +x xcomp_toggle.sh, or whatever you named your little script.

Now assign it a hot key in KDE custom shortcuts. Right click to see new and select Global Shortcut. Give it a name, preferably the same as the script you just created.

Type a description comment, assign a hot key trigger, – in my case I assigned Alt + C for compositing.

Then select the script you just created for the Action.

That’s it. Now in an active window when you press Alt + C your window turns translucent. Press again and it turns opaque.

I use this mostly when watching Netflix full screen and want to quickly check the desktop clock. Very handy.

If you want even more compositing control, you can couple transset-df with xbindkeys. With xbindkeys installed just put this in your src file. It uses the mouse wheel to make the active window clearer or more opaque. Move the wheel up and down to change.

I put the toggle in there too.

#Control transparency with mouse wheel
“transset-df -p --inc 0.05”
alt + b:4

“transset-df -p --dec 0.05”
alt + b:5

#toggle transparency with Alt T Key
“transset-df -t -p”
m:0x18 + c:28
Alt+Mod2 + t

1 Like

This can be achieved in KDE without installing any extra software - it just needs to be configured:

Now meta+mouse wheel changes opacity of the window under the mouse cursor.

Please don’t add a reply in a wiki to add more info. Edit the first post instead. I’ve merged your reply into the first post.

It’s ``` :wink:

Please see [HowTo] Post command output and file content as formatted text and edit your post accordingly.

It is my understanding that this feature is color scheme dependent and may not work with all color schemes.

I should add this since KDE does have a feature that is so close to what I want I used the KDE bug tracker wishlist feature to formally request the ability to toggle transparency. This seems doable and would give this ability to laptops using only a touchpad, such as my Netflix movie laptop.