58 lines
1.8 KiB
PowerShell
58 lines
1.8 KiB
PowerShell
#!/bin/pwsh
|
|
param($context)
|
|
|
|
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
|
|
|
[Context] $context = $context;
|
|
$tempDir = $context.GetTempDirectory();
|
|
$startLayoutFile = "start.json";
|
|
Push-Location "$tempDir";
|
|
|
|
Write-Information "Remove MSEdge Icon";
|
|
$context.RemoveDesktopIcon("Microsoft Edge");
|
|
|
|
Write-Host "Configuring Windows";
|
|
Write-Information "Set old-school icon size";
|
|
|
|
$action = {
|
|
param([Microsoft.Win32.RegistryKey] $userKey)
|
|
|
|
$spacingProperty = "IconSpacing";
|
|
$relativeKeyPath = "Control Panel\Desktop\WindowMetrics"
|
|
$keyPath = "$($userKey.PSPath)\$relativeKeyPath";
|
|
Copy-ItemProperty "HKCU:\$relativeKeyPath" "$keyPath" "$spacingProperty";
|
|
Rename-ItemProperty $keyPath $spacingProperty "_$spacingProperty";
|
|
Set-ItemProperty $keyPath -Name $spacingProperty -Value "-1710" -Type "String";
|
|
}
|
|
|
|
$context.ProcessDefaultUserKey($action);
|
|
|
|
Write-Information "Remove ads from pinned apps";
|
|
Export-StartLayout $startLayoutFile;
|
|
|
|
$startLayout = Get-Content "$startLayoutFile" | ConvertFrom-Json;
|
|
|
|
$startLayout.pinnedList = $startLayout.pinnedList | Where-Object {
|
|
return -not (
|
|
($_.desktopAppLink -like "*Microsoft Edge*") -or
|
|
[System.Linq.Enumerable]::Any(
|
|
@(
|
|
"*MicrosoftOfficeHub*",
|
|
"*SpotifyMusic*",
|
|
"*WhatsApp*",
|
|
"*PrimeVideo*",
|
|
"*Netflix*",
|
|
"*Instagram*",
|
|
"*Clipchamp*",
|
|
"*Facebook*"),
|
|
[System.Func[System.Object,bool]]{
|
|
param($pattern)
|
|
return $_.packagedAppId -like "$pattern";
|
|
}));
|
|
}
|
|
|
|
$startLayout | ConvertTo-Json | Set-Content $startLayoutFile;
|
|
Import-StartLayout $startLayoutFile "$env:SystemDrive";
|
|
|
|
Pop-Location;
|
|
Remove-Item -Recurse "$tempDir";
|