Skip to content

Instantly share code, notes, and snippets.

@raidzero
Created March 3, 2014 00:29
Show Gist options
  • Save raidzero/9316314 to your computer and use it in GitHub Desktop.
Save raidzero/9316314 to your computer and use it in GitHub Desktop.
Openbox pipe menu: launch Virtualbox VM's
#!/usr/bin/python
import os
"""Pipe Menu to launch VirtualBox Machines"""
# build the list of VM's
VM_LIST = os.listdir("/home/raidzero/.VirtualBox/Machines")
print """<openbox_pipe_menu>
<separator label="Virtual Machines">
</separator>"""
for VM in VM_LIST:
print "<item label=\"%s\">" % VM
print "\t<action name=\"Execute\">"
print "\t\t<execute>"
print "\t\t\tVBoxManage startvm \"%s\"" % VM
print "\t\t</execute>"
print "\t</action>"
print "</item>"
print "<separator>"
print "</separator>"
print "\t<item label=\"Launch VirtualBox\">"
print "\t\t<action name=\"Execute\">"
print "\t\t\t<execute>"
print "\t\t\t\tVirtualBox"
print "\t\t\t</execute>"
print "\t\t</action>"
print "\t</item>"
print "</openbox_pipe_menu>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment