Close a qube if not used in last X minutes

Is it there a way to close a qube if I didn’t use anything from it in last X minutes?
Usually I ended using more than 10 qubes but some of them can be closed.
I may have KeePassXC starging from qube, 2 browsers from 2 different qubes and a file manager from another qube, but on those qubes that I don’t have nothing opened I’d like to close/shutdown automatically.

Is it there a way to do so?

There is the shutdown-idle service, installed with the
qubes-app-shutdown-idle package.

This will shutdown a qube with no open windows after a configurable
time. It will also watch network, to avoid shutting down netvms.

You can configure the timeout in /lib/python3/dist-packages/qubesidle/idleness_monitor.py

1 Like

Yes, have a look at Minimal templates | Qubes OS

qubes-app-shutdown-idle

1 Like

There’s also [1], if you distrust your VM to shut down itself.

[1] GitHub - 3hhh/qidle: idle daemon for Qubes OS

1 Like

So if I’m using a qube only to make some requests to the internet, from time to time [ a script ], this one will be closed because there are no opened windows.

How can I have the qube name in python so to make a check if the qube name is the one mentioned above to be ignored?

I believe in the next Qubes version (4.1) there will be a way to enable this on the qube via a button.

This is a service - you can enable it or disable it as you would for any
Qubes service.

qvm-features <qube> service.shutdown-idle 1 to enable
or do this in the GUI on the “Services” pane

2 Likes

Amazing. That worked.
Where I can find more details about available services and how to enable them?
[ I already know how to enable qvm-features <qube> service.<service_name> but where I can find that information?]

Thank you

2 Likes