3

I'm new to cinnamon and I'm disappointed that some of the system applets cannot have their icons modified easily. After seeing that, I did a find from my root directory for "show-desktop" and found a /usr/share/cinnamon/applets/show-desktop@cinnamon.org directory. In the directory are two files: applet.js and metadata.json.

metadata.json:

{
 "uuid": "show-desktop@cinnamon.org",
 "name": "Show desktop",
 "description": "Minimize all windows",
 "icon": "menu",
 "max-instances": -1
}

"menu" isn't very descriptive so I picked another system applet (trash) and looked at it's icon name "user-trash" and changed 'menu' to 'user-trash'

{
 "uuid": "show-desktop@cinnamon.org",
 "name": "Show desktop",
 "description": "Minimize all windows",
 "icon": "user-trash",
 "max-instances": -1
}

This didn't have any effect so I looked into the applet.js.

    this.set_applet_icon_name("user-desktop");
    this.set_applet_tooltip(_("Show desktop"));

These are the important lines, once again I looked at the trash applet and changed this one to "user-trash". I found the icons in /usr/share/icons/Adwaitia/32x32/places/ folder.

This leaves me with three questions...

  1. How does the applet know to look in this directory for the icons? Is there a config stored somewhere, or is there another .js file that describes the icons and their locations.

  2. Why did modifying the .json files have no effect on the icon being used, even after reloading cinnamon?

  3. How can I provide a filepath to my own icon to work in place of the system icons without dropping my icon in that directory?

Brian Sizemore
  • 249
  • 4
  • 17

1 Answers1

0

To set the icon to the custom icon you need to drop the icon in the path and then use the set_applet_icon_path() method to change the try icon to the custom icon. You also have to make sure that you remove or comment out the Symbolic name method.

// Assuming you have something similar to this for the applet_path:
const UUID = "app@id";
const APPLET_PATH = imports.ui.appletManager.appletMeta[UUID].path;

// in the MyApplet.prototype _init function.

// Remove or comment out this line:
//this.set_applet_icon_symbolic_name("icon-name");

// Add this in the MyApplet.prototype _init function.
this.set_applet_icon_path(APPLET_PATH + "/icon.png")
Jake1164
  • 12,291
  • 6
  • 47
  • 64