Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions examples/.commands-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
}
]
}
]
}
6 changes: 5 additions & 1 deletion extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down