Zren / plasma-applet-githubissues

https://store.kde.org/p/1271237/
25 stars 5 forks source link

Plasmoid icon from Plasma Theme #7

Closed varlesh closed 5 years ago

varlesh commented 5 years ago

Will be good added support use tray icon from plasma theme and original icon as fallback. Now this hardcoded:

    Plasmoid.icon: plasmoid.file("", "icons/octicon-mark-github.svg")
varlesh commented 5 years ago

Also CSS style not supported too (( ColorScheme-Text must be used text from plasma color scheme. But this ignored on widget icon and used original color #4d4d4d

varlesh commented 5 years ago

image

Zren commented 5 years ago

Ah, this means I need to define the Plasmoid.compactRepresentation using my AppletIcon workaround. It still hardcodes the svg path, but it'll use the correct color scheme.

I use ColorScheme-Text, but I forgot the default compactRepresentation uses PlasmaCore.IconItem which doesn't apply the color scheme to svg's loaded from an absolute filepath (which is what plasmoid.file(...) returns). It only applies it to "icon names" without the file extension + path that are loaded from your icon theme.

Hmmmm...

This looks interesting though... it seems it might be able to load it from the "images" folder.

I tried renaming my contents/icons/ folder to contents/images/. While the following code works, it still doesn't load follow the color scheme, as it's still returning an absolute filepath.

Plasmoid.icon: plasmoid.file("images", "octicon-mark-github.svg")

And neither of these loads the svg, which means I don't fully understand how iconitem.cpp works.

Plasmoid.icon: "octicon-mark-github"
Plasmoid.icon: "octicon-mark-github.svg"

I'd need to recompile plasma-framework with a ton of qDebug() << "test"; to find out how that string is treated...

varlesh commented 5 years ago

@Zren if you interested, i'm draw Breeze style icons (dark and light)... Another way - you can add option switch icon for light/dark color scheme. preview: image sources SVG: icons.tar.gz

Zren commented 5 years ago

Ah sorry, it seems I forgot to push the commit that uses my AppletIcon.qml that loads the icon using PlasmaCore.SvgItem instead of using PlasmaCore.IconItem.

https://github.com/Zren/plasma-applet-githubissues/commit/35d2217a7cdf98cc08269888f041cb37265eedc3

Seems I also have a little bit of uncommitted code that fixed the multi-repo TextField. Might clean that up and release the multi-repo refactor today as it's worked great for the past month.

varlesh commented 5 years ago

@Zren Yes, now colorscheme worked... but need fix icon size: image I'm update svg: octicon-mark-github.tar.gz image

Zren commented 5 years ago

Ah good point, normal svg icons usually have a 2px padding in their paths and mine was going right to the edge. Thanks for the updated path!

2019-03-20___12-16-40

Zren commented 5 years ago

Icon fixed in the v3 release.