Efficient way to display domU output in dom0 panel?

30 views
Skip to first unread message

qubist

unread,
May 13, 2025, 10:56:49 AMMay 13
to qubes...@googlegroups.com
Hi,

What would be an efficient and correct way to display info from a domU
on dom0's XFCE panel?

I have tried using a generic monitor widget polling a script in the
domU but it seems too laggy (qvm-run introduces about 200-300ms delay).
Additionally, synchronizing the reading of script output and its
writing is somewhat challenging in such a setup.

I see that sys-net displays its own network manager applet in dom0's
panel. I wonder how this is done and if something similar is
possible/suitalbe.

XY: I am trying to create a simple network monitor.
https://github.com/QubesOS/qubes-issues/issues/8948

Marek Marczykowski-Górecki

unread,
May 13, 2025, 10:59:39 AMMay 13
to qubes...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Any status widget running in a domU should show up in dom0, you don't
need to change anything in dom0.

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmgjXlMACgkQ24/THMrX
1yyfegf9GQGOPf7N0gty/2rwblGUrl/+Qu5nrvFYVXnuvmsh3/PiSgHppAc4kveQ
buitoUAf4oNnWy1nZvc2GZ2fpltkT611HgXDl1yZJ6uYmD6EScPWY9nMbz9VS5Pj
Cve7SP3Nzof+HzojODdzYTTQUfC2L2pRp7KNd/eWsPvLcbphrLA5GNw0mrm7o8qt
Rx/vE0TrRdNrut2FwOtJKsZFKj05vOgYowiKo/A0YcVx1IXpnM58cDNH0AvmQSUB
r7KYqIIp6IwCm87g/gNrCKX7KuxcI7CnSGUqLwNacBNg2HqAwrVjPrPzQj5uHA+3
eTUyO7325uf7Mxp6IcYKyCAipYjfng==
=w9M7
-----END PGP SIGNATURE-----

qubist

unread,
May 13, 2025, 11:41:43 AMMay 13
to qubes...@googlegroups.com
Thanks for the quick reply!

On Tue, 13 May 2025 16:59:31 +0200 Marek Marczykowski-Górecki wrote:

> Any status widget running in a domU should show up in dom0, you don't
> need to change anything in dom0.

In case you mean running a panel in the domU itself (and a widget in
that panel), I am already using that. The problem is that this domU
panel is:

- a second panel (using extra space)
- is challenging to position correctly (so I use a custom script in
dom0 for that part)
- is actually a window - with a title, frame and everything

i.e. not really a seamlessly integrated UI element.

In case you mean something else, could you please explain?

Marek Marczykowski-Górecki

unread,
May 13, 2025, 12:30:47 PMMay 13
to qubes...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

