Add QEMU KVM Guest OS Shortcut to Dock, Desktop and Menu

If you're using KVM as your virtual manager, you can add shortcuts directly to your guest VM's instead of having to open Virtual manger to access them.

This will also add your individual guest os/Vm's as menu items in applications and the menu.

Here's how:

#1. Create a folder somewhere in your home directory. (I created a new folder called 'scripts' in my Documents folder.)

#2. Go online and find a nice .png file to be your VM's icon file and save it to that new folder.

#3 Get the exact name of your guest VM. (What you named it when you installed it.) In this example, I'll be making a shortcut for my Kali VM.

#4. Go inside your new folder and right click 'Open in terminal' and enter sudo nano to open an editor.

#5. Copy and Paste

#!/bin/bash
virt-manager --connect qemu:///system --show-domain-console Kali $1

IMPORTANT: replace the word 'Kali' with the exact name of your guest VM. Capitalization matters here.

Save your file as a .sh . (I named mine kali-vm.sh ) In nano hit ctrl+oto name it, then ctrl+x to exit the editor.

Now, in terminal, we need to give that new file permission to run. Enter sudo chmod +x filename.sh . Eg: sudo chmod +x kali-vm.sh

#6. While you're still in terminal enter sudo nano to bring up the editor again. Now copy and paste

[Desktop Entry]
Version=1.0
Type=Application
Name=Kali
Comment=Start Kali VM
Exec=/home/YourUserName/Documents/scripts/kali-vm.sh
Icon=/home/YourUserName/Documents/scripts/kali.png
Terminal=false

On the Name line replace 'Kali' with your VM name. Replace the Exec and Icon lines with the path of your new folder and replace the .png and .sh file names too.

Hit ctrl+o to save this file as a .desktop file, only we are going to save it to this new location:

/usr/share/applications/

Eg: I saved my file as /usr/share/applications/kali.desktop

#7. Now all we need to do is add it to your desktop or to the dock. Just search for it in the applications menu and right click. Either add it to favorites (to add to your dock) or add to your desktop.

Sometimes you need to log out before the new entry will show up.

So there you have it, folks. VM shortcuts on your menu, dock and desktop. Enjoy!

1 Like