Launch an App via a Menu for a Running Disposable

Is it possible to add other applications to those already shown in the menu accessed via “Qubes Domains” in the notifications area?

Ideally, I would like to add entries for specific DVM Templates so they show up for any related running disposable.

In fact, I guess the real question is “Why doesn’t this menu automatically show the applications that have been selected in the relevant qube’s Applications tab?”

Alternatively, is there a way to get already running disposables to show in the Start Menu?

I know there are a couple of ways of typing a command to start any app for a running disposable but I was looking for a way to use a menu as is possible for non-disposables or launching a new disposable.

So I picked up some ideas from this post: Run commands and copy files in --dispvm from dom0 - #7 by rustybird

And have created a script (my-dvm-launcher.sh) that creates a “random” named disposable based on a template passed as the first parameter and runs the application passed as the second parameter.

It then runs a second script (my-dvm-repeater.sh) that repeatedly checks all running disposable dvms to see if they have running applications - if they don’t, it then shuts down the dvm - this seemed necessary as the named disposables don’t automatically shutdown when the last application window is closed like the qubes random disposables do. The auto_cleanup property then ensures the vm is automatically deleted.

I use launcher shortcuts that run the first script with different parameters for the different disposables and apps I use and the created vms appear in the applications start menu giving me access to the full list of applications selected in the corresponding template so I can launch any subsequent application in the same disp vm from the menu.

my-dvm-launcher.sh

TEMPLATE=$1
APP=$2
LABEL=$(qvm-prefs $TEMPLATE label)
NAME=MyDVM$RANDOM
qvm-create $NAME --class DispVM --template $TEMPLATE --label $LABEL --prop=auto_cleanup=True
qvm-run --service $NAME qubes.StartApp+$APP
if [[ -z $(ps -e -f | grep /bin/sh | grep my-dvm-repeater) ]]
then
nohup ./my-dvm-repeater.sh &
disown
fi

my-dvm-repeater.sh

while sleep 5
do
MyDVMS=$(qvm-ls --running --raw-list | grep MyDVM)
if [[ -z $MyDVMS ]]
then
break
fi
for MyDVM in $MyDVMS
do
if [[ $(qvm-run --pass-io $MyDVM – ps -e -F | grep -e StartApp -e gapplication -c) = 0 ]]; then
qvm-shutdown $MyDVM
fi
done
done