Open several files in THE SAME dispVM

34 views
Skip to first unread message

r.wie...@web.de

unread,
Jan 17, 2020, 11:40:55 AM1/17/20
to qubes...@googlegroups.com
Hey,

Is there a way to open a bunch of files in the same dispVM ? Yes, I can
copy/move those files and open them in the dispVM, that is what I do
right now - but it would be nice if there was a simpler way to do so.


Thank you

Steve Coleman

unread,
Jan 17, 2020, 1:11:19 PM1/17/20
to qubes...@googlegroups.com
You could write a set of scripts for that fairly easily, depending on
your personal use-case.

Option A
One possibility is to have your local script first start the DispVM
instance spawning a File Manager, then figure out the new DispVM name,
and in a loop send all the files to that DispVM instance. Then Use the
File Manager to open the documents, and when you close the file manager
the DispVM goes away. If you need to retain the documents use the file
manager to send them back first.



Option B
1) The first script adds all the files to a single tarfile and then
calls qvm-open-in-dvm for that one archive file. You can try playing
with using "Open With Other Application" from your File Manager to kick
off the script, but that might just call the script multiple times.

2) Then in the DispVM and have the default app for '*.tgz' be your
script set to extract and open the individual documents with their
respective applications.

Both the sending and receiving scripts could live in the respective
templates so that all AppVMs could send multiple files and the DispVM
could extract and deal with them according to the xdg default
applications for the document types. If you don't like assigning the
*.tgz to have a special handler you can always create the tgz file and
rename it to use a unique extension not assigned to any current application.

Mime/XDG association
https://superuser.com/questions/162092/how-can-i-register-a-custom-protocol-with-xdg



Option C
Create a temporary file system in a file and then use qvm-block to clone
the files and attach and mount that fs into the DispVM. When finished
delete/wipe the temporary file.




tetra...@danwin1210.me

unread,
Jan 17, 2020, 9:15:01 PM1/17/20
to r.wie...@web.de, qubes...@googlegroups.com
I agree, the `qvm-open-in-dvm` script should follow the same syntax as
`qvm-move` and `qvm-copy` -- it should be able to take multiple files as
an argument.

Sven Semmler

unread,
Jan 18, 2020, 11:13:04 AM1/18/20
to r.wie...@web.de, qubes...@googlegroups.com
On Fri, Jan 17, 2020 at 05:40:50PM +0100, r.wie...@web.de wrote:
1) create named disp vm via qvm-create --class DispVM --template dvm-whatever --label red app-offline
2) qvm-start app-offline
3) qvm-open-in-vm app-online file1.txt (repeat for each file you want to open there)

Once you are done you can shutdown the app-offline qube. Don't delete it, from now on you just do steps 2 and 3. It's a disposable VM so it won't hold any state across reboots. My app-offline also has no netvm (as the name indicates) ... qvm-prefs app-offline netvm ''

/Sven

--
public key: https://www.svensemmler.org/0x8F541FB6.asc
fingerprint: D7CA F2DB 658D 89BC 08D6 A7AA DA6E 167B 8F54 1FB6

signature.asc

Major Lazor

unread,
Jan 21, 2020, 5:38:12 AM1/21/20
to Steve Coleman, qubes...@googlegroups.com
Thank you for your ideas. From my understanding all your ideas that
would mean to open a Terminal and run

./script.sh a.ext b.ext c.ext d.ext

typing this is not much simpler than

1. start dispvm with nautilus
2. send files from source-vm nautilus
3. open files in destination-vm nautilus

in my opinion. This would only be useful if this could be added to
nautilus context menu. I guess this can be integrated using nautilus
actions.

However, during a brief lookup I could not yet find a way to get the
name of the disp-vm that I started. I can set a custom "BASE NAME", but
not a full name, can I?

btw: Consider answering everybody not only the list. I always missed
your answer.

Am 17.01.20 um 19:07 schrieb Steve Coleman:

Steve Coleman

unread,
Jan 21, 2020, 9:57:09 AM1/21/20
to Major Lazor, qubes...@googlegroups.com
On 2020-01-21 05:38, Major Lazor wrote:
> APL external email warning: Verify sender r.wie...@web.de before clicking links or attachments
>
> Thank you for your ideas. From my understanding all your ideas that
> would mean to open a Terminal and run
>
> ./script.sh a.ext b.ext c.ext d.ext
>
> typing this is not much simpler than
>
> 1. start dispvm with nautilus
> 2. send files from source-vm nautilus
> 3. open files in destination-vm nautilus
>
> in my opinion. This would only be useful if this could be added to
> nautilus context menu. I guess this can be integrated using nautilus
> actions.

I was curious so I explored how to do the context menu in Gnome/Files
app for kicking this off. Here is what I did:

I first wrote a bash script to test:

$ cat open_multiple
#!/bin/bash
zenity --list --column="Column name 1" $@


I copied a desktop file to my .local/share/applications/ and edited it
to look like:

[Desktop Entry]
Name=OpenMultiple
Exec=/home/user/bin/open_multiple %U
Icon=utilities-terminal
Type=Application

Then I edited my .local/share/applications/mimeapps.list and added:

[Default Applications]
x-scheme-handler/file=open_multiple.desktop

Then when right clicking on a group of files and selecting "Open With
Other Application" I selected my "OpenMultiple" entry and up pops a
zenity dialog box with the names of the files I had selected. You should
be able to do something similar with nautilus if you like.

The script you write of course will be very different than mine.



Major Lazor

unread,
Jan 21, 2020, 12:15:08 PM1/21/20
to Steve Coleman, qubes...@googlegroups.com
Interesting to see and thank you for sharing.
In the mean time I tried to find out how to get the number of the dispvm
that you have started and I still think there is no way to do so by
design. However there can be policies which VM to use in OpenInVM using
the file /etc/qubes-rpc/qubes.OpenInVM

as shown
https://www.qubes-os.org/doc/qrexec/
https://github.com/Qubes-Community/Contents/blob/master/docs/common-tasks/opening-urls-in-vms.md

however something about this does not work for me, which is why I wrote
"Configuration in /etc/qubes-rpc/qubes.OpenInVM not applied" to this
mailing list as a separate topic.


Am 21.01.20 um 15:53 schrieb Steve Coleman:
Reply all
Reply to author
Forward
0 new messages