Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visible window borders with negative struts for maximized windows due to scale rounding #640

Open
sugar700 opened this issue Aug 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@sugar700
Copy link

sugar700 commented Aug 29, 2024

With the following layout configuration (https://git.gay/sugar/nix-config/src/commit/aa22a9fbae6c1a675a462430809e1e19158a9be9/desktop/home-manager/user/niri.nix), borders are visible for maximized windows at 1.25x scale. This doesn't happen at 1x scale.

layout {
    gaps 0
    struts {
        left -6
        right -6
        top -6
        bottom -6
    }
    focus-ring { off; }
    border {
        width 6
        active-color "#f5a9B8"
        inactive-color "#415a0c"
    }
    preset-column-widths
    default-column-width
    center-focused-column "never"
}

screenshot of niri with borders

(after zooming in onto this picture, pink window borders are visible)

This appears to happen due to effective width being 6 * 1.25 = 7.5, which is not an integer, resulting in rounding issues.

I don't know if it is an issue, considering it's not clear what the behavior should be here (fractional scaling rounding issues make everything tricky), but figured I would report it just in case.

System Information

  • niri version: niri stable 0.1.8
  • Distro: NixOS unstable
  • GPU: Intel UHD Graphics 620
  • CPU: Intel Core i5-8350U
@sugar700 sugar700 added the bug Something isn't working label Aug 29, 2024
@YaLTeR
Copy link
Owner

YaLTeR commented Aug 29, 2024

I suspect what's happening here is that negative struts are rounded to physical pixels, then the border size is also rounded to physical pixels, and these two roundings happen to result in 1 px of border being visible. I can't say off the bat whether this is something that can reasonably be fixed in the code (since borders are per-window and it doesn't make sense to take them into account in that particular spot). You could try adjusting the struts or the border width so that it works for your scale and setup.

@sugar700
Copy link
Author

Using 6.4 value for both of those helped avoid this issue in this case (6.4 * 1.25 = 8).

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

No branches or pull requests

2 participants