Circular user avatar for Kickoff
AbandonedPublic

Authored by ngraham on May 29 2018, 4:27 PM.

Details

Reviewers
hein
sharvey
Group Reviewers
Plasma
Summary

Apply circular ShaderEffect from SDDM to crop square user avatar into a circle with outline.

BUG: 386656

Test Plan
  • Download & apply patch
    • Recompile plasma-desktop (or at least applets)
    • Add a new Kickoff widget ("Application Launcher")
    • Restart plasmashell or logout/login

Diff Detail

Repository
R119 Plasma Desktop
Branch
round-kickoff-avatar (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
sharvey created this revision.May 29 2018, 4:27 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMay 29 2018, 4:27 PM
sharvey requested review of this revision.May 29 2018, 4:27 PM
sharvey updated this revision to Diff 35132.May 29 2018, 4:29 PM
  • Remove whitespace

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. :)

ngraham edited reviewers, added: Plasma; removed: plasma-devel.May 29 2018, 4:39 PM
Restricted Application added a subscriber: plasma-devel. · View Herald TranscriptMay 29 2018, 4:39 PM

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. :)

Me too. +1

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 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?

If it is for a border, I would go with a semitransparent border using dark grey.

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

sharvey updated this revision to Diff 35138.May 29 2018, 6:11 PM
  • Add theme-colored ring around avatar

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.

sharvey edited the summary of this revision. (Show Details)May 29 2018, 6:20 PM
sharvey edited the test plan for this revision. (Show Details)
sharvey updated this revision to Diff 35139.May 29 2018, 6:23 PM
  • Whitespace (again...)

Cool! But in your latest screenshot, the circle is aliased pretty badly....

Cool! But in your latest screenshot, the circle is aliased pretty badly....

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.

sharvey added a comment.EditedMay 29 2018, 8:55 PM

AA option not set

AA option set

Does the second option look dramatically better or different? (They don't to me...)

AA option not set

AA option set

Does the second option look dramatically better or different?

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.

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...

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...

Thanks Scott, your work is very much appreciated!

davidedmundson added inline comments.May 29 2018, 9:28 PM
applets/kickoff/package/contents/ui/Header.qml
75

needed?

81

because this is false, we need to force an update every time squareFace changes

92

and when the theme changes

100

decreasing the border width but increasing this might make it more rounded

sharvey updated this revision to Diff 35150.May 29 2018, 11:12 PM
  • Remove redundant OpacityMask; tweaked antialiasing
sharvey marked 4 inline comments as done.May 29 2018, 11:15 PM
sharvey added inline comments.
applets/kickoff/package/contents/ui/Header.qml
75

Not anymore. I thought your ShaderEffect just drew circles. I didn't catch on that it rounded off an image and then added a border. This probably helped the antialiasing.

100

A bit of trial and a bit of error... and I think we have a good result.

sharvey edited the summary of this revision. (Show Details)May 29 2018, 11:16 PM
sharvey marked 2 inline comments as done.


Best yet, I think.

sharvey marked 2 inline comments as done.May 29 2018, 11:18 PM
sharvey updated this revision to Diff 35151.May 29 2018, 11:20 PM
  • Whitespace once more
ngraham requested changes to this revision.May 30 2018, 3:24 AM

Looks great now! Quite pleasing to the eye.

I've got a few blockers though:

  • When I change the icon in the user-manager KCM and re-open Kickoff, the new icon isn't displayed; instead I just see a blank circle with no image in it until I quit and restart plasmashell.
  • See the below comment:
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...

This revision now requires changes to proceed.May 30 2018, 3:24 AM

Looks great now! Quite pleasing to the eye.

I've got a few blockers though:

  • When I change the icon in the user-manager KCM and re-open Kickoff, the new icon isn't displayed; instead I just see a blank circle with no image in it until I quit and restart plasmashell.

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.


It appears Kickoff had this problem prior to the circles. I changed my avatar, but un-patched Kickoff now shows the default avatar.

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.

sharvey marked 2 inline comments as done.May 30 2018, 5:31 PM

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?

sharvey updated this revision to Diff 35647.Jun 5 2018, 8:10 PM
  • Force icon to be visible, avoiding blank circle

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.

sharvey updated this revision to Diff 35648.Jun 5 2018, 8:14 PM
  • Reset QtQuick version to 2.4
apol added a subscriber: apol.Jun 5 2018, 10:08 PM
apol added inline comments.
applets/kickoff/package/contents/ui/Header.qml
104

I tried using fragment shader in discover and it ported poorly on different hardware. Maybe OpacityMask or Rectangle + clip works too.

139

No need to set it to true, just drop the line.

sharvey added inline comments.Jun 6 2018, 12:34 AM
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?

mart added a subscriber: mart.Jun 7 2018, 10:18 AM

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. :)

yeah, shouldn't be configurable

mart added a comment.Jun 7 2018, 10:20 AM

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

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.
It's a lot closer to the GSL you'd get on the different hardware.

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.

sharvey updated this revision to Diff 35770.Jun 7 2018, 1:43 PM
  • Remove explicit visible: true, as default == true
sharvey marked 5 inline comments as done.Jun 7 2018, 1:45 PM

@ngraham - This now appears to function properly with no blank circles. Will you please confirm?

If Nate is happy, will someone from Plasma please approve so I can land it and get it filed under "finished"?

Thanks.

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.

ngraham commandeered this revision.Nov 21 2019, 8:42 PM
ngraham abandoned this revision.
ngraham edited reviewers, added: sharvey; removed: ngraham.

Let's continue in D13415.