Skip to content

config: add rounded corner exponent option#4006

Open
HigherOrderLogic wants to merge 1 commit into
niri-wm:mainfrom
HigherOrderLogic:feat/squircle
Open

config: add rounded corner exponent option#4006
HigherOrderLogic wants to merge 1 commit into
niri-wm:mainfrom
HigherOrderLogic:feat/squircle

Conversation

@HigherOrderLogic
Copy link
Copy Markdown
Contributor

Add option for rounded corner exponent, which allows user to make their corners "chamfered" or "squircle"

Screenshot from 2026-05-07 15-37-52

One minimal issue I see is that the slanted edge of a chamfered corner has slightly thinner border. This is probably fixable but I'm not really familiar with shader so I wasnt able to. Any help is appreciated.

@Sempyos
Copy link
Copy Markdown
Member

Sempyos commented May 7, 2026

gosh the squircle looks so good !!!

@Sempyos Sempyos added area:layout Columns, workspaces, scrolling, fullscreen, resize area:config Config parsing, default config, new settings pr kind:feature New features and functionality labels May 7, 2026

// Manual smoothstep() between radius - half_px and radius + half_px
// to avoid a division in clamp().
float t = clamp((dist - radius) * niri_scale + 0.5, 0.0, 1.0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one unfortunate part is that this will undo my efforts to make these shaders fit on a eee pc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the smoothstep() function is a no-go?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i removed it to save some ALU ops which made the resize shader fit. but i'm afraid with the superellipse fn you're adding many more ALU ops

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but i'm afraid with the superellipse fn you're adding many more ALU ops

In that case I have no idea then. I dont have any other formula in mind to solve this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe need to come up with some way to split these shaders or have some lightweight versions at least. for example rn the border shader doesn't fit into eee pc (so borders will always use solid color and have no rounded corners) but i think a lightweight version can remove all the color conversion stuff so at least there's rounded corners throughout


window_geometry: Rectangle<f64, Logical>,
window_corner_radius: CornerRadius,
window_corner_exponent: f32,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I'm not sure if this is needed, since the shadow and window's corner exponent will always be the same anyway.

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

Labels

area:config Config parsing, default config, new settings area:layout Columns, workspaces, scrolling, fullscreen, resize pr kind:feature New features and functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants