Bug 432197

Summary: KWin window rules: Height in pixels not applied
Product: [Plasma] kwin Reporter: matthias.schrumpf
Component: rulesAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: isma.af
Priority: NOR    
Version First Reported In: 5.20.5   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Exported Kwin ruleset for the issue described above.
Exported Kwin ruleset: Issue solved

Description matthias.schrumpf 2021-01-27 12:43:20 UTC
SUMMARY
When specifying rules for windows in the KWin settings, all settings are applied as expected - except for the height in pixels, causing some windows to partially disappear behind the task bar at the bottom of the screen.  

STEPS TO REPRODUCE
1. Create a new set of window rules in KWin settings
2. Open a window such as Telegram or Signal messenger and move it to a position in the lower half of the screen, where you want to keep it. 
3. Use "Detect window properties" on that window and save identification as well as position and size of the window to be applied at initialization. Apply and save settings. 
4. Close the window and the program. 

OBSERVED RESULT
The window will now always open in the specified position and with the specified width in pixels. But its height will extend to the bottom edge of the screen, so that a significant portion of the window is hidden behind the task bar. 

EXPECTED RESULT
The window will now always open in the specified position and with the specified width and height in pixels. It will thus always be located above the task bar, completely visible. 

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Kernel 5.9.16-1-MANJARO
(available in About System)
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
The bug occurs in some windows such as the desktop clients for Telegram and Signal, but not for others such as Dolphin or Cool Retro Term. Adding the parameters of size limits or forcing to ignore size limits in KWin did not solve the issue.
Comment 1 Ismael Asensio 2021-01-27 21:23:30 UTC
I cannot reproduce this on Telegram window. 

Can you please export and share the ruleset you have for it, so I may try to reproduce the bug?

Thanks!
Comment 2 matthias.schrumpf 2021-01-28 11:50:02 UTC
Created attachment 135264 [details]
Exported Kwin ruleset for the issue described above.

I added this attachment as requested by user Ismael Asensio
Comment 3 matthias.schrumpf 2021-01-28 11:51:59 UTC
(In reply to Ismael Asensio from comment #1)
> I cannot reproduce this on Telegram window. 
> 
> Can you please export and share the ruleset you have for it, so I may try to
> reproduce the bug?
> 
> Thanks!

Thank you for your reply. I have exported the settings and added them as an attachment.
Comment 4 Ismael Asensio 2021-01-28 17:45:36 UTC
Ok, I see. 

Telegram also enforces a minimum size to its main window. For me that is 570x755.
That means that no size below that minimum will be applied (even when forced by a rule, because the minimum limit takes precedence).

I guess the other apps you mention also set a minimum size.

Good news is that you can also force the Minimum Size property within the same rule, and then override that minimum. Then, the height you had set on the Size property should be applied correctly.

Please, try that and report back if that worked for you.
Comment 5 matthias.schrumpf 2021-01-29 09:06:53 UTC
Created attachment 135276 [details]
Exported Kwin ruleset: Issue solved
Comment 6 matthias.schrumpf 2021-01-29 09:12:25 UTC
(In reply to Ismael Asensio from comment #4)
> Ok, I see. 
> 
> Telegram also enforces a minimum size to its main window. For me that is
> 570x755.
> That means that no size below that minimum will be applied (even when forced
> by a rule, because the minimum limit takes precedence).
> 
> I guess the other apps you mention also set a minimum size.
> 
> Good news is that you can also force the Minimum Size property within the
> same rule, and then override that minimum. Then, the height you had set on
> the Size property should be applied correctly.
> 
> Please, try that and report back if that worked for you.

Thank you for your reply. 
I don't know if I made that clear enough in the original post, but I had also tried to solve the problem by changing the minimum and maximum size properties in various ways. I gave it another try, and it still did not work. 

I did solve the problem though by also including the properties "Ignore requested geometry" and "Respect size limitations", in addition to your suggstions. I exported and uploaded the ruleset that works for both Telegram and Signal above.
Comment 7 Ismael Asensio 2021-01-29 14:31:32 UTC
(In reply to matthias.schrumpf from comment #6)
> (In reply to Ismael Asensio from comment #4)
> > Ok, I see. 
> > 
> > Telegram also enforces a minimum size to its main window. For me that is
> > 570x755.
> > That means that no size below that minimum will be applied (even when forced
> > by a rule, because the minimum limit takes precedence).
> > 
> > I guess the other apps you mention also set a minimum size.
> > 
> > Good news is that you can also force the Minimum Size property within the
> > same rule, and then override that minimum. Then, the height you had set on
> > the Size property should be applied correctly.
> > 
> > Please, try that and report back if that worked for you.
> 
> Thank you for your reply. 
> I don't know if I made that clear enough in the original post, but I had
> also tried to solve the problem by changing the minimum and maximum size
> properties in various ways. I gave it another try, and it still did not
> work. 
> 

Ah ok! Sorry I didn't fully understand that part.
That change alone did work for me, so that's why I asked again.

> I did solve the problem though by also including the properties "Ignore
> requested geometry" and "Respect size limitations", in addition to your
> suggstions. I exported and uploaded the ruleset that works for both Telegram
> and Signal above.

Nice! From 5.21 a hint has been added to suggest that extra properties.
Comment 8 matthias.schrumpf 2021-01-29 17:50:21 UTC
(In reply to Ismael Asensio from comment #7)

Excellent, I'm glad to hear that. 
Thank you very much for your support. 
Best regards