Apply circular ShaderEffect from SDDM to crop square user avatar into a circle with outline.
BUG: 386656
Apply circular ShaderEffect from SDDM to crop square user avatar into a circle with outline.
BUG: 386656
No Linters Available |
No Unit Test Coverage |
I intentionally didn't tag Bug 386656, as it has some debate allowing the user to select between a round or square avatar. @ngraham voted for the circle, which is what I implemented. If we want it switchable, I'll add a toggle. If not, I'll add the BUG: tag.
Nice work! Will test it out later today.
There's no reason to have the appearance user-selectable, IMHO. Part of the goal here is a consistent visual appearance. I vote for always showing the round avatar and marking this as fixing Bug 386656.
The one visual improvement I could think of is adding a thin light gray outline around the circle to help separate it from the background. This is done on the login and lock screens; might be able to mine those implementations for ideas, if it's not too hard. But even without that, this is looking good. :)
The one visual improvement I could think of is adding a thin light gray outline around the circle to help separate it from the background. This is done on the login and lock screens; might be able to mine those implementations for ideas, if it's not too hard. But even without that, this is looking good. :)
The bordered avatars are done in a different manner than this (mine involves less math!). I'll see if there's a way I can sort it out.
By the way, visual gurus: "light gray" or theme-specific color?
Yes, always a theme-specific color please! "Light gray" was just for illustration purposes. :)
The bordered avatars are done in a different manner than this (mine involves less math!). I'll see if there's a way I can sort it out.
If you copy and paste the ShaderEffect from UserDelegate.qml colorBorder is a property you can change
If you copy and paste the ShaderEffect from UserDelegate.qml colorBorder is a property you can change
Very nice bit of code. Thanks.
I stuck with @davidedmundson 's use of PlasmaCore.ColorScope.textColor for the highlight ring. I tested it with a few different color themes and the whole thing comes out looking like a natural match. This shot is back to my personal choice of an openSUSE scheme.
I noticed. Dave's code specifically says it'll be drawn antialiased. There's also an antialiasing property that you can explicitly set for the ShaderEffect element, but it didn't appear to make a difference whether on or off.
Perhaps the author of said circles can offer some advice.
AA option not set
AA option set
Does the second option look dramatically better or different? (They don't to me...)
It doesn't look any different to me. They are both the same. Maybe the screenshot is too small? I can see the pixels from far on both images.
Yeah, the same to me as well. The screenshots are natural size from my 1920x1080 screen. I'll keep looking for options, features, settings, mystic spells...
Looks great now! Quite pleasing to the eye.
I've got a few blockers though:
applets/kickoff/package/contents/ui/Header.qml | ||
---|---|---|
19 | This version bump makes Kickoff require Qt 5.11. I wasn't are that we were going to make Plasma 5.14 depend on Qt 5.11. At the minimum, it makes this hard to test without compiling your own Qt. Is there anything we're actually depending on with this patch that was added with 2.11, or can we reduce the minimum version? I manually changed it to 2.10 and didn't notice any issues... |
That’s odd. It shows us something *is* updating, just not correctly or completely. What’s strange is that it seems to be removing the old avatar but not yet updating with the new one.
applets/kickoff/package/contents/ui/Header.qml | ||
---|---|---|
19 | No, that version bump was likely from an earlier attempt using a different technique I’ll get it dialed back to the correct minimum and will repost. |
I'm not clear why user-manager removes the previous avatar, but the new one isn't immediately available.
I obviously need to force a refresh somewhere, somehow - but I don't know how.
Yes, we had a report of this: https://bugs.kde.org/show_bug.cgi?id=384107
However the issue I've seen is a genuine regression from your patch: changing my avatar from a file on disk to an image from gallery works without your patch, but fails with it.
It looks like the stuff in here may be interacting poorly the pre-existing bug. I can tell you from submitting some user-manager patches to fix avatars in the past that the code there is sadly pretty fragile.
I don't know if I need to edit user-manager to emit a signal of some kind, or if some trigger needs to go over the D-Bus... I'm wading into deep water here.
@davidedmundson - could use your input here, please. Your circle shader effect detects a user avatar change, partially - it goes blank. But it doesn't reload squareFace despite the fact that all three avatar locations (~.face, ~.face.icon, and /var/lib/AccountServices/icon/$USER all update immediately. Any idea why it doesn't refresh, or how to force it to refresh?
Let's try this...
applets/kickoff/package/contents/ui/Header.qml | ||
---|---|---|
139 | Was faceIcon.status !== Image.Ready, which I believe was an old timing test when machines were slower. Doesn't seem necessary on modern hardware. |
applets/kickoff/package/contents/ui/Header.qml | ||
---|---|---|
139 | Stupid defaults. :D |
@apol : My first pass at this used OpacityMask. It worked well. See below.
Two things, though... multiple people recommended I use Dave's shader routine from SDDM instead. Plus, with Opacity Mask, I don't think I can reproduce the much-desired "ring" effect around the image.
Comments, folks?
btw... i was thinking about copypasting such thing to have an avatar component in kirigami... would there be interest on this?
btw... i was thinking about copypasting such thing to have an avatar component in kirigami... would there be interest on this?
Not sure, I think an Avatar component would be far too use-case specific for Kirigami.
Having a round effect (like https://docs.ubuntu.com/phone/en/apps/api-qml-development/Ubuntu.Components.UbuntuShape) might make sense.
applets/kickoff/package/contents/ui/Header.qml | ||
---|---|---|
104 | FWIW, in future use the new Plasma Renderer KCM to set "Force GLC Core Profile" for testing. |
As for this patch, IMHO it's good to go. If things do become libraries we can always migrate it.
Worth noting that some values were tweaked here because of the smaller circle size.
For the record, the values that I tweaked were:
highp float blend = 0.03; // was 0.01 highp float innerRadius = 0.46; // was 0.47 highp float outerRadius = 0.48; // was 0.49
It was trial and error, but the goal was to get a slightly thicker border for a smaller circle to smooth out the aliasing. Reusing this elsewhere may need different values. blend + innerRadius can't exceed 0.49 or the cropped-away corners become visible.
#$%$@$!!!
I thought I had the blank circle problem fixed, but it appears I was wrong - must've done something incomplete in my testing.
Will someone Plasma-related please have a look at this and see if you can offer any suggestions? I'm at a loss. All the icon/face files change when they're supposed to, but the [CENSORED] ShaderEffect circle still goes blank until plasmashell is restarted.
Is there some way I can force a refresh of Kickoff?
I'm at a loss on this and humbly request guru assistance.
I rewrote this patch using an OpacityMask and a second rounded Rectangle to draw the ring. It's a separate diff - D13415: Reshape Kickoff avatar to a circle with Opacity Mask.
Please help me test and offer any suggestions.