diff options
author | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 11:01:49 +0200 |
---|---|---|
committer | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 11:01:49 +0200 |
commit | 20dbeb2f38684c65ff0a4b99012c161295708e88 (patch) | |
tree | a5b8445f55da2fbbb92443b68e9d7354a290c598 /foreign/client_handling/system.py |
Diffstat (limited to 'foreign/client_handling/system.py')
-rw-r--r-- | foreign/client_handling/system.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/foreign/client_handling/system.py b/foreign/client_handling/system.py new file mode 100644 index 0000000..1dcb26c --- /dev/null +++ b/foreign/client_handling/system.py @@ -0,0 +1,18 @@ +import win32gui +import win32con + +from foreign.utility.terminal_pipe import * + + +def system(action_type, extra_data): + if action_type == 'shutdown': + return {'message': terminal_pipe('shutdown /p /f', extra_data[0], extra_data[1])} + elif action_type == 'restart': + return {'message': terminal_pipe('shutdown /r /f /t 0', extra_data[0], extra_data[1])} + elif action_type == 'logout': + return {'message': terminal_pipe('shutdown /l /f', extra_data[0], extra_data[1])} + elif action_type == 'standby': + win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, win32con.SC_MONITORPOWER, 2) + return {'message': 'Successfully activated standby mode', 'text_mode': 'success'} + else: + raise Exception('Error message')
\ No newline at end of file |