From 5ddda43d35f3f2c41ff2c4a9347d215806c439fb Mon Sep 17 00:00:00 2001 From: nick <62725534+nicklvh@users.noreply.github.com> Date: Sun, 14 Jul 2024 00:09:43 +0100 Subject: [PATCH] fix: toggle 'Give access to' context menu (#1146) Co-authored-by: he3als <65787561+he3als@users.noreply.github.com> --- src/playbook/Configuration/tweaks.yml | 1 - .../remove-context-menus/give-access-to.yml | 10 ---------- .../Give Access To Menu Disable (default).reg | 13 +++++++++++++ .../Give Access To Menu Enable.reg | Bin 0 -> 1474 bytes .../ScriptWrappers/DisableFileSharing.ps1 | 3 +++ .../Scripts/ScriptWrappers/EnableFileSharing.ps1 | 5 +++++ 6 files changed, 21 insertions(+), 11 deletions(-) delete mode 100644 src/playbook/Configuration/tweaks/qol/explorer/remove-context-menus/give-access-to.yml create mode 100644 src/playbook/Executables/AtlasDesktop/3. General Configuration/File Sharing/Give Access To Menu/Give Access To Menu Disable (default).reg create mode 100644 src/playbook/Executables/AtlasDesktop/3. General Configuration/File Sharing/Give Access To Menu/Give Access To Menu Enable.reg diff --git a/src/playbook/Configuration/tweaks.yml b/src/playbook/Configuration/tweaks.yml index 85d5f4b88d..b2c2172d7e 100644 --- a/src/playbook/Configuration/tweaks.yml +++ b/src/playbook/Configuration/tweaks.yml @@ -225,7 +225,6 @@ actions: # -------------------------------------------------------------------------- # - !task: {path: 'tweaks\qol\explorer\remove-context-menus\cast-to-device.yml'} - !task: {path: 'tweaks\qol\explorer\remove-context-menus\extract-all.yml'} - - !task: {path: 'tweaks\qol\explorer\remove-context-menus\give-access-to.yml'} - !task: {path: 'tweaks\qol\explorer\remove-context-menus\include-in-library.yml'} - !task: {path: 'tweaks\qol\explorer\remove-context-menus\new-bitmap.yml'} - !task: {path: 'tweaks\qol\explorer\remove-context-menus\new-rtf.yml'} diff --git a/src/playbook/Configuration/tweaks/qol/explorer/remove-context-menus/give-access-to.yml b/src/playbook/Configuration/tweaks/qol/explorer/remove-context-menus/give-access-to.yml deleted file mode 100644 index b5b1ff2a80..0000000000 --- a/src/playbook/Configuration/tweaks/qol/explorer/remove-context-menus/give-access-to.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Remove 'Give access to' from Context Menu -description: Removes 'Give access to' from context menu -actions: - - !registryKey: {path: 'HKCR\*\shellex\ContextMenuHandlers\Sharing'} - - !registryKey: {path: 'HKCR\Directory\Background\shellex\ContextMenuHandlers\Sharing'} - - !registryKey: {path: 'HKCR\Directory\shellex\ContextMenuHandlers\Sharing'} - - !registryKey: {path: 'HKCR\Drive\shellex\ContextMenuHandlers\Sharing'} - - !registryKey: {path: 'HKCR\LibraryFolder\background\shellex\ContextMenuHandlers\Sharing'} - - !registryKey: {path: 'HKCR\UserLibraryFolder\shellex\ContextMenuHandlers\Sharing'} diff --git a/src/playbook/Executables/AtlasDesktop/3. General Configuration/File Sharing/Give Access To Menu/Give Access To Menu Disable (default).reg b/src/playbook/Executables/AtlasDesktop/3. General Configuration/File Sharing/Give Access To Menu/Give Access To Menu Disable (default).reg new file mode 100644 index 0000000000..62c51eed14 --- /dev/null +++ b/src/playbook/Executables/AtlasDesktop/3. General Configuration/File Sharing/Give Access To Menu/Give Access To Menu Disable (default).reg @@ -0,0 +1,13 @@ +Windows Registry Editor Version 5.00 + +[-HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Sharing] + +[-HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\Sharing] + +[-HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\Sharing] + +[-HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\Sharing] + +[-HKEY_CLASSES_ROOT\LibraryFolder\background\shellex\ContextMenuHandlers\Sharing] + +[-HKEY_CLASSES_ROOT\UserLibraryFolder\shellex\ContextMenuHandlers\Sharing] diff --git a/src/playbook/Executables/AtlasDesktop/3. General Configuration/File Sharing/Give Access To Menu/Give Access To Menu Enable.reg b/src/playbook/Executables/AtlasDesktop/3. General Configuration/File Sharing/Give Access To Menu/Give Access To Menu Enable.reg new file mode 100644 index 0000000000000000000000000000000000000000..83b46cf957a33eb03ec59267fa0af95bbbb8d0b6 GIT binary patch literal 1474 zcmd^<+e!m55Qe{N!FMQL3KbX67lK+Vf)&9d;!0W99u`Xr+g4q~S69CTuLbX9Wf+ow zX7XnyndI~1hJrDVOn6~RgL8Tev`v{&QfX=HEkqM>gKPbz-aNsXDTNd*RQDNUyrlGbn<~`s( z?z+b=OT5u%o5aW+GfLDZo1%<$XNi)Fn&K@Z`_4k|yTYk#9Y`vs8Qid-ux! NBvkv;IsElr{sPZR@Sgwx literal 0 HcmV?d00001 diff --git a/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/DisableFileSharing.ps1 b/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/DisableFileSharing.ps1 index 315b39eae0..4bb572d39a 100644 --- a/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/DisableFileSharing.ps1 +++ b/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/DisableFileSharing.ps1 @@ -4,6 +4,7 @@ param ( [switch]$Silent ) +$networkDiscoveryConfigPath = "$([Environment]::GetFolderPath('Windows'))\AtlasDesktop\6. Advanced Configuration\Services\Network Discovery" $fileSharingConfigPath = "$([Environment]::GetFolderPath('Windows'))\AtlasDesktop\3. General Configuration\File Sharing" # Disable network items @@ -32,6 +33,8 @@ Get-NetFirewallRule | Where-Object { reg import "$networkDiscoveryConfigPath\Network Navigation Pane\Disable Network Navigation Pane (default).reg" | Out-Null +reg import "$fileSharingConfigPath\Give Access To Menu\Give Access To Menu Disable (default).reg" | Out-Null + if ($Silent) { exit } Write-Host "Completed!" -ForegroundColor Green diff --git a/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/EnableFileSharing.ps1 b/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/EnableFileSharing.ps1 index ffb46772df..1c743d8637 100644 --- a/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/EnableFileSharing.ps1 +++ b/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/EnableFileSharing.ps1 @@ -41,6 +41,11 @@ if ($LASTEXITCODE -eq 1) { reg import "$([Environment]::GetFolderPath('Windows'))\AtlasDesktop\3. General Configuration\File Sharing\Network Navigation Pane\User Network Navigation Pane choice.reg" | Out-Null } +choice /c:yn /n /m "Would you like to restore the 'Give access to' context menu in Explorer? [Y/N] " +if ($LASTEXITCODE -eq 1) { + reg import "$([Environment]::GetFolderPath('Windows'))\AtlasDesktop\3. General Configuration\File Sharing\Give Access To Menu\Give Access To Menu Enable.reg" | Out-Null +} + Write-Host "Completed!" -ForegroundColor Green Write-Host "Press any key to exit... " -NoNewLine $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') | Out-Null