Summary: | Can not adjust the geometry of applications consistently inside clientAdded() signal | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | LinG <lingtjien> |
Component: | scripting | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | RESOLVED NOT A BUG | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 5.11.1 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
LinG
2017-10-21 11:48:26 UTC
That would be a problem in Kate then. Geometry is handled in truth by the application. The window manager just tells the window "please take this geometry". The window is allowed to just change it back. Windows support a min size. You can check with xprop and xwininfo for the minimum size and other constraints on the window. Maybe the geometry you want to use just violates the constraints. But there are two different scenarios in which the application behaves differently. Allow me to provide two small examples which illustrate what I'm experiencing to be weird case 1. - open application: kate - execute this piece of code in Kwin var clients = workspace.clientList(); for (var i=0; i<clients.length; i++) { if (clients[i].resourceClass.toString() === "kate") {kate = clients[i];}; } kate.geometry = {x: 5, y: 100, width: 400, height: 800}; - succes, kate now takes on this geometry case 2. - close application: kate - execute this piece of code workspace.clientAdded.connect ( function(client) { client.geometry = {x: 100, y: 5, width: 800, height: 400}; return 0; } ); - open application: kate - fail, kate takes on some random geometry I don't understand why these two cases generate different results, but as you said this may be kate related... In which case I report it in the kate section I suppose? (Just checking to be sure that it is kate related and not kwin.) just saying: your second script part has x/y and width/height swapped compared to the working one. that was intentional in this example, if I had not done that and the second script would work (which it doesn't) then you would not notice a difference in the geometries. Anyways, while trying out other applications I noticed that kate is by far not the only application that does not listen to the settings that you apply (spotify, inkscape, etc...) My observation is that whatever you do inside the workspace.clientAdded function does not always work, for a lot of applications they just ignore whatever you tell them to do and create a geometry set by the application. This only happends during the startup of the application once it has already been started up you can do whatever you want with the geometry using the API that kwin provides. Shouldn't the clientAdded function overrule whatever the application itself tries to achieve in terms of geometry and what not? Right now creating a Kwin script that manages my newly added applications *consistently* is simply impossible because most applications have their own predefined geometries. Or is there a way to force the applications to adjust to the settings you apply to it, that I'm unaware of? Also the workspace.getClient() function does not work for newly added clients until the workspace.clientAdded() routine is finished, the client is not added internally to the workspace. Which means that kwin does not manage newly added applications yet until they are started up? Or is there a way to call clientAdded() after the application has started up instead of before? Right now it goes: - apply settings in kwin - startup application -> applies settings from applications result = applied settings in kwin are overwritten by application itself Shouldn't it be? - startup application -> applies settings from applications - apply settings in kwin my main problem is that you're basically setting up default settings for the application in kwin and then you pray to god the application does not define its own settings which override your default settings. A more expected behavior would be that you let the application decide on the default behavior and then you can adjust these settings using kwin. (settings = geometries, minimized, etc...) Please note that there are also window rules which support setting values for windows when they open. This might be a better solution than scripting. I've taken a look at those at first but they did not satisfy my needs. Regardless of that, don't you think that a window manager API that is not able to change the geometry of applications that are started kinda defeats the purpose of a "window manager"? Basically, one of the simplest things one could do is: - Set the geometry of an application that is started to some geometry But right now that only works for a handful of applications that don't set their own geometry... Feels like I don't even have control of my own window manager... (If only there was a "force" option...) |