| Summary: | cannot change both width and height of client geometry (maybe a race?) | ||
|---|---|---|---|
| Product: | [Plasma] kwin | Reporter: | Antonio Russo <aerusso> |
| Component: | scripting | Assignee: | KWin default assignee <kwin-bugs-null> |
| Status: | REOPENED --- | ||
| Severity: | normal | CC: | andy, kde |
| Priority: | NOR | ||
| Version First Reported In: | 5.25.2 | ||
| Target Milestone: | --- | ||
| Platform: | Debian testing | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Antonio Russo
2023-05-16 04:16:45 UTC
I forgot to mention: this is a wayland regression. It is broken on kwin_wayland, but works on kwin_X11. To explain what's happening: client.geometry.height = 1000; is asking the client for the geometry of (currentWidth, 1000); client.geometry.width = 1000; is asking the client for the geometry of (1000, currentHeight); Changing geometry is an async operation, at the time of the second call, the currentHeight is the frames current height, which is not 1000. I would say the script code is wrong, set client.geometry to a rect directly. Please reopen if there's a reason why your script can't do that. Yes, I suspected that the async operations were doing this, but I was never able to figure out how to overcome that. In particular, I don't know how to instantiate a QRect object (is it spelled "rect"?)? Could you please give me the exact script that you are saying will allow me to change both the width and height at the same time? If such a script indeed exists, I definitely agree this bug should be closed. Thank you, Antonio (In reply to Antonio Russo from comment #3) > Yes, I suspected that the async operations were doing this, but I was never > able to figure out how to overcome that. In particular, I don't know how to > instantiate a QRect object (is it spelled "rect"?)? > > Could you please give me the exact script that you are saying will allow me > to change both the width and height at the same time? If such a script > indeed exists, I definitely agree this bug should be closed. > > Thank you, > Antonio I figured it out (for plasma 6). You can set the entire frameGeometry object at once. var x = 2000 var y = 2000 var width = 200 var height = 200 var left = x var right = x + width var top = y var bottom = y + height workspace.activeWindow.frameGeometry = {"x":x,"y":y,"width":width,"height":height,"left":left,"right":right,"top":top,"bottom":bottom} If I query the geometry again (this is in the shell scripting console) I get {"x":2000,"y":2000,"width":200,"height":339,"left":2000,"right":2200,"top":2000,"bottom":2339} I was wondering if we have to specify all that or just x,y,width,height. If I don't specify left/right/top/bottom workspace.activeWindow.frameGeometry = {"x":x,"y":y,"width":width,"height":height} if I query the result I get slightly different positioning, but same width and height {"x":2000,"y":1861,"width":200,"height":339,"left":2000,"right":2200,"top":1861,"bottom":2200} But for just a move this works workspace.activeWindow.frameGeometry = {"x":x,"y":y} For just a resize lol this doesn't work, it moves the window to (0,0) which is off-screen for my monitor setup. workspace.activeWindow.frameGeometry = {"width":width,"height":height} |