Straightforward way to launch a new dispvm with usb device attached

It noticed that with the last update the qubes device manager has been reworked. It now can attach a device to a new disposable qube. From my point of view this is a very useful function and I would like to implement it to my qubes-dmenu setup.

Has anybody an idea how to do this in a straightforward way with bash scripts? I find my current implementation a bit clunky,

I essentially looks like this. What I rather don’t like is vm creation part.

# create disp vm
# in principle this randomly generated number could of cause already exit, so checking for it is also required. But I skip that part here 
vm=disp$((1000 + RANDOM % 9999))
qvm-create -q -t default-dvm -l red -C DispVM --prop=auto_cleanup=true --prop=[...] $vm || exit 1
# make vm internal, not strictly required 
qvm-features -q $vm internal 1

# start vm and wait, attach device
qvm-start -q $vm
qvm-usb attach $vm $device