28

Is there a utility I can use to add an icon to the Cinnamon menu which runs a user-specified command, and as a bonus, displays a user-specified icon?

specifically I'm trying to add a command to open a virtual machine directly, without having to keep the terminal open.

VirtualBox --startvm <myMachineName> --seamless

works fine with alt-F2, but I'd rather have a short-cut so I don't have to type it out.

4 Answers 4

53

or you could just use the

cinnamon-menu-editor

(Also available by right clicking the start button, selecting configure and Open the menu editor.)


Tip: When adding a custom icon, be careful to locate the icon image somewhere you won't be likely to change in the future.

1
  • Make sure you put the entry IN A MENU (e.g. Programming). If you put it in the root, it won't work. Apr 14, 2023 at 18:36
26

You can create a .desktop file to add your command to the Cinnamon menu.

First, create a little script eg: In your home directory

  • Open your terminal and type:

    gedit /home/user/myvm.sh
    
  • Type the following:

enter image description here

  • Save the file in your home directory and change the permissions with:

    chmod 775 /home/user/myvm.sh
    
  • Then you can create a desktop file, in the terminal type:

    cd /usr/share/applications
    sudo -H gedit myvm.desktop
    
  • Add the following information:

enter image description here

  • Save the changes and make sure the .desktop has the right permissions, in the terminal type:

    sudo chmod 644 /usr/share/applications/myvm.desktop
    

You can change the information according to your needs, in this case in the field "Icon" put your path to your custom icon, and this should be visible under the Cinnamon menu in the category "System Tools" with the name "My VM".

enter image description here

If you want, you can add it to your cinnamon panel with right click in the icon "My VM" in the Menu, and then choose "add to panel"

enter image description here

3
  • 2
    beautiful instructions, the screenshots were not needed but very appreciated :)
    – ataulm
    Dec 23, 2012 at 16:36
  • 7
    As mentioned by childno͡.de's answer, using ~/.local/share/applications won't need root privileges if you don't need to add shortcuts for all users.
    – jamesdlin
    Jun 15, 2018 at 17:33
  • Though I was aware of the entire process (I always use the ~/.local/share/applications pointed out by James), for one app it didn't seem to work. The important step there was the chmod: the .desktop file in my case had 744 and didn't show up in the menu until I changed it to 644 as you described. That did the trick! Funnily, 755 works fine as well, seems it just does not like 744
    – Izzy
    Apr 24, 2020 at 6:55
4

Simply create a gnome desktop link and place it in .local/share/applications/ for personal menu links.

Sigh: some installers install their desktop links into .gnome/apps/ so you might want to link them: $ ln -s .gnome/apps/*.desktop .local/share/applications/


As pointed out by @roman-raguet https://askubuntu.com/a/232083/37280 place it into /usr/share/applications for all users

As pointed out by @mockfrog https://askubuntu.com/a/800605/37280 you might create this personal entry by cinnamon-menu-editor graphical tool. Run it with sudo for all-users

1

For anyone else looking for a simpler solution, then the following offers a GUI interface for adding custom launchers to your panel:

cd /usr/share/cinnamon/applets/[email protected]/
./cinnamon-add-panel-launcher.py
3
  • This is different, I think. This will add shortcuts to your panel, but not to the menu, right?
    – ataulm
    Mar 26, 2015 at 14:49
  • 2
    No longer works in current version of Cinnamon.
    – K7AAY
    Jan 14, 2016 at 4:58
  • 1
    Directory exists, but "cinnamon-add-panel-launcher.py" does not exist in Debian Jessie 8.6 / Cinnamon 2.2.16. Nov 19, 2016 at 22:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .