mate-desktop / mate-applets

Applets for use with the MATE panel
http://www.mate-desktop.org
GNU General Public License v2.0
79 stars 67 forks source link

Command applet custom icons where and how to store #640

Closed hernot closed 1 year ago

hernot commented 1 year ago

Expected behaviour

display custom icon when shell script returns

[Command]
Icon = devlol-unknown
Output = 

Actual behaviour

Default terminal icon shown eventhough icons stored in ~/.icon/<icontheme>/48x48/

Steps to reproduce the behaviour

use attached scipt (devlolstatus-mate.sh)

MATE general version

Package version

1.24.0

Linux Distribution

Mint 20.2

Link to bugreport of your Distribution (requirement)

Seems as if i would store the icons in the wrong place, the wrong way and/or the wrong format and miss some steps to make mate/gtk aware of my extra user icons. What do i have to do, change and/or rethink to make the icons visible to command applet? Is this possible at all without building one owns icon-theme, which is what i want to avoid. All icons are in png format. Is this still supported? Is the output of the script correctly formatted? command-script.zip This contains 2 scripts the first produces the output, the second is the wrapper to hide command line arguments and remove leading trailing " forced by jq and expand newlines. If you need the icons i can provide but any icon should do. By the way are symlinks supported for icons.

muktupavels commented 1 year ago

https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout

I think you need to put icon in ~/.icons/hicolor/48x48/apps or better in ~/.local/share/icons/hicolor/48x48/apps

hernot commented 1 year ago

Do you know any tool i could use to check whether ~/.icons or ~/.local/share/icons is searched at all and where i would have to look for configuration to add addtional search pathes. Or is that a question to distribution maintainers.

muktupavels commented 1 year ago

I don't know any tool but anyone implementing icon-theme specification should search icons in all supported places.

GTK does that - https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkicontheme.c#L739-746

hernot commented 1 year ago

I do understand. On mint with mate sh points to dash instead of bash. which differes in the following echo allways interprets escapes like \n so calling the wrapped script from the wrapper for just hiding the positional arguments form command applet than output seen by command applet looks as follows

"[Command]\nIcon = devlol-unknown\nOutput ="

prepending the call by echo and enclosing in backticks results in

"[Command]
Icon = devlol-unknown
Output = "

So piping output through sed or tr for removing leading and trailing " did the final trick then.

In other words it matters here to which shell program in the end sh points to. In former installations it pointed to bash. Further more recent gtk/gnome installations seem to not just parse command output for presence of [Command] and Icon\s*=\s*<icon-name> and Output\*=<any text> but also check if each of them is on one line or has line end escaped. And if any of them is preceded by non expected characters. Or which i guess is even more plausible that

I figured by setting display width of text to 10 or more and suddenly saw raw output of command.

So for now fixed for me. Thanks for the links to the icon locations.