RFC: [Notifications] Better notification number alignment
ClosedPublic

Authored by broulik on May 25 2019, 3:44 PM.

Details

Summary

This tries to use fontSizeMode but in conjunction with QtRendering to achieve better number alignment.
Since this is more "part of an icon" than "proper text" using QtRendering is acceptable.

Test Plan

Looks fine here but please everyone test since depending on font, size, whatever the results vary wildly.

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.May 25 2019, 3:44 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMay 25 2019, 3:44 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.May 25 2019, 3:44 PM

Still looks awful at times :(

ndavis added a subscriber: ndavis.Sat, May 25, 8:31 PM

Here is a video showing unread notification numbers up to 21 with this patch. The font settings that affect the unread notification number (general) are at the default settings.

Still looks awful at times :(

When there are 2 or digits, maybe the circle can expand to become pill-shaped so it can accommodate the increased width? Or maybe the font size should decrease?

When there are 2 or digits, maybe the circle can expand to become pill-shaped

The circle comes from Plasma theme, cannot transform it.

ndavis added a comment.EditedSun, May 26, 2:13 PM

The patch makes the position of the numbers more consistent, but it's still slightly to the left of center.

davidedmundson added inline comments.
applets/notifications/package/contents/ui/CompactRepresentation.qml
120

This doesn't match your description

broulik added inline comments.Mon, May 27, 8:34 AM
applets/notifications/package/contents/ui/CompactRepresentation.qml
120

Ha, no wonder nothing changed.

broulik updated this revision to Diff 58711.Mon, May 27, 8:36 AM
  • Use QtRendering as I originally intended

Does this make it any better?

ndavis added a comment.EditedMon, May 27, 12:16 PM
  • Use QtRendering as I originally intended

    Does this make it any better?

The numbers seem to be slightly smaller and fit in the circle slightly better, but they're still off to the left a bit, just as much as in the video I posted above.

For example, here are the numbers 1, 3, 10, and 21.

slightly left

slightly left

as good as possible

slightly left

cfeck added a subscriber: cfeck.Mon, May 27, 11:47 PM

Just an idea: run "kcharselect", type "circled digit" resp. "circled number". For values <= 20, unicode has pre-rendered glyphs.

Just an idea: run "kcharselect", type "circled digit" resp. "circled number". For values <= 20, unicode has pre-rendered glyphs.

Unfortunately, there is a jump in size from 10 to 11:

Also, the circle comes from the Plasma theme.

Could we increase the size of the circle in the Plasma theme to make any slight mis-alignment less noticeable?

ndavis added a comment.EditedWed, May 29, 11:05 PM

Could we increase the size of the circle in the Plasma theme to make any slight mis-alignment less noticeable?

It might look out of place next to all the other icons which are always 16px high at most (on a 22px canvas). However, I think the misalignment might be less obvious if we filled in the circle and used the Background color for the numbers.

Eh, changing the background to solid didn't help (I did include the changes from this patch) and it looks somewhat out of place next to the other icons.

lavender added a subscriber: lavender.EditedWed, May 29, 11:57 PM

When there are 2 or digits, maybe the circle can expand to become pill-shaped

The circle comes from Plasma theme, cannot transform it.

That might be the best looking solution though: allowing the theme to transform it based on a certain property (in this case number of digits and width)

Should we go with this now to improve the situation a little bit at least?

ngraham accepted this revision.Sun, Jun 2, 5:21 PM

Since it doesn't regress anything, then I say yeah.

This revision is now accepted and ready to land.Sun, Jun 2, 5:21 PM
This revision was automatically updated to reflect the committed changes.