{
    "version": "0.99.1",
    "description": "A set of utilities for power users to tune and streamline their Windows experience for greater productivity.",
    "homepage": "https://github.com/microsoft/PowerToys",
    "license": "MIT",
    "notes": [
        "Add PowerToys context menu option by running:",
        "Invoke-Expression -Command \"& `\"$dir\\install-context.ps1`\"\"",
        "",
        "If an error occurs when updating or uninstalling, execute the following command then retry:",
        "`Stop-Process -Name 'explorer'`"
    ],
    "architecture": {
        "64bit": {
            "url": "https://github.com/microsoft/PowerToys/releases/download/v0.99.1/PowerToysUserSetup-0.99.1-x64.exe",
            "hash": "cad34aa632251cfb9bda1d6fe70e0bd5c150ac6fec7afb0ba179df90413430cd"
        },
        "arm64": {
            "url": "https://github.com/microsoft/PowerToys/releases/download/v0.99.1/PowerToysUserSetup-0.99.1-arm64.exe",
            "hash": "7bd4c3e66d64339c40dd42ec58de8f25e2b81ecd90c45f0ad95247024f508705"
        }
    },
    "installer": {
        "script": [
            "Expand-DarkArchive \"$dir\\$fname\" \"$dir\\.tmp\"",
            "Get-ChildItem \"$dir\\.tmp\\AttachedContainer\\PowerToysUserSetup*.msi\" | Rename-Item -NewName 'PowerToysSetup.msi' -Force",
            "$ver = ([xml](Get-Content -Raw \"$dir\\.tmp\\UX\\manifest.xml\" -Encoding utf8)).BurnManifest.EngineVersion",
            "if (($null -ne $ver) -and ($ver -like \"5.*\")) {",
            "    Expand-MsiArchive \"$dir\\.tmp\\AttachedContainer\\PowerToysSetup.msi\" \"$dir\" -ExtractDir 'LocalApp\\PowerToys'",
            "} else {",
            "    Expand-MsiArchive \"$dir\\.tmp\\AttachedContainer\\PowerToysSetup.msi\" \"$dir\" -ExtractDir 'PowerToys'",
            "}",
            "Remove-Item \"$dir\\.tmp\", \"$dir\\$fname\" -Force -Recurse"
        ]
    },
    "post_install": [
        "'install-context', 'uninstall-context' | ForEach-Object {",
        "    if (Test-Path \"$bucketsdir\\$bucket\\scripts\\$app\\$_.ps1\") {",
        "        $content = Get-Content \"$bucketsdir\\$bucket\\scripts\\$app\\$_.ps1\"",
        "        $content = $content.Replace('{{scoop_dir}}', $original_dir)",
        "        if ($global) {",
        "            $content = $content.Replace('{{install_scope}}', 'perMachine')",
        "            $content = $content.Replace('{{registry_scope}}', 'HKLM')",
        "        }",
        "        $content = $content.Replace('{{install_scope}}', 'perUser')",
        "        $content = $content.Replace('{{registry_scope}}', 'HKCU')",
        "        $content | Set-Content -Path \"$dir\\$_.ps1\"",
        "    }",
        "}",
        "$regpath = 'HKCU:\\Software\\Classes\\powertoys'",
        "if ($global) {",
        "    $regpath = $regpath.Replace('HKCU', 'HKLM')",
        "}",
        "if (Test-Path -Path $regpath) {",
        "    Remove-Item -Path $regpath -Recurse -Force | Out-Null",
        "    Invoke-Expression -Command \"& `\"$dir\\install-context.ps1`\"\"",
        "}"
    ],
    "uninstaller": {
        "script": [
            "$regpath = 'HKCU:\\Software\\Classes\\powertoys'",
            "if ($global) {",
            "    $regpath = $regpath.Replace('HKCU', 'HKLM')",
            "}",
            "if (Test-Path -Path $regpath) {",
            "    Invoke-Expression -Command \"& `\"$dir\\uninstall-context.ps1`\"\"",
            "    if ($cmd -ne 'uninstall') {",
            "        New-Item -Path $regpath -Force | Out-Null",
            "    }",
            "}"
        ]
    },
    "shortcuts": [
        [
            "PowerToys.exe",
            "PowerToys"
        ]
    ],
    "checkver": {
        "github": "https://api.github.com/repos/microsoft/PowerToys/releases",
        "jsonpath": "$[0].assets[*].browser_download_url",
        "regex": "/releases/download/(?<tag>[\\w.]+)/PowerToysUserSetup-([\\d.]+)-x64\\.exe"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://github.com/microsoft/PowerToys/releases/download/v$version/PowerToysUserSetup-$version-x64.exe"
            },
            "arm64": {
                "url": "https://github.com/microsoft/PowerToys/releases/download/v$version/PowerToysUserSetup-$version-arm64.exe"
            }
        },
        "hash": {
            "url": "https://github.com/microsoft/PowerToys/releases/tag/v$version",
            "regex": "(?sm)$basename.*?>$sha256<"
        }
    }
}
