summaryrefslogtreecommitdiffstats
path: root/src/windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/windows')
-rw-r--r--src/windows/ogOperations.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/windows/ogOperations.py b/src/windows/ogOperations.py
index 0af7250..baafbd9 100644
--- a/src/windows/ogOperations.py
+++ b/src/windows/ogOperations.py
@@ -7,6 +7,7 @@
# (at your option) any later version.
import os
+import ctypes
import subprocess
from subprocess import CalledProcessError
import multiprocessing as mp
@@ -18,6 +19,10 @@ from pystray import Icon, Menu, MenuItem
from src.ogRest import ThreadState
+EWX_POWEROFF=0x00000008
+EWX_REBOOT=0x00000002
+
+
def _create_default_image():
"""
Creates a default image for the tray icon. Use in case
@@ -69,10 +74,14 @@ class OgWindowsOperations:
raise NotImplementedError
def poweroff(self):
+ user32 = ctypes.WinDLL('user32')
systray_p.terminate()
+ user32.ExitWindowsEx(EWX_POWEROFF, 0x0)
def reboot(self):
+ user32 = ctypes.WinDLL('user32')
systray_p.terminate()
+ user32.ExitWindowsEx(EWX_REBOOT, 0x0)
def shellrun(self, request, ogRest):
cmd = request.getrun()