Skip to content

Fix anchoring in kwin and smithay#189

Open
itshog wants to merge 2 commits intophilj56:masterfrom
itshog:fix-centering
Open

Fix anchoring in kwin and smithay#189
itshog wants to merge 2 commits intophilj56:masterfrom
itshog:fix-centering

Conversation

@itshog
Copy link
Copy Markdown

@itshog itshog commented Aug 11, 2024

Should resolve #165; should also fix #170. Instead of setting all anchors for centering (or, for instance, setting both left and right anchor to achieve horizontal centering), we now only set the needed anchor.

See this fuzzel commit for more information.

itshog added 2 commits August 11, 2024 21:01
Solves a bug regarding wrong anchoring which also caused the content of the tofi window to get stretched in strange ways in kwin and compositors using smithay. Instead of setting all anchors for centering (or, for instance, setting both left and right anchor to achieve horizontal centering), we now only set the needed anchor
@chriselrod
Copy link
Copy Markdown

This works for me on niri.

@philj56 philj56 added the bug Something isn't working label Dec 30, 2024
@philj56
Copy link
Copy Markdown
Owner

philj56 commented Dec 30, 2024

Hey, sorry for the slow response on this and thanks for the PR! Unfortunately this issue isn't quite so simple.

The reason opposing anchors were set to centre the window, rather than neither, was because this is required to get a full-width / height window on a compositor that:

  • Supports fractional scaling
  • Does not support the wp-fractional-scale-v1 protocol.
    In this scenario, it's impossible (I think) for the window to determine how big it needs to be, at least in the way tofi works.

With this patch set, setting --width=0 --anchor=center on sway gives me:

zwlr_layer_surface_v1#20: error 1: width 0 requested without setting left and right anchors

and no visible window.

Back when I was last updating tofi, wp-fractional-scale-v1 was not widely implemented, so I couldn't rely on it.
Nowadays however, it seems almost all compositors support it, so we can probably get rid of the legacy --width=0 behaviour. I think the correct thing to do is:

  • Make a release (soon!), with warnings that --width=0 and --height=0 are deprecated, and 100% is preferred.
  • In the release after that, remove --width=0 support and merge this.

@itshog
Copy link
Copy Markdown
Author

itshog commented Jan 20, 2025

I think the correct thing to do is:

* Make a release (soon!), with warnings that `--width=0` and `--height=0` are deprecated, and `100%` is preferred.

* In the release after that, remove `--width=0` support and merge this.

This seems reasonable to me, thanks for looking into this. Any way we can help?

@Fireye04
Copy link
Copy Markdown

Setting up tofi on niri and would love to see this PR merged soon, is there any timeframe for when it might happen? I'm happy to build tofi from source with the patch till then, just wondering when I can expect the fix to be released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Window Positioning Issue on KDE Plasma 6 Tofi not respecting anchor and resolution/scaling on Niri

4 participants