#How to achieve rounded corners?

1 messages · Page 1 of 1 (latest)

graceful whale
#

i have enabled macosPrivateApi, disabled decorations and set transparency to true.
In my styles.css i have set

:root {
  border-radius: 40px;
}

but i seem to get this weird sharp corners around my rounded corners

green vortex
graceful whale
#

yes, isn't that just for windows?

#

im using macos

green vortex
graceful whale
#

but i tried it. it added shadow but it didn't add the corners

green vortex
#

Oh, I see

#

I haven't tested it on macOS

#

And it does provide rounder corners on Windows 11

graceful whale
#

it does. but it doesn't say anything about rounded corners on macos

strong bolt
#

Essentially, put the root element and custom title bar in a wrapper div. Then, set the body to transparent. Apply rounding and color to the wrapper div.

#

Works without any rust or js shenanigans.

green vortex
#

Perhaps it will be sufficient for your needs

green vortex
#

For example to disable rounded corners when the app is maximized

strong bolt
#

i am doing it purely in CSS

green vortex
#

Is there a CSS selector for when the app is maximized?

strong bolt
#

breakpoints ...

#

media queries

green vortex
strong bolt
graceful whale
strong bolt
#

you set certain css stiles based on window width and height

bronze copper
#

but that doesn't catch maximized windows, does it? Like you don't know how small or large my monitor is

strong bolt
strong bolt
#

for example, how tailwind does it.

#

for example - most of my apps will only support up to 2560 x 1440, i could add support for more, but i haven't needed to yet.

green vortex
#

That's a pretty significant limitation

#

There are lots of users who might use 4K displays or widescreen

bronze copper
#

but that doesn't help with the rounded corners right? Like i have 2 monitors, one 1080p and one 1440p, so the window will always misbehave on at least one of them

strong bolt
#

would work fine on both monitors.

#

You can also use JS if you need to, for more granularity. My point was only that you don't need JS and that plenty of modern responsive design doesn't use JS at all.

#

Of course, in reactive frame works you can also create a JS function for handling rounded corners based on the tauri API -so lots of options. Just modify the wrapper divs border-radius CSS selector based on the maximised window state.

graceful whale
#

it still doesnt seem to work 😦
i still get this weird outer pointy corners
on all 4 corners

#

idk maybe im doing it wrong

strong bolt
bronze copper
bronze copper
cerulean salmon
#

also can't you make your window as big as your screen size without maximizing it

strong bolt
graceful whale
strong bolt
#

you have to make it transparent - and make the webView window itself transparent.

graceful whale
#

i have done that. the color outside the blue part is transparent only

strong bolt
#

They would know more about this than me if it's a macOS bug

graceful whale
#

if it's not too much to ask, would u be able to hop on a call and make sure i did what u told me to lol. coz im not sure i did

strong bolt
#

not at the moment - but i might be able to later. I am on my way to work rn. Just procrastinating in here xD

graceful whale
#

lol suree. thank you so muchh

strong bolt
#

The windows shadows plugin and the windows vibrancy plugin caused me a similar issue when i was first working on rounded corners. Though - iirc the windows shadows plugin doesn't support macOS well - would have to check that.

bronze copper
#

it does support macos well until you add rounded corners via css x)

strong bolt
graceful whale
bronze copper
#

oh then it's the vibrancy plugin you're seeing

graceful whale
#

omg yess. i removed the vibrancy plugin and it worked

#

so ig there is no way to have vibrancy + rounded corners? 😅

bronze copper
#

if that doesn't work then no, not yet. (on macos)

graceful whale
#

yeah i did that. didn't work

#

okay that's fine i suppose

bronze copper
#

Like it didn't fulfill your needs or straight up didn't work?

#

ah Transparent would really not be that useful here, Overlay may be better unless you want to get rid of the window controls too

graceful whale
#

i did .titlebar {background-color: transparent } and it showed the same sharp corners (like the screnshots i posted)

bronze copper
graceful whale
#

oh yes. i did that too. same result

#

it was transparent all along

#

anyway i have decorations off

bronze copper
#

The reason i asked if titlebarstyle overlay worked is that vibrancy should work too then because the rounded corners would still be the native ones

graceful whale
#

so, with decorations true, titlebar: Overlay, this is how it looks:

bronze copper
#

so the default corners are not round enough for you? That's fair 👍

graceful whale
#

they would be okay. but i dont want tile bar. when i disable titlebar with decorations: false, the corners become sharp again

bronze copper
#

but i dont want tile bar
alrighty

graceful whale
#

coz im trying to make an app like spotlight/ raycast

#

unless there is a way to make the tilebar completely invisble with no traffic lights and such, while also keeping decorations on?

bronze copper
#

not with this config no