From 1d01b7490f0dde5de8b915655ddf5ced5273cb4e Mon Sep 17 00:00:00 2001 From: MyDrift Date: Mon, 15 Jul 2024 03:07:43 +0200 Subject: [PATCH] fixed end task with right click (#2331) --- config/tweaks.json | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/config/tweaks.json b/config/tweaks.json index 7f833a74..ea19f27c 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -2294,14 +2294,30 @@ "panel": "1", "Order": "a006_", "InvokeScript": [ - " - Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\TaskbarDeveloperSettings\" -Name \"TaskbarEndTask\" -Type \"DWord\" -Value \"1\" - " + "$path = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\TaskbarDeveloperSettings\" + $name = \"TaskbarEndTask\" + $value = 1 + + # Ensure the registry key exists + if (-not (Test-Path $path)) { + New-Item -Path $path -Force | Out-Null + } + + # Set the property, creating it if it doesn't exist + New-ItemProperty -Path $path -Name $name -PropertyType DWord -Value $value -Force | Out-Null" ], "UndoScript": [ - " - Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\TaskbarDeveloperSettings\" -Name \"TaskbarEndTask\" -Type \"DWord\" -Value \"0\" - " + "$path = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\TaskbarDeveloperSettings\" + $name = \"TaskbarEndTask\" + $value = 0 + + # Ensure the registry key exists + if (-not (Test-Path $path)) { + New-Item -Path $path -Force | Out-Null + } + + # Set the property, creating it if it doesn't exist + New-ItemProperty -Path $path -Name $name -PropertyType DWord -Value $value -Force | Out-Null" ] }, "WPFTweaksPowershell7": {