albertlauncher / albert

A fast and flexible keyboard launcher
https://albertlauncher.github.io
Other
7.19k stars 304 forks source link

question: Is the Albert SVG icon in fact compatible with QT5 specs? #1031

Closed dreamcat4 closed 1 year ago

dreamcat4 commented 3 years ago

Description

We have been having issues again with SVG icon displayed in system tray on Ubuntu budgie. However i already found in other issue (sorry lost the link)... that sometimes editing the dimensions hard coded into SVG file can fix the issue.

So that got me wondering if the type of SVG instructions is important. And has to be written in a specific way(s).... well it turns out maybe it does? According to QT here

https://doc.qt.io/qt-5/svgrendering.html

Only a subset of SVG syntax is compatible. And we know albert uses QT libs, and QIcon. QSystemTray and QImage etc. And opens from SVG.

Then under the hood, it's probably these QT5 libs converting the SVG into a bitmap graphic. To then pass on in X windows to the DE. Which is itself a mess of junk.

Anyhow we are suspicious that Ubuntu Budgie specifically does not resize bitmap image in all cases. Such as this case, if the QT5 then supplied a larger image size (which it does, about 100px, which is whats inside the SVG xml data, exact).

So I think this not matter for other DEs who resize the image in this situation regardless of the size is supplied by QT. However I just wanted to raise the explanation here. Because I knows you still use same exact SVG image since 2 years ago. And it (*maybe) does not strictly meed the QT specs.

Again this is more of an informational type thing here. To let you know about this matter. In case you were not aware. However I am also glad you can use SVG at all! Since anything else (not QT5) cannot. So that is a good thing. For Hi DPI retina 4k displays, resizing and not loose quality etc.

Many thanks for understanding. Sorry I could not find the link again. It was just comments playing with SVG tags mostly.

BTW also noticed in recent versions of Albert you have added 'restart albert' menu feature / action. And that works really excellent. (for the memory leak thing, its nice to restart to free RAM again). So thank you for that also just to say thanks for adding it. Good day.

Oh BTW #2 I know you have the official Icon is square and blue. However I do believe the Surfn EvoPop icon (grey + yellow, rounder) is better. Perhaps you can ask the icon designer for permission to use as the official Icon in future? That is if you think it's nice for the icon to be updated and better. It's a matter of taste / personal preference really. Not so important just thought to mention it. Is that sort of permission(s) possible @erikdubois?

https://github.com/erikdubois/Surfn/blob/master/surfn-icons/Surfn/scalable/apps/scalable/albert.svg

Of course perhaps not QT specs compliant either! Neither one, but not to worry too much hehe

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

ManuelSchneid3r commented 2 years ago

Have you tried to modify the shipped svg? I cant reproduce?

What is the Qt spec?

dreamcat4 commented 2 years ago

@ManuelSchneid3r sorry it was a wihle ago and I have now switch my DE from Budgie over to KDE Plasma.

Yes there was some type of icon scaling bug in Budgie's code that @FOSSFreedom eventually found and fixed, which may (or may not) also resolve this issue (for budgie users).

https://github.com/UbuntuBudgie/budgie-indicator-applet/issues/18#issuecomment-859952024

Have you tried to modify the shipped svg? I cant reproduce?

If i remember correctly, it was not possible for me to modify your original SVG icon because it's structure / composition of elements was written in such a specific way. That it was difficult to modify in a text editor (to get the desired scaling result).

So I instead had to use other alternative SVG icon (taken from other 3rd party theme). That was not with the original SVG, but still it was a good looking alternative looking SVG for albert. That still had the albert a graphic. Just different stylization.

What is the Qt spec?

It is documented lets see now... didn't I already link it in comment #1 near the top of this issue? This page in the QT docs is not sufficient / good enough?

https://doc.qt.io/qt-5/svgrendering.html

Ah! ... it is what the say on that page, this sentence:

Qt supports the static features of SVG 1.2 Tiny. ECMA scripts and DOM manipulation are currently not supported.

That requires further work to figure out which exact set of xml tag(s) are supported within the SVG.

It would be a lot more convenient to just have an export option in some drawing software. For example if you can to Save As... and then select different SVG versions to export from a tool like Inkscape or whatever you are using for saving these icons. Or some cmdline tool to 'convert' or 'lint' or error check / sanitize SVG file. Sorry I do not know what to suggest for any of that.

But it would probably be easier than having to read SVG specs :)

ManuelSchneid3r commented 1 year ago

Well… https://validator.w3.org/check?uri=https%3A%2F%2Fraw.githubusercontent.com%2Falbertlauncher%2Falbert%2Fmaster%2Fresources%2Ficons%2Falbert.svg&charset=%28detect+automatically%29&doctype=SVG+1.1+Tiny&group=0&user-agent=W3C_Validator%2F1.3+http%3A%2F%2Fvalidator.w3.org%2Fservices

ManuelSchneid3r commented 1 year ago

Now it is. Looks ugly, but I am not a desginer and this issue took me ages. https://github.com/albertlauncher/albert/commit/f8c421bea1ca682217046ce7af39b61b3e2d396e