You are not logged in.
I have a situation where a user needs to be able to walk away from their computer for long periods of time. After a set amount of time, the desktop automatically logs out, which is fine. But it would be better if it just shuts down all the way instead. How can I get that to happen?
Thanks.
Offline
Bump
Offline
I don't think Xfce natively supports this. However, if you are running systemd, there exists an IdleAction setting in /etc/systemd/logind.conf. Set it to poweroff and specify an inactivity timeout. For example:
IdleAction=poweroff
IdleActionSec=30min
...will poweroff the system after 30 minutes of idle time.
You'll need to restart the systemd-logind service:
sudo systemctl restart systemd-logind
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
So, if I understand, the system logs out to the login screen after a period of time which can be set in Xfce. However, the timer keeps going in systemd so that if the Xfce logout is 15 minutes and the systemd shutdown is 30 minutes, the login screen comes on at 15 minutes and the system shuts down at 30 minutes.
Do I have that right?
Offline
I'm not sure - it might notice the Xfce logout as activity. You will need to test it to confirm.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Did not seem to work. I have seen the same process mentioned elsewhere, but I wonder if there is something in the desktop environs that is interrupting things.
Offline
Possibly. Regarding logind's idelaction:
IdleAction=
Configures the action to take when the system is idle. Takes one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep", "suspend-then-hibernate", "sleep", and "lock". Defaults to "ignore".
Note that this requires that user sessions correctly report the idle status to the system. The system will execute the action after all sessions report that they are idle, no idle inhibitor lock is active, and subsequently, the time configured with IdleActionSec= (see below) has expired.
Note the note: "this requires that user sessions correctly report the idle status to the system." You might be onto something.
Is there anything logged in your journal at the time that idleaction should take effect?
Edit: just tested systemd's IdleAction and it appears that something is blocking it. Once I logged in and got a session back, it then noticed that the idle time had passed and then shutdown the computer.
Sep 09 14:51:31 xfce systemd-logind[519]: System idle. Will power off now.
In Power Manager settings on the System tab, in the System Power Saving section, there is a drop down for System Sleep Mode. If Shutdown was an option here it would solve your use case. Might be worth an enhancement request?
Last edited by ToZ (2025-09-09 19:12:28)
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Edit: just tested systemd's IdleAction and it appears that something is blocking it. Once I logged in and got a session back, it then noticed that the idle time had passed and then shutdown the computer.
What? How can that be? What is going on with the system? That can't be right. The Xfce environment should not override the OS in that regard, should it?
I also liked your idea about an enhancement. My options shows only Suspend or Hibernate.
Added later 01 min 45 s:
Btw, where do I make that request?
Offline
Btw, where do I make that request?
Here: https://gitlab.xfce.org/xfce/xfce4-powe … issues/new. You need to make an account to create issues/requests. You might also need to convince the developers that 'Power Off' is a power saving feature. lol. Tamarach visits these forums regularly and maybe he will reply here as well.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Did it. No place for feature request, but got issue added.
Offline
As a workaround, this script might work for you, assuming you are using xfce4-screensaver. Basically what this script does is monitor the state of the screensaver - it runs continuously and checks every SLEEP (30) seconds. If the screensaver has been active for more than TRIGGER (60) seconds then it will poweroff the computer. Make this script executable and put it in your application autostart.
#!/usr/bin/env bash
SLEEP=30
TRIGGER=60
while true
do
sleep $SLEEP
TIME=$(xfce4-screensaver-command -t | awk '{print $7}')
if [ $TIME -gt $TRIGGER ]; then
systemctl poweroff
fi
done
The SLEEP and TRIGGER values are configurable - change them to whatever works for you. Test it and let me know if works.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
[ Generated in 0.007 seconds, 7 queries executed - Memory usage: 589.66 KiB (Peak: 606.5 KiB) ]