You are not logged in.

#1 2011-09-23 09:51:25

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,416

Suspend kwin compositing when active window is fullscreen

Kwin already redirects fullscreen windows, but sometimes you have still to deal with screen glitches,
for example, when you open a popup menu.

This scripts will suspend/resume desktop effects when the active window is/not a fullscreen window.
It need xprop and qdbus:

#!/bin/bash

EFFECTS=$(qdbus org.kde.kwin /KWin compositingActive|grep 'true\|false')

ToggleCompositing()
{
	qdbus org.kde.kwin /KWin toggleCompositing;
}

EffectsOn()
{
  if [ "$EFFECTS" = "" ];
    then
        ToggleCompositing;
    fi
}

EffectsOff()
{
    if [ "$EFFECTS" != "" ]; 
    then
        ToggleCompositing;
    fi
}

while true ; do
	#Are the effects running?
	  EFFECTS=$(qdbus org.kde.kwin /KWin compositingActive|grep 'true')
	
	#What is the Active window?
	  ACTIVE=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| cut -d ' ' -f 5)
	
	#...Is it fullscreen too?
	  FULLSCREEN=$(xprop -id $ACTIVE | grep "_NET_WM_STATE_FULLSCREEN")

	if [ ! -z "$FULLSCREEN" ] 
		then
		  	EffectsOff
		else
			EffectsOn
		fi
		sleep 1
done

The drawback is a notification that informs you that desktop effects has been disabled by an external application, i don't know how to disable it.
Any ideas?

Last edited by kokoko3k (2011-09-23 10:10:21)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

Board footer

Powered by FluxBB