I didn’t try this on Qubes, but in general it works on systemd-based systems:
Edit /etc/systemd/logind.conf
and add:
IdleAction=poweroff
IdleActionSec=30min
(replace 30min with your preferred interval, of course)
EDIT and Update #1: it works on my heavily used and modded 4.1.2 installation. Will test on 4.2rc4.
EDIT and Update #2: works on 4.2rc4 too.
The behavior is a little weird: I had the IdleActionSet=10min, and the (stock, blanking, locking) screensaver at 10 minutes too. The laptop shut itself down after 20 minutes! Like it started the Idle timer when the screensaver kicked in and locked the screen.