Reply to topic

Make KWin remember last window position - not just the size?

vishalrao
Registered Member
Posts
146
Karma
0
OS
Hello,

This question is with relation to Plasma/5.7 git branch KWin codebase...

There is a KWin setting for window placement as "Centered" and casual browsing of the code shows the enum is in placement.cpp Placement::Policy enum.

I was trying to get KWin to reopen windows/apps in their last "known" position instead of centered. Now, clearly, the centering code works due to the "size" (width/height) being saved somewhere and being correctly centered in placement.cpp "placeCentered()" method.

But when I tried to simply modify the placeCentered() to use the Client geometry X and Y values, it seems to always open all windows at the top-left corner. Spent a few hours trying to figure out where to get this done but beats me :-)

Any suggestions as to where I can get this done, if not in the code, then perhaps as a KWin script or Window Rule? (I prefer to try modifying the code!) Trying to add a WIndow Rule for remember position does not let different windows remember their own positions, the last position of the last window is applied to whatever window I open next.

Meaning ... Konsole if I place it near the top left should reopen there, while if I place Dolphin near the bottom right, it should remember their own positions... you see?

Cheers!
Vishal


"Thou shalt not follow the null pointer for at its end madness and chaos lie."
User avatar eemantsal
Registered Member
Posts
118
Karma
0
OS
If you right click in the title bar of the window which position you want to be remembered a menu will show a «More actions» (or something like that in english, my desktop is in spanish, so I'm translating by myself) item, then click on «Window special preferencies» (again an approximate translation from spanish), a new windo will open, and in the second tab «Size and position», the very first option you can select is «Position»; at its right there's a drop down menu with several options, if you select «Remember» every time you open the app in question it will be placed in the position it was when you last closed it. I think this is what you are asking. If what you want is an app to open always in the same position, no matter if you move it, for example those examples of Konsole and Dolphin you put, then select "force" and the apps will always open in the position they are when you do these changes, you won't even be able to move them; if you want to be able to move them but the last position before you close it not to be remembered next time you open it but open at the position you "recorded" in the aforementioned config window, then select «Apply initially» (or something like that).
vishalrao
Registered Member
Posts
146
Karma
0
OS
Thanks, yeah I do know about setting window rules for every app/window to remember last position - I was hoping to add this as an option in the Kwin code itself :-)

Since the devs in the #plasma IRC channel pretty much say this is not possible in KWin, I'm now thinking of using the "WIndowRules, Rules and RuleBook" related code in KWin so that it "automagically" adds the "remember position" rule to every new app that opens so this behaviour is there by default.

Ugly, yes, but was just itching to write some C++ code these days :)


"Thou shalt not follow the null pointer for at its end madness and chaos lie."
User avatar eemantsal
Registered Member
Posts
118
Karma
0
OS
vishalrao wrote:... "automagically" adds the "remember position" rule to every new app that opens so this behaviour is there by default.

Ah, sorry. From your first post I didn't get that.
It's a nice feature, and I'm a bit surprised it isn't possible. You know, one would expect to be able to configure almost everything KDE, even if no GUI is available and one has to tweak some config file or whatever. If your wish is ever implemented, please, tell us here; it probably is not a most demanded feature, but I think many of us would like it. :)

Cheers.

 
Reply to topic

Bookmarks



Who is online

Registered users: alisaswan, Baidu [Spider], Bing [Bot], Google [Bot], jeffgila, kamathraghavendra, Mamarok, miguelrozsas, raphaelra, scummos, tavernsenses, TheraHedwig, thunder422, tosky, tymond