[sddm-theme] Style the session and keyboard layout selectors to be more Breeze
ClosedPublic

Authored by cblack on Jun 13 2019, 11:36 PM.

Details

Summary

The session selector's and keyboard layout's menus are now styled to resemble the Breeze theme rather than the default QML style.

BUG: 408702

Test Plan

Ensure the styling looks good regardless of various conditions. (resolution, dpi, distro, amount of sessions, etc.)

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.
cblack created this revision.Jun 13 2019, 11:36 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJun 13 2019, 11:36 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
cblack requested review of this revision.Jun 13 2019, 11:36 PM
apol added a subscriber: apol.Jun 14 2019, 12:03 AM

It would be useful if you provide a screenshot of the result so people can assess the change properly.

sddm-theme/SessionButton.qml
47

You're hard-coding colors, this will break as soon as the style is changed.

Awesome, the look of that menu has been a thorn in my side! Code needs some modifications, but it looks great.

Can you also apply this patch to KeyboardButton.qml as we've got another QQC menu there?

sddm-theme/SessionButton.qml
47

No need to hardcode here, instead set:

color: PlasmaCore.ColorScope.backgroundColor

52

Same, you can set:

color: styleData.selected ? PlasmaCore.ColorScope.highlightedTextColor : PlasmaCore.ColorScope.textColor

54

For this label we should also add:

font.pointSize: config.fontSize

This will make sure the size of the labels is the same as the one used for the button label.

57

PlasmaCore.ColorScope.highlightColor

58

Just remove this, you would be trying to mimic the PlasmaComponents.Highlight with it, but that's not what we use in menus in the desktop.

filipf added inline comments.Jun 14 2019, 12:08 AM
sddm-theme/SessionButton.qml
50

Also, do we need this?

cblack updated this revision to Diff 59803.Jun 14 2019, 4:47 PM

Less harcoding & style keyboard button as well

As requested by @apol, here is a screenshot of the menu with the new styling (I'm using a custom colorscheme currently, which is why the menu appears black in this screenshot).

sddm-theme/SessionButton.qml
50

The extra padding makes it resemble the Breeze menus found in normal applications a bit more. (Also larger space to click on)

Thanks for the new version, almost there.

sddm-theme/KeyboardButton.qml
24

One more thing that I realized is missing here and that would make everything look like the desktop menus is a 1px border.

Now the stolen code should sort of look like this:

property color borderColor: PlasmaCore.ColorScope.textColor
border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3)
border.width: 1

Unfortunately for some reason rgba fails when using dark themes and the border just turns white. Maybe you could figure out something better, but if you get stuck it's not super important.

38

We still need to remove this bit of hardcoding:

color: PlasmaCore.ColorScope.highlightColor

and in the other file as well, of course.

cblack updated this revision to Diff 59806.Jun 14 2019, 5:34 PM

Menu border, less hardcoding, and moving the menu style into a seperate file to reduce duplicated code.

Final comments and then it's a ship it from me!

sddm-theme/BreezeMenuStyle.qml
13

It's still not working right with dark themes:

What do you say we steal the code for kirigami's separator color?

  • first we remove the property color ... line above, and then do:

border.color: Qt.tint(PlasmaCore.ColorScope.textColor, Qt.rgba(color.r, color.g, color.b, 0.7))

looks good now IMO:

19

there's whitespace here

22

whitespace here as well

cblack updated this revision to Diff 59808.Jun 14 2019, 5:52 PM

Tweak border coloration (steal it from Kirigami) and remove whitespace

filipf accepted this revision.Jun 14 2019, 5:58 PM

Thanks again :)

Do you have commit access?

sddm-theme/BreezeMenuStyle.qml
12

This can be removed now

This revision is now accepted and ready to land.Jun 14 2019, 5:58 PM
ngraham added inline comments.
sddm-theme/BreezeMenuStyle.qml
7

Why does this have to be QQC1?

cblack updated this revision to Diff 59809.Jun 14 2019, 6:00 PM
cblack removed a subscriber: ngraham.

Remove unneeded property.

@filipf Don't know but the answer is probably a no.

sddm-theme/BreezeMenuStyle.qml
7
  1. Styles are a QQC1 thing (QQC2 components can't take them)
  2. The PlasmaComponents.ToolButton's menu property won't accept a QQC2 menu (tried it).
filipf added inline comments.Jun 14 2019, 6:04 PM
sddm-theme/BreezeMenuStyle.qml
7

AFAIK we can't style QQC2 Menus :/

There's also another non-style error that pops up.

I would suggest to consider import porting for some future date.

filipf retitled this revision from Style the session selector to be more Breeze to [sddm-theme] Style the session and keyboard layout selectors to be more Breeze.Jun 14 2019, 6:38 PM
filipf edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.

@cblack great patch, keep it up!

I pushed it to the 5.16 branch so we should already see this improvement in 5.16.1.

filipf edited the test plan for this revision. (Show Details)Jun 14 2019, 7:10 PM