This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Kwin rule - SuperTuxKart

Tags: None
(comma "," separated)
user 01
Registered Member
Posts
16
Karma
0

Kwin rule - SuperTuxKart

Thu Oct 04, 2012 6:10 am
Hi all,

I am trying to set a kwin rule associated to a game ( SuperTuxKart 0.7.3 ) . I am just trying to block compositing when playing this game in fullsreen mode ... which is always.

I have tried to block compositing manually (Alt-Shift-F12) before playing the game ... and the gaming experience is way better. The problem is that when leaving the game my laptop gets frozen ... I have read somewhere this could be related to an Intel GPUs' bug ... BTW ... I am running a Kubuntu Precise amd64 (KDE 4.8.5) and yes ... I own an Intel GPU.


After checking the noticeable performance gain and in order to workaround the 'frozen' problem I thought ... I would be very lucky if Kwin had implemented 'blocking composition' through a rule ... ... afterwards I found out that this was possible indeed ... cool !!!



The problem is that it seems I am not able to set a rule so that it matches SuperTuxKart ... I have tried many things ... I have googled so much ...

... I have tried matching the game through the 'Window Title' , ... through the 'Window Class (application)' ... I have tried to detect window properties through Kwin facility ( http://ge.tt/9x9KGrO/v/0 ) ... also through 'xwininfo -all' command ( http://ge.tt/9XMhGrO/v/0 ) ... but I haven't been able to match the game in order to block compositing.


For a moment I thought ... ... well, maybe I am matching the window but it's just that blocking compositing is not working ... so that instead of Forcing blocking composition ( http://ge.tt/4lUwGrO/v/0 ) I tried to change another window attribute ... but the rule didn't respond positively ... so my best guess is that I am not being able to match the window ...



Changing the strategy ...

I found out there were kwin scripts to get the same result so ... even though I don't know programming very much I started reading 'Kwin Scripting Tutorial' ( http://techbase.kde.org/Development/Tut ... /Scripting ) ... I stopped just after the 'Warning' ... “KWin's Scripting functionality has been reworked for KDE Plasma Workspaces 4.9” ... as I will stay on KDE 4.8.5 ... and I don't plan to upgrade to Kubuntu Quantal until past Feb'2013.


So I am running out of ideas ... could anybody provide some help ???


Thank you very much.
luebking
Karma
0

Re: Kwin rule - SuperTuxKart

Fri Oct 05, 2012 1:22 pm
Did you attempt to detect on the fullscreen window or on the windowed game?
The properties will likely differ :-(

Try a delayed detection, then run the game in FS mode and hope there's no conflict on pointer grabbing.
If there is, you'll have to "xwininfo -tree -root" from VT1, by this figure the id of the fullscreen window and obtain its props by "xprop -id <found_id_here>"
user 01
Registered Member
Posts
16
Karma
0

Re: Kwin rule - SuperTuxKart

Fri Oct 05, 2012 2:40 pm
luebking wrote:Did you attempt to detect on the fullscreen window or on the windowed game?
The properties will likely differ :-(

Try a delayed detection, then run the game in FS mode and hope there's no conflict on pointer grabbing.
If there is, you'll have to "xwininfo -tree -root" from VT1, by this figure the id of the fullscreen window and obtain its props by "xprop -id <found_id_here>"



Yes luebking ... this was one of the first attempts. At the beginning I had a mouse pointer grab issue, but I think I solved it through opening 'konsole' app twice , ... on the first instance I run 'xwininfo -all' ... on the second I typed 'supertuxkart' and I could access the game on fullscreen mode ... then I clicked to catch the window properties ( http://ge.tt/9XMhGrO/v/0 ) . This same method is the one I have just used to run 'xprop' command ( http://ge.tt/7g7RQxO/v/0 ) . Well ... another issue is whether I am interpreting properly this command output ... I mean, my rule definition didn't changed after getting these commands' information.

I know one of the screenshots on my first message was in 'windowed' mode ... but I took it this way just for being able to take the photo itself ... all the rest of the testing was having in mind fullscreen mode. I am sorry if this has lead you to a misunderstanding.


Additional info : I don't know if this is important or not ... but ... when I leave a regular ( without blocking composition ) game session I return to the previous 'active' screen ... well, in fact it is NOT the previous 'active' screen, but a SHADOWED one ... I have to click once to 'remove' the shadow. If I try to 'Alt-tab' before 'removing' the shadow ... no other applications seem to be open. Once the shadow is 'removed', when I 'Alt-tab' I can move between the different opened apps.


Regards.
luebking
Karma
0

Re: Kwin rule - SuperTuxKart

Fri Oct 05, 2012 8:14 pm
http://ge.tt/7g7RQxO/v/0

a) please just post the text, not some blurry pngs on some board, thanks.
b) that is all? i mean, there are no other NO properties ont that window?
-> you can only match the title then and have to keep everything indifferent.
Problem is, that esp. the title often is set or altered after the window has been mapped and the rules do not update on title changes (would be quite expensive, since some clients update the title _really_ often)

=> you'll unlikely be able to detect that window from the rules, make a wrapper shellscript the deativates compositing and conditionally reactivates it when the game has exited (use the dbus interface, "qdbus org.kde.kwin /KWin")
user 01
Registered Member
Posts
16
Karma
0

Re: Kwin rule - SuperTuxKart

Sat Oct 06, 2012 2:55 am
a) please just post the text, not some blurry pngs on some board, thanks.

Alright ...



b) that is all? i mean, there are no other NO properties ont that window?

