From a1787a9eac283e8993d7228f2e76470d9ec6634a Mon Sep 17 00:00:00 2001 From: d35ha Date: Fri, 14 Jun 2024 11:33:44 +0000 Subject: [PATCH] Set the Windows Terminal as the default terminal --- packages/windows-terminal.vm/tools/chocolateyinstall.ps1 | 6 ++++++ packages/windows-terminal.vm/tools/chocolateyuninstall.ps1 | 6 ++++++ packages/windows-terminal.vm/windows-terminal.vm.nuspec | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/windows-terminal.vm/tools/chocolateyinstall.ps1 b/packages/windows-terminal.vm/tools/chocolateyinstall.ps1 index 010f34ab6..1946ac6d7 100644 --- a/packages/windows-terminal.vm/tools/chocolateyinstall.ps1 +++ b/packages/windows-terminal.vm/tools/chocolateyinstall.ps1 @@ -54,6 +54,12 @@ try { $label = "Open Terminal here" $icon = "$executablePath" VM-Add-To-Right-Click-Menu -menuKey $toolName -menuLabel $label -command $command -menuIcon $icon -type "directory" -background + + # Set windows terminal as the default terminal (effective only when OS Build >= 19045.3031) + $registryPath = 'HKCU:\Console\%%Startup' + New-Item $registryPath -Force | Out-Null + Set-ItemProperty $registryPath -Name "DelegationConsole" -Value "{2EACA947-7F5F-4CFA-BA87-8F7FBEEFBE69}" -Force | Out-Null + Set-ItemProperty $registryPath -Name "DelegationTerminal" -Value "{E12CFF52-A866-4C77-9A90-F570A7AA2C6B}" -Force | Out-Null } catch { VM-Write-Log-Exception $_ } diff --git a/packages/windows-terminal.vm/tools/chocolateyuninstall.ps1 b/packages/windows-terminal.vm/tools/chocolateyuninstall.ps1 index 4032541eb..b008d1318 100644 --- a/packages/windows-terminal.vm/tools/chocolateyuninstall.ps1 +++ b/packages/windows-terminal.vm/tools/chocolateyuninstall.ps1 @@ -4,5 +4,11 @@ Import-Module vm.common -Force -DisableNameChecking $toolName = 'Windows Terminal' $category = 'Productivity Tools' +# Let Windows decide what is the default terminal +$registryPath = 'HKCU:\Console\%%Startup' +New-Item $registryPath -Force | Out-Null +Set-ItemProperty $registryPath -Name "DelegationConsole" -Value "{00000000-0000-0000-0000-000000000000}" -Force | Out-Null +Set-ItemProperty $registryPath -Name "DelegationTerminal" -Value "{00000000-0000-0000-0000-000000000000}" -Force | Out-Null + VM-Uninstall $toolName $category VM-Remove-From-Right-Click-Menu -menuKey $toolName -type "directory" -background diff --git a/packages/windows-terminal.vm/windows-terminal.vm.nuspec b/packages/windows-terminal.vm/windows-terminal.vm.nuspec index 6965ead68..a070c96b5 100644 --- a/packages/windows-terminal.vm/windows-terminal.vm.nuspec +++ b/packages/windows-terminal.vm/windows-terminal.vm.nuspec @@ -2,7 +2,7 @@ windows-terminal.vm - 1.19.10573.20240402 + 1.19.10573.20240614 Microsoft Windows Terminal is a new, modern, feature-rich, productive terminal application for command-line users.