The package swayidle has code to detect idle time, the source has little in the way of comments and is difficult to understand.
swayidle -w timeout 5 'echo 5' timeout 10 'echo 10' resume 'echo resume' \ before-sleep 'echo before-sleep' A command-line like the above will display messages on 5 seconds and 10 seconds of idle time and display "resume" when there is keyboard or mouse input. That could be changed to have kill -USR1 and kill -USR2 and use them as the signals for the system being idle or in-use. If BOINC took those signals then the local user/sysadmin could script things to work with X11, terminal logins, etc. The current code only works with X11 and even that code has issues. If signals aren't considered a good way of doing it then there could be a flag file or some other method. As an aside to run swayidle as root you need to set this environment variable WAYLAND_DISPLAY=../$REALUID/wayland-0 where REALUID is the UID of the user with the graphical login. -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/