Yes ... that's all ...



-> you can only match the title then and have to keep everything indifferent.

I already tried that ... without luck ...



Problem is, that esp. the title often is set or altered after the window has been mapped and the rules do not update on title changes (would be quite expensive, since some clients update the title _really_ often)

I see ...



=> you'll unlikely be able to detect that window from the rules, make a wrapper shellscript the deativates compositing and conditionally reactivates it when the game has exited (use the dbus interface, "qdbus org.kde.kwin /KWin")

My bash knowledge is very close to zero ... but I manage to build something operative. There are some fringes left ... well ... just one. When I start the shellscript a big popup raise notifying that compositing has been disabled by another app ... that I can press (Alt-Shift-F12) to re-activate it ... ... ... you know ...

I'd like to add to my script two more commands : one for deactivating kwin (or system) notifications ... and another one for activating them back. I have been checking some qdbus services ( org.kde.knotify, org.kde.StatusNotifierHost-2693, org.kde.StatusNotifierWatcher, org.kubuntu.NotificationHelper, org.freedesktop.Notifications, org.kde.StatusNotifierItem-2743-1, org.kde.StatusNotifierItem-2761-1, org.kde.StatusNotifierItem-2742-1, org.kde.StatusNotifierItem-2765-1 ) ... but frankly I am a bit lost.

Is this possible ? Could you provide me some hint ?


Thank you.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Kwin rule - SuperTuxKart

Sun Oct 07, 2012 5:35 am
The command in both cases is:
Code: Select all
qdbus org.kde.kwin /KWin toggleCompositing


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
user 01
Registered Member
Posts
16
Karma
0

Re: Kwin rule - SuperTuxKart

Sun Oct 07, 2012 1:24 pm
bcooksley wrote:The command in both cases is:
Code: Select all
qdbus org.kde.kwin /KWin toggleCompositing



Hi bcooksley,

I am sorry if I haven't express properly myself ... I mean ... I've already reached that point ...

What I am searching for is ... a couple of commands ... one to disable and another one for enabling back one kind of kwin NOTIFICATION ( "compositing has been disabled by another application ... ... ... you can activate compositing back pressing Alt-Shift-F12" ) .


When I start the shellscript a big popup raise notifying that compositing has been disabled by another app ... that I can press (Alt-Shift-F12) to re-activate it ... ... ... you know ... ... In order to get a SEAMLESS experience I'd like to remove this popup.

I have temporarily workarounded this by PERMANENTLY deactivating this specific notification through GUI ( http://ge.tt/2Pv1k2P/v/0 ) . Maybe I am wrong, but I have guessed that if I am able to disable this specific kind of kwin notification trough GUI ... there should also be a way to do it through CLI ... and that is what I am asking for. In fact I am searching for TWO commands ... one for TEMPORARILY disable this notification ... and another one to enable it back.

I have been checking some qdbus services ( org.kde.knotify, org.kde.StatusNotifierHost-2693, org.kde.StatusNotifierWatcher, org.kubuntu.NotificationHelper, org.freedesktop.Notifications, org.kde.StatusNotifierItem-2743-1, org.kde.StatusNotifierItem-2761-1, org.kde.StatusNotifierItem-2742-1, org.kde.StatusNotifierItem-2765-1 ) ... but to tell you the truth I didn't know what the hell was 'qdbus' two days back ...


Thanks.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Kwin rule - SuperTuxKart

Mon Oct 08, 2012 6:24 am
Ah, you are referring to the notification....

That is controlled in part by KWin and in part by KNotify itself. You could try finding the kwin.notifyrc file underneath ~/.kde4/ (or ~/.kde/ depending on the distribution) and swapping them around when enabling/disabling (hopefully KNotify will detect the file change and automatically reload the configuration - if not, a qdbus call should be able to ask it to do that).


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
user 01
Registered Member
Posts
16
Karma
0

Re: Kwin rule - SuperTuxKart

Thu Oct 11, 2012 8:43 am
Well ... after learning a bit of 'sed' and some testing ... this is what I've got :


Code: Select all
#!/bin/bash

sed  -i '/compositingsuspendeddbus/{n;s/Action=Popup/Action=/}' ~/.kde/share/config/kwin.notifyrc
# qdbus org.kde.kwin /KWin org.kde.KWin.reloadConfig
# qdbus org.kde.knotify /MainApplication org.kde.KApplication.reparseConfiguration
qdbus org.kde.knotify /Notify org.kde.KNotify.reconfigure

qdbus org.kde.kwin /KWin org.kde.KWin.toggleCompositing

supertuxkart

qdbus org.kde.kwin /KWin org.kde.KWin.toggleCompositing

sed  -i '/compositingsuspendeddbus/{n;s/Action=/Action=Popup/}' ~/.kde/share/config/kwin.notifyrc
# qdbus org.kde.kwin /KWin org.kde.KWin.reloadConfig
# qdbus org.kde.knotify /MainApplication org.kde.KApplication.reparseConfiguration
qdbus org.kde.knotify /Notify org.kde.KNotify.reconfigure

exit



... it seems to work, but to be sincere, I am not sure about the ( qdbus org.kde.knotify /Notify org.kde.KNotify.reconfigure ) part. I haven't found any documentation for feeling at least a bit secure of what I was doing. I just reached to that using the trial-error method and a bit of intuition ... nothing else. Maybe I haven't searched in the proper places ...


So I would appreciate if you could confirm whether this is acceptably coded, or maybe a better way of doing it ...


Thanks.
luebking
Karma
0

Re: Kwin rule - SuperTuxKart

Thu Oct 11, 2012 9:55 pm
Code: Select all
kwriteconfig --file kwin.notifyrc --group Event/compositingsuspendeddbus --key Action ""
qdbus org.kde.knotify /Notify reconfigure
wasCompositing=`qdbus org.kde.kwin /KWin compositingActive`
$wasCompositing && qdbus org.kde.kwin /KWin toggleCompositing
supertuxkart
[ $wasCompositing = `qdbus org.kde.kwin /KWin compositingActive` ] || qdbus org.kde.kwin /KWin toggleCompositing
kwriteconfig --file kwin.notifyrc --group Event/compositingsuspendeddbus --key Action Popup
qdbus org.kde.knotify /Notify reconfigure


you could also just permanently deactivate that stupid popup ;-)
user 01
Registered Member
Posts
16
Karma
0

Re: Kwin rule - SuperTuxKart  Topic is solved

Thu Oct 11, 2012 11:37 pm
Agggh ... ... that looks much better than my proposal ...

... and works quite well ...

Thank you all VERY MUCH.

Regards.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft