🐍 Python 3.10+
Disable Xbox Game Bar Capture (Python)
Disables background game/app capture via the Xbox Game Bar. Applies the tweak via the stdlib winreg module.
set_disable_game_bar.py
#!/usr/bin/env python3
"""
set_disable_game_bar.py
Disable Xbox Game Bar Capture.
Disables background game/app capture via the Xbox Game Bar.
Usage:
python set_disable_game_bar.py
"""
import winreg
def main() -> None:
key = winreg.CreateKeyEx(
winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\GameDVR", 0, winreg.KEY_SET_VALUE
)
winreg.SetValueEx(key, "AppCaptureEnabled", 0, winreg.REG_DWORD, 0)
winreg.CloseKey(key)
print("Disable Xbox Game Bar Capture applied.")
if __name__ == "__main__":
main()