You can expose actions to the user by adding items to the context menu that
is displayed when the user right-clicks the panel. Whenever these items are clicked,
Desktop Sidebar will notify your panel by executing a certain function.
Before adding an item to the context menu, you have to define a command.
First, create the <commands> element as a child of the main <plugin> element
(note: it is not inside the
The <command> element has the following attributes:
Following is an example of the structure of a plugin with the <commands> element.
After you declare all your commands, you need to put them in a menu together. First, create the <menus> element (again, inside the <plugin> element). Inside the <menus> element, create a <menu> element to represent your panel's context menu. The <menu> element has a name attribute. Same as with the command's name, this identifier should be unique, so give it the name of "PanelName.ContextMenu" (e.g. "GmailPanel.ContextMenu"). Inside the <menu> element, specify an <option> element for each of the commands you defined above. Add to the <option> element a cmd attribute, and give it the name of a command (as it was specified in the <command> element's name attribute). After all the menu items, add a <separator /> element to your menu, in order to separate your panel's own items from general Desktop Sidebar items that are automatically added to your menu. Example of the structure of the <menus> element: