Is there a way to determine qube color from within a VM?

I was working on a shell script that I would place in my VM templates, where there is different logic inside the script depending on the color of the VM. I was wondering if there is a way to determine the VM color from inside the VM, or if this is something I will have to define myself in each App Qube.

1 Like

The window decorations are set in dom0, not in the qubes. The qube is
not aware of this, AFAIK.

I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.

3 Likes

You could create a dom0 qrexec service in /etc/qubes-rpc/ that prints the caller’s color:

#!/bin/sh
exec qvm-prefs -- "$QREXEC_REMOTE_DOMAIN" label </dev/null 2>/dev/null
3 Likes

I appreciate the help. I managed to create something similar using qrexec that, although a little slow, works perfectly for my use case.

1 Like

Is this setting the terminal color based on the qube color? If so, awesome idea. I suggest writing to qubesdb and then reading via qubesdb-read in the qube which is practically instant.

1 Like