Bug 442675 - [feature] - new indicators API in order to be able to be drawn more far to panel background roundness
Summary: [feature] - new indicators API in order to be able to be drawn more far to pa...
Status: RESOLVED FIXED
Alias: None
Product: lattedock
Classification: Plasma
Component: application (show other bugs)
Version: git (master)
Platform: Neon Linux
: NOR wishlist
Target Milestone: ---
Assignee: Michail Vourlakos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-18 23:19 UTC by doncbugs
Modified: 2021-10-04 04:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Top shows the stock Plasma panel compared to Latte in the front. Bottom shows Latte with minimal margins. (20.45 KB, image/jpeg)
2021-09-18 23:19 UTC, doncbugs
Details
problems with moving content into corners (7.91 KB, image/png)
2021-09-29 18:43 UTC, doncbugs
Details
different approaches to handling styling on corners, available space, rationale for side margins slider (14.73 KB, image/png)
2021-09-30 21:31 UTC, doncbugs
Details
Indicator, Background Corner Margin in action (74.86 KB, image/jpeg)
2021-10-02 07:28 UTC, Michail Vourlakos
Details
margins and border padding (11.72 KB, image/png)
2021-10-02 18:15 UTC, doncbugs
Details
plasma panel (left) floating latte dock (right) (118.38 KB, image/png)
2021-10-04 04:19 UTC, doncbugs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description doncbugs 2021-09-18 23:19:53 UTC
Created attachment 141691 [details]
Top shows the stock Plasma panel compared to Latte in the front. Bottom shows Latte with minimal margins.

SUMMARY
As shown in screenshot, when rounded corners are used in a Plasma style theme, Latte draws widgets inside the border. Themes with very round corners, irregular corners (e.g. superellipse), or very large corner assets end up with very large side margins.

STEPS TO REPRODUCE
1. Use latte dock in the "dock" mode
2. Select a Plasma style with round corners
3. Position a widget against a side of the dock

OBSERVED RESULT
Latte places content next to edge of a corner asset

EXPECTED RESULT
Unsure. Plasma (usually) follows margins set in theme. There should at least be a way to control margins around content, such that it looks similar to the Plasma panel in the screenshot. Latte seems to be missing a final control for the space on the sides, as shown in the bottom image.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE neon 5.22
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.3
Comment 1 doncbugs 2021-09-29 18:43:05 UTC
Created attachment 142015 [details]
problems with moving content into corners

Michail, please explain why you have changed this to a feature request for an indicators API. I do not see how that will solve the problems of highlights (tabbar.svg) in themes.

I do see this as a theme-breaking bug, as plasma themes have information concerning margins in their panels. Latte ignores these, even when using the theme's original corner styles. As a result, everything is drawn inside of the borders, adding an unusual amount of padding and making even spacing between, say tasks.svg icons, impossible without shrinking corner radii to that of the side margins. What happens when the corner radius is too large is shown in the latte dock screenshot.

The attached image shows some scenarios for the tabbar.svg element, as it is drawn behind many plasmoids in the panel, including kickoff and the system tray. As they are currently, tabbar.svg has no means of coping with corners and the square that will be drawn will extend outside of a panel with very round corners. Thus, in the screenshot, 1 represents a completely square panel. 2 represents how the plasma panel would handle it. 3 represents latte handling it to use space effectively. 4 and 5 represent ways of clipping it if there was a way to know that tabbar.svg had an invisible margin around it. 6 represents how I expect clipping to be handled by latte. 4 and 5 are completely broken if tabbar.svg swaps the invisible margin for a shadow, outline, etc.

The following are 2 potential solutions. One is substantially easier to implement.

My proposed solution is simply to allow a toggle for latte to follow the theme or not. A slider to control the spacing on the sides as shown in the latte screenshot would be even more useful for the general case.