I meant just an application that dock itself in the tray area ("status
icon"?), just like network manager.

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmgjc68ACgkQ24/THMrX
1ywdvggAjBF3glGPLjLQzhKRlGSsvwiQR2kA704Zo/dtJh9dOKeM0VrCH08IEHxk
cBDUhp9A1f5reujPt1zJO/028J7opvhuaaCN+wJRN+9LfNcgNCK+n6DxplonRR6z
HDaOkIyaPLeY483XPAgPYdUNs89WnsYjlZejUf39B1qbGvO6QQK7Ca4SVHSZ3f+9
zGKrgaR2Pkodc1oUcK5MPw38lAcOS9QhwhsAqEsSSZL7+ta8rfDFVZrPBqQG+HfF
N3hOGh+S4tUI16e7G9xWqzRJlFfxxnMhsqwUs9bFVHT27cyBg9rQ//d9AueEZoS/
OxmjG0uQbfNxzhciVdQTye2xYDQVsw==
=ASjX
-----END PGP SIGNATURE-----

qubist

unread,
May 13, 2025, 12:34:12 PMMay 13
to qubes...@googlegroups.com
How can I display domU's bash script output (short text) in dom0 panel,
without the mentioned lag?

Marek Marczykowski-Górecki

unread,
May 13, 2025, 12:57:26 PMMay 13
to qubes...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Tue, May 13, 2025 at 04:33:52PM -0000, qubist wrote:
> How can I display domU's bash script output (short text) in dom0 panel,
> without the mentioned lag?

I don't know any specific app doing that, but if you want to reduce lag,
IMO trying with bash is not the best idea. Try to search for a tray
widget showing network traffic stats already, I'm pretty sure you are
not the first person wanting this.

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmgjee4ACgkQ24/THMrX
1yzPPQf9EB1iUi04lupvtOiZOUpZVa90SNouvs1S9G+pxoSEr3y95KEagAfK9lba
TX60Y1qnepHm2bNuKCM2JKKMIDqGEIi8uQgQ/ZmMo7eUHOIavsrvl0vxHL60TO+s
o5Pd0BCs9iahxi3VHkFyPuRZ7xMrtf5UlCRbDdekxjVV28ueso9l6df19/qKaQbf
tiLFzJGxFCuW+WN8pilYdOUR0ubqexzUJK4wzyQMLzWlrdbDSWCy9FwbkBYNhw8O
CHbv8MVNHuWRIrW1uMOmhnmYPvRtmGs1sFWHm76FtF0exuSnTXsQAj+Tw82s3Blh
V1uco2p8CTx+k2vzo90BzruvwO6VZA==
=JEdb
-----END PGP SIGNATURE-----

qubist

unread,
May 13, 2025, 1:11:31 PMMay 13
to qubes...@googlegroups.com
On Tue, 13 May 2025 18:57:18 +0200 Marek Marczykowski-Górecki wrote:

> I don't know any specific app doing that, but if you want to reduce lag,
> IMO trying with bash is not the best idea.

It is not bash that introduces the lag but qvm-run.

My script completes in about 20ms, i.e. x10-15 faster than the
200-300ms lag which qvm-run adds. So, the bottleneck is qvm-run.

> Try to search for a tray widget showing network traffic stats
> already, I'm pretty sure you are not the first person wanting this.

I have done that multiple times recently and in the past, w/o success.

qubist

unread,
May 14, 2025, 12:22:19 PMMay 14
to qubes...@googlegroups.com
Marek,

Is there a way to reduce the lag and load of qvm-run?

user@dom0:~ > time qvm-run --pass-io --no-color-output -- sys-net 'true'

real 0m0.218s
user 0m0.098s
sys 0m0.061s

Running this every second adds about 6% CPU load.

That is too much.

Marek Marczykowski-Górecki

unread,
May 14, 2025, 1:02:10 PMMay 14
to qubes...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Simply don't run it every second... If you really need to, make a script
that runs continuously and outputs new info every second.

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmgkzIsACgkQ24/THMrX
1yzMAQgAj7H/4+vIH+WDjR0HcjsMOQlJvxZCiDrRe1Sswv9//VNa1aAdRjbi4CCm
gkJoRT7rJg3dKvlWnRf1SU6e1adBIOra0wU5uGeM7X9VBOV/5HJBomm90I9Fy6Bc
Six/UQTCmfGYjwK5Cek8mtj52Mv6+tjqYa7m3b72ZoGlnlpRo3pq9pKyGUBFreCz
gA3M9hLsRQVS28SsqIwV08/V5BkierQSEjS3HUnu0N07yOM4T4JLmuNHys4IIuTs
EhxPqenA6y5QWHVK3chnCDk7G9ZZ77cBhn/lY5h4lkOCb3ig3D52rqT5HnUSXGZd
dNexM1jIE0fSVvARo7srjveuU2Npvw==
=vkOQ
-----END PGP SIGNATURE-----

qubist

unread,
May 14, 2025, 1:39:19 PMMay 14
to qubes...@googlegroups.com
On Wed, 14 May 2025 19:02:03 +0200 Marek Marczykowski-Górecki wrote:

> Simply don't run it every second... If you really need to, make a
> script that runs continuously and outputs new info every second.

But that is not possible. The data (RX/TX transfer bytes) is in sys-net
and needs to be read frequently to make realtime monitoring.
Calculations can happen either in dom0 or in sys-net.

If in dom0: There need to be at least 4 polls (4 x qvm-run), i.e. even
worse.
If in sys-net: There will be only one poll per cycle (one qvm-run),
pulling the result only (what I use).

The only problem is the slowness of qvm-run.

Or... I don't understand your idea. I hope you can clarify.

Marek Marczykowski-Górecki

unread,
May 14, 2025, 3:11:15 PMMay 14
to qubes...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

qvm-run -p sys-net "while sleep 1; do your-magic-commands; done"

And then handle incoming data as it goes.

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmgk6swACgkQ24/THMrX
1yzSJwf/esWOvgxX494JKIJcyrvjfabN9zuHs0aG4eDgr8Z/21M0QdcSkKmHyWxW
BQNtHKmqS+i+BiMQWJsN8tCw/bFz7eXKrNMfGPz8Udr14Zf7Zv3DucLopcrCYt1j
5Gny/dvRyGNJkSio1GIfuf1hxX8yCO58v28l9EstCRbITRAqBj2tPcHhaGWB7xMa
secypDtYgaa/1bmRzRDhkz/a0SJcqYoJu2MlW+TROApT1MDabNCS+NIYgCGw+XfN
fTWHb6tJ3z8gr9g+jhKVXJbseiId/3ZmXVWb/c0mIRstN62BhlksG+r+gcPdAiPA
uOwVbcn0ZeVA7w739gUgW4WSsyytyA==
=gCKV
-----END PGP SIGNATURE-----

qubist

unread,
May 15, 2025, 12:49:25 PMMay 15
to qubes...@googlegroups.com
On Wed, 14 May 2025 21:11:08 +0200 Marek Marczykowski-Górecki wrote:

> qvm-run -p sys-net "while sleep 1; do your-magic-commands; done"

Interesting. I didn't know that was possible. Thanks!

Is there a way to capture only the last line of qvm-run's output?

'>' acts strangely, always appending (like '>>'). Piping through tail
doesn't seem to work at all. I have been fighting with --localcmd as
well but can't get my head around how it works. Can't find more
detailed docs as well.

XFCE's generic monitor seems to expect a static string, not a stream
(which qvm-run generates through this remote loop).

qubist

unread,
May 16, 2025, 2:31:54 PMMay 16
to qubes...@googlegroups.com
I think I made it:

https://forum.qubes-os.org/t/network-monitor-widget-for-xfce-panel/33946

You are welcome to use it for the project, if you find it appropriate.

It may need some polishing and optimization, as handling the stream
data is somewhat tricky to me.
Reply all
Reply to author
Forward
0 new messages