Created
February 21, 2026 16:24
-
-
Save fi-res/953e186d7886e80f2c7440297437ea92 to your computer and use it in GitHub Desktop.
black screen every 15 mins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import win32gui | |
| import win32con | |
| import win32api | |
| import win32ui | |
| import ctypes | |
| from time import sleep | |
| class __ClearWindow: | |
| def __init__(self, size): | |
| self.hInstance = win32api.GetModuleHandle() | |
| self.className = "GDIWipeWindow" | |
| wndClass = win32gui.WNDCLASS() | |
| wndClass.lpfnWndProc = self.wndProc | |
| wndClass.hInstance = self.hInstance | |
| wndClass.lpszClassName = self.className | |
| try: | |
| win32gui.RegisterClass(wndClass) | |
| except Exception: | |
| pass | |
| self.hwnd = win32gui.CreateWindowEx(win32con.WS_EX_TOPMOST | win32con.WS_EX_LAYERED | win32con.WS_EX_TOOLWINDOW, self.className, None, | |
| win32con.WS_POPUP, 0, 0, size[0], size[1], None, None, self.hInstance, None) | |
| win32gui.ShowWindow(self.hwnd, win32con.SW_SHOW) | |
| win32gui.UpdateWindow(self.hwnd) | |
| self.hdc = win32gui.GetDC(self.hwnd) | |
| self.dc = win32ui.CreateDCFromHandle(self.hdc) | |
| self.dc.FillSolidRect((0, 0, 1920, 1080), win32api.RGB(255, 255, 255)) # White background | |
| # OR | |
| # self.dc.FillSolidRect((0, 0, 1920, 1080), win32api.RGB(0, 0, 0)) # Black background | |
| def wndProc(self, hwnd, msg, wParam, lParam): | |
| if msg == win32con.WM_DESTROY: | |
| win32gui.PostQuitMessage(0) | |
| return win32gui.DefWindowProc(hwnd, msg, wParam, lParam) | |
| def destroy(self): | |
| # Release DC and Destroy Window | |
| self.dc.DeleteDC() | |
| win32gui.DestroyWindow(self.hwnd) | |
| hdc = win32gui.GetDC(0) | |
| while True: | |
| sleep(15 * 60) | |
| for i in range(50): | |
| win32gui.FillRect(hdc, (0, 0, 1920, 1080), win32gui.CreateSolidBrush(0)) | |
| sleep(0.05) | |
| user32 = ctypes.windll.user32 | |
| user32.SetProcessDPIAware() | |
| wipe = __ClearWindow([user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]) | |
| sleep(1) | |
| wipe.destroy() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Draws black square on your screen every 15 mins. The original idea was to reminder to look in different directions to relive eye tension