The solution that can perfectly support the corners would be if the corners of the panel were set, and assets for tabbar.svg were added that could be drawn if a plasmoid had corners next to it.
Comment 2 Michail Vourlakos 2021-09-29 19:01:00 UTC
I can not understand how following plasma theme panel backgrounds margins will solve any of this. Give me screenshots of Plasma panels and Latte panels in comparison for specific plasma themes that plasma works fine and Latte breaks.

Latte is not following plasma design decisions in every aspect for the simple reason that Latte gives the user the option to change panel background roundness and thickness. Plasma is not offering such option, plasma panels are considered always as fully drawn rectangles and this is not the case for Latte.

The Indicators API that I am referring is at:
 - https://techbase.kde.org/LatteDock
 - https://techbase.kde.org/LatteDock#Indicators

The option in Latte for Plasma Indicators is not the real plasma indicator is just one of the many indicators available. Plasma Indicator for Latte is hosted at: https://invent.kde.org/plasma/latte-dock/-/tree/master/indicators/org.kde.latte.plasma

there are plenty other indicators that should also be taken into account that have nothing to do with plasma themes: https://store.kde.org/browse?cat=563&ord=latest

From my perspective already plasma theme provided margins can not solve any of this because even Plasma ignores these margins for ALL applets that are requesting to touch the panel edge, such case is the Plasma TaskManager and Icon-Only Taskmanager.

So moving back in the start Latte needs a solution for this and actually for Plasma that solution is irrelevant. The solution for Latte is the Latte Indicators API provided at: https://techbase.kde.org/LatteDock#Indicators needs to be extended in order for every indicator to be able to provide metadata for its maximum drawn area. Based on that Latte could make calculations afterwards to solve all the scenarios that you describe.
Comment 3 doncbugs 2021-09-30 21:31:58 UTC
Created attachment 142041 [details]
different approaches to handling styling on corners, available space, rationale for side margins slider

(In reply to Michail Vourlakos from comment #2)

I initially reported this bug because Latte uses Latte rules for the panel borders even when set to use the theme's appearance. Since the plasma panel does not currently support many features of Latte (e.g. floating), it would be nice to have a 1:1 representation. However, I understand you want to solve this problem everywhere. I agree that it is about time KDE had a round dock with even margins like Gnome.

> I can not understand how following plasma theme panel backgrounds margins
> will solve any of this. Give me screenshots of Plasma panels and Latte
> panels in comparison for specific plasma themes that plasma works fine and
> Latte breaks.

You are correct that it will not solve it. In fact, Latte cannot "break," because it 'plays it too safe.' For Latte, the real panel is a rectangle with no rounded corners. Corners are just attached to the ends.

My point is that at least themers have the opportunity to try and correct the design of their indicators/tabbar i.e. if it looks good on Plasma it will look good on Latte. Presently, the option does not even exist and Latte continues to have large side margins as shown in the screenshot of Plasma vs Latte.

> From my perspective already plasma theme provided margins can not solve any
> of this because even Plasma ignores these margins for ALL applets that are
> requesting to touch the panel edge, such case is the Plasma TaskManager and
> Icon-Only Taskmanager.

We will focus only on the Latte taskmanager styles now. I believe the necessary change is for Latte indicators to support corners on a case-by-case basis. Anything less than that will result in what Latte currently looks like, since many indicators are large rectangles with no room for moving into corners.

For example, the Win7 indicator is rectangular and only suited for rectangular panels. If it could be rounded, just as the panel can be, to become circular, it would support corners. No. 2 shows this. Otherwise, it will be about in the same place as it presently is.

Styles that touch the bottom border as a full line will likely not be able to be moved into corners. The Win10 indicator solution is opinionated and I believe requires configuration options for the user to choose. The default would not move into corners. A second choice is to move it into corners and clip what hangs off of the panel. A third choice comes from my Spectrum Ultra theme, shown in No.1. The indicator line curls up and thins out as it climbs the corner.

Lastly, there are styles designed to support a dock. That is, styles that are drawn close to the icons and have a lot of empty space between them and the panel edge. An example would be the macOS dock and my theme in the comparison screenshot. These I believe can support a proper way of determining available space from the panel. No. 3.1 and 3.3 in the screenshot show the "real" rectangle of available space in the panel. No. 3.2 shows the available space for small indicators like macOS and maybe Unity. Icons may also have room to be moved into corners, but that depends on the style of the icons, likely requiring yet another user control. If icons have a large margin of empty space, they can be moved. Icons such as WhiteSur have less, as they are rectangular. Thinning the margin is difficult to do programmatically.

Taking into account how many cases there are, I believe a user control makes more sense in the short-term case. Just as having a half height panel is a style, there can also be a slider to allow content to move into the corners like the Plasma panel does. No. 4 shows this comparison.

I would like to see how adding information about how far indicators can be drawn will help. The majority, if not all, of the styles seem to be created assuming a rectangle with no rounded corners. Without allowing the styles to support corners, the styles will all look exactly the same because they have no space to be moved into corners.
Comment 4 Michail Vourlakos 2021-10-02 06:54:23 UTC
(In reply to doncbugs from comment #3)
> 
> Taking into account how many cases there are, I believe a user control makes
> more sense in the short-term case. Just as having a half height panel is a
> style, there can also be a slider to allow content to move into the corners
> like the Plasma panel does. No. 4 shows this comparison.
> 

My initial thoughts were to let all indicators to set two options:
   a) Painted Area Thickness Margin (the painted area is considered centered always so the thickness margin is used both for bottom and top margins)
   b) Painted Area Roundness (the painted area is considered always a centered rectangle but the indicator can specify the painted area roundness)

