Open SysVR opened 12 months ago
I think it would be a good idea to add an option to exit the sd-webui process when the queue is finished, so that the rest of the commands in the shell script are executed. It’s simple and useful in many environments.
Windows:
webui.bat
shutdown /s /t 0
Linux:
./webui.sh
systemctl poweroff
Google Colab:
!./webui.sh
from google.colab import runtime
runtime.unassign()
You could achieve this by creating scripts/exit_process.py
and adding a task to run the script at the end of the queue:
from modules import scripts
class Script(scripts.Script):
def title(self):
return 'Exit process'
def run(self, p):
import os
os._exit(0)
but an option would be much better.
Instead of using a checkbox, it might be smarter to implement a dropdown box with the options "Do nothing | Suspend the system | Suspend the system | Shut down the system | Reboot the system | Shut down the WebUI" in the HTML UI element
Import bundle libraries
import ctypes
Windows sleep/standby
ctypes.windll.PowrProf.SetSuspendState(0, 1, 0)
Windows Hibernate
ctypes.windll.PowrProf.SetSuspendState(1, 1, 0)
Win32API Reference (powrprof-setsuspendstate) https://learn.microsoft.com/en-us/windows/win32/api/powrprof/nf-powrprof-setsuspendstate
Linux systemctl halt systemctl poweroff systemctl reboot systemctl suspend systemctl hibernate systemctl hybrid-sleep