How to start the terminal with a program running on QubesOS?

I am using jrnl.sh for journaling on the command line. I have set up a “journaling” qube for this. And I would like to get a keybinding going for easy starting this.

On XFCE4 (which is the default desktop environment for Qubes 4.1) I have System Tools > Keyboard > Application Shortcuts, in which I can define keybinds for qubes. For example, for starting the uxterm in “journaling” qube I can define the following command:
qvm-run -q -a --service -- journaling qubes.StartApp+debian-uxterm to be binded to Super+Enter, for example. However, this only brings up a uxterm window running within the qube “journaling”.

How would I make this bring me a uxterm window with jrnl command executed? Basically, I would like to have uxterm -e jrnl binded to a keybind, but I don’t know how to define this in Application Shortcuts. I have tried, qvm-run -q -a --service -- journaling qubes.StartApp+debian-uxterm -e jrnl but it didn’t work.

Any ideas about how to do this?

something like:
qvm-run -p AppVM 'xterm -e /usr/bin/jrnl'

So, no qvm-run -q -a --service stuff at all?

I don’t know hot-to use the --service stuff at all.
I always run qvm-run and it solve all my tasks.

Yeah, okay, but I don’t want to --pass-io just for this (-p option seems to do this).

There should be another way to do this.

Run it without the -p or --pass-io option.

qvm-run VMNAME 'xterm -e COMMAND'

I also tested gnome-terminal and xfce4-terminal and both work.

However if COMMAND doesn’t exist, the terminal window will close right away.

1 Like

Yeah that works. However, I was also hoping to learn about the esoteric qubes.StartApp+debian-uxterm stuff. How do I use those? Why they are defined as they are by default by the QubesOS?

I think a better question is: How can I pass an argument to the program that is started with qubes.StartApp ?

For example, qvm-run -q -a --service -- journaling qubes.StartApp+debian-uxterm starts uxterm in qube “journaling.” Now, how do I pass an argument to the debian-uxterm.desktop program that I am starting with qubes.StartApp ? In effect, I want uxterm to be executed as, uxterm -e jrnl.

Create a desktop file in the place (qube) where you need it, which will contain xterm with whatever, and name it journaling.desktop.

Then from dom0 run

$ qvm-run -q -a --service qubes.StartApp+journaling

You can do this for jrnl.sh as well.

3 Likes

Thanks @enmus, your suggestion is what I was seeking for.

I have created the following directory in my journaling qube: /home/user/.local/share/applications

And I have created the following .desktop file: /home/user/.local/share/applications/jrnl.desktop

[Desktop Entry]
Type=Application
Name=jrnl
GenericName=Terminal Journaling
Exec=uxterm -e jrnl

Then I have refreshed the app shortcuts from the Qube Manager, and have added the “jrnl” applications to the “Selected Applications” column.

Now I have the qvm-run -q -a --service -- journaling qubes.StartApp+jrnl application direct for starting in the XFCE4 Application Finder. I have also put a keyboard shortcut “Super+d” for the XFCE4 Application Finder so I am mimicking the dmenu behavior with it.

Good solution for on-the-fly journaling/jotting your thoughts down on a secure qube and then being done with it.

2 Likes