Benefits:
 - with [a+b] Latte could possibly define what is the best positioning of panel background in order to feel right and it could also use some clipping method
 - [a+b] can be user-specified if that is what the indicator creator wants at per dock/panel basis
 - [a+b] could also be indicator auto-adjusted based on each indicators settings and requirements

On the other hand, the calculations for [a+b] could break in many ways so this can not be a v0.10.x branch solution.

-------------------

What can be done at this point is to introduce in the Indicators API (at v0.10.3 or v0.10.4) a new option probably called: "Corner Margin" that could take values between 0 - 100% . Each Indicator will take the responsibility to provide it or not for the user to alter. Latte and Plasma indicators could possibly introduce it after the Indicators API has been extended by default. That option default value will be 100% and that would mean the current behavior, 50% would mean half distance from background edge and 0% would mean almost touching it.
Comment 5 Michail Vourlakos 2021-10-02 07:28:36 UTC
Created attachment 142080 [details]
Indicator, Background Corner Margin in action

propose v0.10.x solution in action
Comment 6 doncbugs 2021-10-02 18:13:50 UTC
(In reply to Michail Vourlakos from comment #4)

Upon further consideration, I believe a more traditional option may be present, but it would require drastic changes to how Latte currently allows configuration. I have added a screenshot to demonstrate this. The dark gray rectangle represents available space on the dock and the light gray rectangle represents the drawn dock. Green represents padding or 'thickness,' perhaps. With the new method there are "border margins" and "border padding."

"A" shows small border margins, though I am unsure if zero should be the size of the items or be around 50% of their size. Essentially, "A" has all corners (at least) inside the dock's space.
"B" shows 1x border margins and content is always inside, regardless of dock roundness.
"C" shows "border padding" which adds space around the dock's rectangle. I see this as an extension of the Thickness control where it affects both the sides and the top and bottom. Or, it could have both top/bottom and left/right controls.
What limitations do you see to this method over the present one? i.e. do you think this can support all current use cases, even if it might be less user-friendly?

> My initial thoughts were to let all indicators to set two options:
>    a) Painted Area Thickness Margin (the painted area is considered centered
> always so the thickness margin is used both for bottom and top margins)
>    b) Painted Area Roundness (the painted area is considered always a
> centered rectangle but the indicator can specify the painted area roundness)
> 
> Benefits:
>  - with [a+b] Latte could possibly define what is the best positioning of
> panel background in order to feel right and it could also use some clipping
> method
>  - [a+b] can be user-specified if that is what the indicator creator wants
> at per dock/panel basis
>  - [a+b] could also be indicator auto-adjusted based on each indicators
> settings and requirements
> 
> On the other hand, the calculations for [a+b] could break in many ways so
> this can not be a v0.10.x branch solution.

