Created
August 25, 2024 17:51
-
-
Save SachinDas246/a38471062d75b34e8b585ef0ba1510de to your computer and use it in GitHub Desktop.
A python script to hide windows cursor by replacing cursor in registry . you will need a blank cur file
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 winreg | |
| import ctypes | |
| import os | |
| script_dir = os.path.dirname(os.path.abspath(__file__)) | |
| blank_cur_path = os.path.join(script_dir, "blank.cur") | |
| cursor_icons = { | |
| "AppStarting":"%SystemRoot%\\cursors\\aero_working.ani", | |
| "Arrow":"%SystemRoot%\\cursors\\aero_arrow.cur", | |
| "Hand":"%SystemRoot%\\cursors\\aero_link.cur", | |
| "Help":"%SystemRoot%\\cursors\\aero_helpsel.cur", | |
| "IBeam":"", | |
| "No":"%SystemRoot%\\cursors\\aero_unavail.cur", | |
| "NWPen":"%SystemRoot%\\cursors\\aero_pen.cur", | |
| "Person":"C:\\Users\\deepspace\\AppData\\Local\\Microsoft\\Windows\\Cursors\\person_eoa.cur", | |
| "Pin":"C:\\Users\\deepspace\\AppData\\Local\\Microsoft\\Windows\\Cursors\\pin_eoa.cur", | |
| "SizeAll":"%SystemRoot%\\cursors\\aero_move.cur", | |
| "SizeNESW":"%SystemRoot%\\cursors\\aero_nesw.cur", | |
| "SizeNS":"%SystemRoot%\\cursors\\aero_ns.cur", | |
| "SizeNWSE":"%SystemRoot%\\cursors\\aero_nwse.cur", | |
| "SizeWE":"%SystemRoot%\\cursors\\aero_ew.cur", | |
| "UpArrow":"%SystemRoot%\\cursors\\aero_up.cur", | |
| "Wait":"%SystemRoot%\\cursors\\aero_busy.ani" | |
| } | |
| cursor_keys = ( | |
| "AppStarting", | |
| "Arrow", | |
| "Hand", | |
| "Help", | |
| "IBeam", | |
| "No", | |
| "NWPen", | |
| "Person", | |
| "Pin", | |
| "SizeAll", | |
| "SizeNESW", | |
| "SizeNS", | |
| "SizeNWSE", | |
| "SizeWE", | |
| "UpArrow", | |
| "Wait" | |
| ) | |
| def updateChanges(): | |
| ctypes.windll.user32.SystemParametersInfoA(0x0057, 0, None, 0) | |
| def hideAllCursor(): | |
| with winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) as hkey: | |
| with winreg.OpenKey(hkey, r"Control Panel\\Cursors\\",0,winreg.KEY_ALL_ACCESS) as sub_key: | |
| for key_name in cursor_keys: | |
| winreg.SetValueEx(sub_key, key_name ,0 , winreg.REG_EXPAND_SZ, blank_cur_path) | |
| updateChanges() | |
| def showAllCursor(): | |
| with winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) as hkey: | |
| with winreg.OpenKey(hkey, r"Control Panel\\Cursors\\",0,winreg.KEY_ALL_ACCESS) as sub_key: | |
| for key_name in cursor_keys: | |
| winreg.SetValueEx(sub_key, key_name ,0 , winreg.REG_EXPAND_SZ, cursor_icons[key_name]) | |
| updateChanges() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment