chkpwd / iac

https://blog.chkpwd.com
MIT License
56 stars 4 forks source link

Stylize PowerShell on my Windows hosts #710

Closed chkpwd closed 2 weeks ago

chkpwd commented 5 months ago

Install font using this powershell command:

$SourceDir   = "C:\InstallFont\"
$Source      = "C:\InstallFont\*"
$Destination = (New-Object -ComObject Shell.Application).Namespace(0x14)
$TempFolder  = "C:\Windows\Temp\Fonts"

# Create the source directory if it doesn't already exist
New-Item -ItemType Directory -Force -Path $SourceDir

New-Item $TempFolder -Type Directory -Force | Out-Null

Get-ChildItem -Path $Source -Include '*.ttf','*.ttc','*.otf' -Recurse | ForEach {
    If (-not(Test-Path "C:\Windows\Fonts\$($_.Name)")) {

        $Font = "$TempFolder\$($_.Name)"

        # Copy font to local temporary folder
        Copy-Item $($_.FullName) -Destination $TempFolder

        # Install font
        $Destination.CopyHere($Font,0x10)

        # Delete temporary copy of font
        Remove-Item $Font -Force
    }
}

Use this to find the settings.json file.

$settings = (Get-Item "C:\users\$env:UserName\AppData\Local\Packages\Microsoft.WindowsTerminal_*\LocalState\settings.json")
$settings.DirectoryName

Place this in the settings.json file underneath .profiles.defaults.{}:

"font": {
    "face": "CaskaydiaMono Nerd Font",
    "size": 12,
    "weight": "normal"
}

Init starship with preset:

starship preset tokyo-night -o .\.config/starship.toml
Set-Content -Path $PROFILE -Value 'Invoke-Expression (&starship init powershell)'
tigattack commented 4 months ago

Recommend this be closed ASAP.

chkpwd commented 2 weeks ago

Recommend this be closed ASAP.

Came to my senses, closing.