I am not sure I follow this. Does it look anything like the diagram I uploaded? I cannot quite imagine where this would break. Unless the user was pursuing a style like in No. 4 of the previous screenshot.

> What can be done at this point is to introduce in the Indicators API (at
> v0.10.3 or v0.10.4) a new option probably called: "Corner Margin" that could
> take values between 0 - 100% . Each Indicator will take the responsibility
> to provide it or not for the user to alter. Latte and Plasma indicators
> could possibly introduce it after the Indicators API has been extended by
> default. That option default value will be 100% and that would mean the
> current behavior, 50% would mean half distance from background edge and 0%
> would mean almost touching it.

This satisfies my use case.
With respect to the proposal in the new screenshot, I say also consider negative ~25-50% as the minimum, like in the previous screenshot's No. 4. Something like allowing the end of a floating dock to be centered under an icon the edge of a list of tasks.
Comment 7 doncbugs 2021-10-02 18:15:29 UTC
Created attachment 142084 [details]
margins and border padding
Comment 8 Michail Vourlakos 2021-10-02 19:14:06 UTC
(In reply to doncbugs from comment #7)
> Created attachment 142084 [details]
> margins and border padding

No worries, 0% corner margin means touching the farest edge of the background roundness,so if you have big rounded background then 0% means out of the background.
Comment 9 Michail Vourlakos 2021-10-02 19:14:15 UTC
(In reply to doncbugs from comment #7)
> Created attachment 142084 [details]
> margins and border padding

No worries, 0% corner margin means touching the farest edge of the background roundness,so if you have big rounded background then 0% means out of the background.
Comment 10 doncbugs 2021-10-03 02:05:18 UTC
(In reply to Michail Vourlakos from comment #9)

> No worries, 0% corner margin means touching the farest edge of the
> background roundness,so if you have big rounded background then 0% means out
> of the background.

Just to clarify question was if 0% would look more like No. 4 in this screenshot: https://bugs.kde.org/attachment.cgi?id=142041

Or if it looks like "1A" from https://bugs.kde.org/attachment.cgi?id=142084

From what I understand, you are referring to the latter?
Comment 11 Michail Vourlakos 2021-10-03 06:22:32 UTC
Git commit 1674344f9f5b811a6de737b819a2220f17c242fd by Michail Vourlakos.
Committed on 03/10/2021 at 06:21.
Pushed by mvourlakos into branch 'v0.10'.

[indicators api] - new background corner margin

--introducing in Indicators API a new option to
specify the indicator preference for the distance
between the indicator and panel background roundness.
By altering the option the indicator can get into
the panel background roundness.

M  +8    -0    containment/package/contents/ui/abilities/Indicators.qml
M  +4    -4    containment/package/contents/ui/background/MultiLayered.qml
M  +1    -0    declarativeimports/abilities/client/Indicators.qml
M  +1    -0    declarativeimports/abilities/definition/Indicators.qml
M  +1    -0    declarativeimports/abilities/definition/indicators/IndicatorInfo.qml
M  +6    -0    declarativeimports/components/IndicatorItem.qml
M  +43   -8    indicators/default/package/config/config.qml
M  +3    -0    indicators/default/package/config/main.xml
M  +1    -0    indicators/default/package/ui/main.qml
M  +38   -2    indicators/org.kde.latte.plasma/package/config/config.qml
M  +3    -0    indicators/org.kde.latte.plasma/package/config/main.xml
M  +3    -0    indicators/org.kde.latte.plasma/package/ui/main.qml

https://invent.kde.org/plasma/latte-dock/commit/1674344f9f5b811a6de737b819a2220f17c242fd
Comment 12 Michail Vourlakos 2021-10-03 06:24:11 UTC
Git commit c86878f6c73a3c40ec877fe0c3663279623b39b9 by Michail Vourlakos.
Committed on 03/10/2021 at 06:23.
Pushed by mvourlakos into branch 'master'.

[indicators api] - new background corner margin

--introducing in Indicators API a new option to
specify the indicator preference for the distance
between the indicator and panel background roundness.
By altering the option the indicator can get into
the panel background roundness.

M  +8    -0    containment/package/contents/ui/abilities/Indicators.qml
M  +4    -4    containment/package/contents/ui/background/MultiLayered.qml
M  +1    -0    declarativeimports/abilities/client/Indicators.qml
M  +1    -0    declarativeimports/abilities/definition/Indicators.qml
M  +1    -0    declarativeimports/abilities/definition/indicators/IndicatorInfo.qml
M  +6    -0    declarativeimports/components/IndicatorItem.qml
M  +43   -8    indicators/default/package/config/config.qml
M  +3    -0    indicators/default/package/config/main.xml
M  +1    -0    indicators/default/package/ui/main.qml
M  +38   -2    indicators/org.kde.latte.plasma/package/config/config.qml
M  +3    -0    indicators/org.kde.latte.plasma/package/config/main.xml
M  +3    -0    indicators/org.kde.latte.plasma/package/ui/main.qml

https://invent.kde.org/plasma/latte-dock/commit/c86878f6c73a3c40ec877fe0c3663279623b39b9
Comment 13 Michail Vourlakos 2021-10-03 06:27:05 UTC
(In reply to doncbugs from comment #10)
> (In reply to Michail Vourlakos from comment #9)
> 
> > No worries, 0% corner margin means touching the farest edge of the
> > background roundness,so if you have big rounded background then 0% means out
> > of the background.
> 
> Just to clarify question was if 0% would look more like No. 4 in this
> screenshot: https://bugs.kde.org/attachment.cgi?id=142041
> 
> Or if it looks like "1A" from https://bugs.kde.org/attachment.cgi?id=142084
> 
> From what I understand, you are referring to the latter?

none of these designs describes how the panel background corner works now with indicators or I can not understand them fully. You can now test the solution and provide feedback, The option is found in Effects -> Indicators -> Corner Margin

It is a per-indicator option that each indicator needs to set for its preference and it is a percentage because items auto-size adjustment case should also be considered.
Comment 14 doncbugs 2021-10-04 04:16:58 UTC
(In reply to Michail Vourlakos from comment #13)

> none of these designs describes how the panel background corner works now
> with indicators or I can not understand them fully.

Yes, it was a question for latte in the long run. I was asking if more functionality and easier configuration would be possible with a design like that as opposed to the present.

> It is a per-indicator option that each indicator needs to set for its
> preference and it is a percentage because items auto-size adjustment case
> should also be considered.

First, I would like to thank you for finally allowing KDE to have a heavily customizable round dock that could resemble Gnome's or macOS'. I think it has been too long that we have not had such a thing.

Second, my review: It is definitely possible now to achieve the look, as I have shown in the screenshot. I cannot get the theme-defined shadows or corners to show up and latte looks very messed up. It may be neon related.

Anyway, I am a bit frustrated that there isn't a more straightforward way of positioning the things. I found myself inching along the sliders at 1% increments to get everything right. I feel that an easier, top-down approach may be better where margins are all set to be equal and that amount can be adjusted from a single slider. It requires a bit of thinking however, and would require increased integration with indicators.

However, this is more than enough. A configuration can be made and the style will be preserved for plenty of users to access without having to deal with the positioning.
Comment 15 doncbugs 2021-10-04 04:19:01 UTC
Created attachment 142131 [details]
plasma panel (left) floating latte dock (right)

Even margins on all sides of indicators is now possible!