diff --git a/examples/.commands-full.json b/examples/.commands-full.json index 12b159d..2a5f5a8 100644 --- a/examples/.commands-full.json +++ b/examples/.commands-full.json @@ -34,6 +34,17 @@ "icon": "utilities-terminal" } ] + }, + { + "title": "SSH Connections (With Icon)", + "type": "submenu", + "icon": "utilities-terminal", + "submenu": [ + { + "title": "Connect to Server (SSH)", + "command": "gnome-terminal -- bash -c 'ssh root@10.144.1.2 -p 8022'" + } + ] } ] } \ No newline at end of file diff --git a/extension.js b/extension.js index ff0e705..1af98b9 100644 --- a/extension.js +++ b/extension.js @@ -53,7 +53,11 @@ function populateMenuItems(menu, cmds, level) { if (cmd.type === 'submenu' && level === 0) { // Stop submenu from being added after the first level let submenu; if (!cmd.submenu) { return; } - submenu = new PopupMenu.PopupSubMenuMenuItem(cmd.title); + const wantIcon = Boolean(cmd.icon) + submenu = new PopupMenu.PopupSubMenuMenuItem(cmd.title, wantIcon); + if (wantIcon) { + submenu.icon.icon_name = cmd.icon + } populateMenuItems(submenu.menu, cmd.submenu, level + 1); menu.addMenuItem(submenu); return;