Reply to topic

[scripting] getting count of windows on desktop

sir_herrbatka
Registered Member
Posts
188
Karma
0
hey,

I can't find this in api documentation: I need to get number of clients on the virtual desktop. Actually bool empty would be sufficiant. Is there method like this in the api? If yes, where is the updated documentation?
mgraesslin
KDE Developer
Posts
357
Karma
4
OS
I don't think we have a method for that. From a window manager perspective we are not really interested in the count per desktop. We have the focus chain per desktop which kind of knows the count per desktop, but that's not exposed and also doesn't guarnatee it.

Keeping track is not absolutely trivial as one needs to track the desktop changes of all windows (including on all desktops) and the changes of virtual desktops overall.
sir_herrbatka
Registered Member
Posts
188
Karma
0
Ok, thanks for quick answer.
sir_herrbatka
Registered Member
Posts
188
Karma
0
http://kde-look.org/content/show.php/Dy ... ent=162964

One more question.

What happens to the currentDesktop when desktops grid effect is triggered? It seems that using this effect brakes this script somehow.
mgraesslin
KDE Developer
Posts
357
Karma
4
OS
sir_herrbatka wrote:What happens to the currentDesktop when desktops grid effect is triggered? It seems that using this effect brakes this script somehow.

During using of Desktop Grid the currentDesktop can change. E.g. if you move an active window to another desktop the currentDesktop changes. But it should all emit the signals.
sir_herrbatka
Registered Member
Posts
188
Karma
0
Hm, this all problematic. Not only changing desktop with desktop grid brakes the script (pager still works) but I also managed to crash kwin with it (try to start window on last desktop and move it to the first desktop with pager). Well It is good enough for me, but I better remove it from the kde-look.org.
mgraesslin
KDE Developer
Posts
357
Karma
4
OS
sir_herrbatka wrote:Hm, this all problematic. Not only changing desktop with desktop grid brakes the script (pager still works) but I also managed to crash kwin with it (try to start window on last desktop and move it to the first desktop with pager). Well It is good enough for me, but I better remove it from the kde-look.org.

We shouldn't crash :-) Feel free to provide me a backtrace and a way how to reproduce and we can try to fix it.
sir_herrbatka
Registered Member
Posts
188
Karma
0
Well, let's see:

this code will not crash:

http://paste.kde.org/pafde6a76

however i get this stacktrace: http://paste.kde.org/p28239710 after running this code: http://paste.kde.org/p299a3477 (it probabbly has a little bit of nonsense, but i just was a bit to lazy to reinstall old version and so i simply copy-paste few lines ;-) ).

To replicate the crash, simply try to run the script, create 3 VD, place any window on third and try move it to the first one using pager (desktop grid is problematic because of other reasons). Kwin will crash.

PS
If there is any way I can help, I would be glad to do so.
luebking
Registered Member
Posts
932
Karma
7
trace lacks debug symbols, ie. doesn't say anything
be warned that https://git.reviewboard.kde.org/r/114080/ alters desktopPresenceChanged so that it's only emitted if the current desktop is affected
sir_herrbatka
Registered Member
Posts
188
Karma
0
Right. This is not debug build, but simply version from the Arch repository.

I could probbably build debug version of kwin, but this bug shouldn't be difficult to reproduce with the given script.

Thanks for the warning. Actually the main functionality of the script was in fact related to adding and removing VD after changing it. Windows moving was just small addon (that turned to not work quite right anyway).

Well, I removed the script from KDE-look.org already and personally I didn't like the pager behavior and how it redraws itself from scratch after changing desktops count. I simply added 14 VD and now I will NEVER will have to add another VD again. ;-)
luebking
Registered Member
Posts
932
Karma
7
Tried, no crash here - the mentioned patch may have covered this (because desktopPresenceChanged is now called for any relevant occasion)

Script is basically still operative, but only updates VD amount when you approach a useless current desktop.

Main issue with your description is to have 3VD and move a window to the 3rd, what will oc. increase #VD to 4.
sir_herrbatka
Registered Member
Posts
188
Karma
0
That would be expected, since part that changes ammount of the VDs after moving window from the workspace.desktops -1 (and was crashing kwin) is now not triggered.
luebking
Registered Member
Posts
932
Karma
7
nope, the desktop amount is immediately shrunk if i move the window from or to the current desktop.
i cannot though make the last desktop the current one for some reason (didn't really inspect the script) - is that supposed to be the case?
sir_herrbatka
Registered Member
Posts
188
Karma
0
Yes, this is how it is supposed to work. There should be at least one VD after the current. Therefore after switching to the last VD new VD is created.

 
Reply to topic

Bookmarks



Who is online

Registered users: Alastair, apater, Baidu [Spider], Bing [Bot], Exabot [Bot], garthecho, ggael, Google [Bot], google01103, Horus, jitseniesen, Joif, kde-jriddell, ken300, La Ninje, Mamarok, mmistretta, Nuc!eoN, psbot [Picsearch], rbruce, renatoatilio, sacarde, sinclair, stephans, TheraHedwig, tienhung, wolfi323, Yahoo [Bot]