paulmcauley / klassy

Klassy is a highly customizable binary Window Decoration, Application Style and Global Theme plugin for recent versions of the KDE Plasma desktop.
711 stars 22 forks source link

LightlyShaders 2.0: Round the bottom window corner shadows when there are no borders #61

Open ThakshilaDamsak opened 1 year ago

ThakshilaDamsak commented 1 year ago

If the corner radius increases, only the shadows in the upper corners are rounded when there are no window borders. So can you round the bottom window corner shadows to use with LightlyShaders2.0 when there are no window borders?

For example, Sierra Breeze Enhanced has rounded shadows in the bottom corners when there are no window borders.

Shadow

Void-0000 commented 1 year ago

The same thing also happens to outlines, they will only be rounded on the top corners when there are no borders, like this: image

paulmcauley commented 1 year ago

Breeze actually has a bug where for no borders it still draws the bottom outline as if there were a rounded corner -- something I fixed in Klassy. If I change this behaviour, then it will break the appearance for the majority of users who are not using LightlyShaders. Unless there is an easy way to detect LightlyShaders I can't see how to change it.

I don't know exactly what LightlyShaders does, but it seems it does not adjust the blurRegion or shadows, and that is why you are seeing the difference.

You shouldn't need to use LightlyShaders anyway when you can just increase the border size.

ThakshilaDamsak commented 1 year ago

I don't know about GitHub. But if you like, can you create another branch for LightlyShaders2.0 users with this change?

Void-0000 commented 1 year ago

Or maybe a toggle somewhere in the settings?

ryu-ketsueki commented 1 year ago

There are a few problems with the way LightlyShaders implements rounded corners on the bottom of borderless windows. First, it is dependent on X11 and how you can figure out the window geometry, where exactly the corners are and stuff, so it will not work on Wayland session. Second, if I read this code right, it relies on QPainter to actually get rid of the corners so it doesn't affect the geometry of the window directly and could cause problems with aliasing. So far the best way to get rounded bottom corners is by increasing the bottom border thickness. Here's one thing, though. There are still cases when the rounded corners look sharp after a while. Not with KDE Applications, however. I noticed that with Discord. Besides, LightlyShaders is a KWin effect, not something that would be implemented on the window decoration. That and it stops working entirely on each new update of KDE Frameworks or Plasma.

Void-0000 commented 1 year ago

Besides, LightlyShaders is a KWin effect, not something that would be implemented on the window decoration.

I don't think the intention is to implement LightlyShaders as part of the window decoration, just to make it compatible for those who prefer not having borders.

Void-0000 commented 1 year ago

In the meantime, I've made a fork of this that just ignores if windows have borders or not when drawing outlines and shadows.

TheRamsWay commented 1 year ago

First, it is dependent on X11 and how you can figure out the window geometry, where exactly the corners are and stuff, so it will not work on Wayland session.

It does work on Wayland though. Here you can see the 2.0 version working on Wayland with the Sierra Breeze Enhanced window decoration. image

paulmcauley commented 1 year ago

On master I just (765e08f22d12c7e72d241fcb39d436d57bc26677 and ba60c7118ec406304c9034c5daed1f549cb9c679) implemented an option for this:

roundBottomCornersNoBorders

It mostly works with a-parhom LightlyShaders (tested on Wayland). On Wayland the LightlyShaders corner radius setting will be double that of Klassy.

One issue is that LightlyShaders crops off much of the Klassy window outline as well (not as noticeable if you increase the outline thickness, or disable outlines altogether). Perhaps some of you could convince the LightlyShaders developer to have an option to not trim the Klassy window outline?

Void-0000 commented 1 year ago

Perhaps some of you could convince the LightlyShaders developer to have an option to not trim the Klassy window outline?

Apparently, it's not possible (anymore). The v2.0 version worked fine with it as it only cut the window content and let the shadow underneath show, but an update to kwin broke that so the newer version has to cut the whole thing, including the shadow, and then redraw an interpolated shadow under the corners. According to the developer, in the new version of kwin the previous implementation isn't possible to recreate anymore. Still holding out hope, though.

matinlotfali commented 1 year ago

Does this help? https://github.com/matinlotfali/KDE-Rounded-Corners

Void-0000 commented 1 year ago

Does this help? https://github.com/matinlotfali/KDE-Rounded-Corners

Unfortunately not, since klassy's outline is drawn as part of the shadow, anything that replaces it also replaces the outline. Do you think it could be possible to keep the original shadow when rounding the corners?

matinlotfali commented 1 year ago

Do you think it could be possible to keep the original shadow when rounding the corners?

The shadow has caused me many troubles due to its raster implementation (as opposed to vector rendering), making it very difficult to find the matching shadow for the corners. That is why I replaced it with my own vector rendering with no additional overhead on the desktop performance.