diff --git a/README.md b/README.md index 33d4323..161d678 100644 --- a/README.md +++ b/README.md @@ -336,6 +336,7 @@ can reference this table to determine the `type`: | DIRECTORY | HKEY_CURRENT_USER\\Software\\Classes\\Directory\\shell | Opens on a directory | | DIRECTORY_BACKGROUND | HKEY_CURRENT_USER\\Software\\Classes\\Directory\\Background\\shell | Opens on the background of the Directory | | DRIVE | HKEY_CURRENT_USER\\Software\\Classes\\Drive\\shell | Opens on the drives(think USBs) | +| DESKTOP | Software\\Classes\\DesktopBackground\\shell | Opens on the background of the desktop | * * * diff --git a/context_menu/windows_menus.py b/context_menu/windows_menus.py index 7c38953..95bb926 100644 --- a/context_menu/windows_menus.py +++ b/context_menu/windows_menus.py @@ -148,11 +148,12 @@ def delete_key(path: str, hive: int = 0) -> None: # These are the paths in the registry that correlate to when the context menu is fired. # For example, FILES is when a file is right clicked CONTEXT_SHORTCUTS = { - "FILELOC": "Software\\Classes", + "FILELOC": "Software\\Classes\\SystemFileAssociations", "FILES": "Software\\Classes\\*\\shell", "DIRECTORY": "Software\\Classes\\Directory\\shell", "DIRECTORY_BACKGROUND": "Software\\Classes\\Directory\\Background\\shell", "DRIVE": "Software\\Classes\\Drive\\shell", + "DESKTOP": "Software\\Classes\\DesktopBackground\\shell", } # Not used yet, but could be useful in the future diff --git a/tests/test_windows.py b/tests/test_windows.py index 07e7e54..5041155 100644 --- a/tests/test_windows.py +++ b/tests/test_windows.py @@ -65,6 +65,15 @@ def test_context_menu(windows_platform: None, mocked_winreg: MockedWinReg) -> No sys.executable, Path(__file__).parent.as_posix() ), ), + # Test with DESKTOP + ( + "DESKTOP", + {"python": foo}, + "Software\\Classes\\DesktopBackground\\shell", + '''"{}" -c "import sys; sys.path.insert(0, '{}'); import test_windows; test_windows.foo([' '.join(sys.argv[1:]) ],'')" "%1"'''.format( + sys.executable, Path(__file__).parent.as_posix() + ), + ), ), ) def test_context_command( @@ -127,7 +136,7 @@ def test_context_command( ( ".txt", {"command": "echo hello"}, - "Software\\Classes\\.txt\\shell", + "Software\\Classes\\SystemFileAssociations\\.txt\\shell", "echo hello", ), ),