🐍 Python 3.10+

Disable Lock Screen Notifications (Python)

Stops app notifications from appearing on the lock screen. Applies the tweak via the stdlib winreg module.

By WindowsScripting.com · 619 B
set_disable_lock_screen_notifications.py
#!/usr/bin/env python3
"""
set_disable_lock_screen_notifications.py

Disable Lock Screen Notifications.
Stops app notifications from appearing on the lock screen.

Usage:
    python set_disable_lock_screen_notifications.py
"""

import winreg


def main() -> None:
    key = winreg.CreateKeyEx(
        winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\PushNotifications", 0, winreg.KEY_SET_VALUE
    )
    winreg.SetValueEx(key, "LockScreenToastEnabled", 0, winreg.REG_DWORD, 0)
    winreg.CloseKey(key)
    print("Disable Lock Screen Notifications applied.")


if __name__ == "__main__":
    main()