Write-Host "Starting Windows Terminal Customization" # ---------------------------------------------------------------------------- # # Variables # # ---------------------------------------------------------------------------- # $ProgressPreference = 'SilentlyContinue' $TerminalSettingsURI = "https://raw.githubusercontent.com/kristocopani/dotfiles/main/terminalsettings.json" $StarShipSettingsURI = "https://raw.githubusercontent.com/kristocopani/dotfiles/main/starship.toml" $TerminalSettings = (wget $TerminalSettingsURI ).Content $StarShipSettings = (wget $StarShipSettingsURI ).Content $TerminalFolder = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\" $StarShipFolder = "~/.config" $FontsURI = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/CascadiaCode.zip" $FontsDownloadFile = "$env:LOCALAPPDATA\CascadiaCode.zip" $FontsDownloadFolder = "$env:LOCALAPPDATA\CascadiaCode" $PowerShellProfile = (wget https://raw.githubusercontent.com/kristocopani/dotfiles/main/PSProfile.txt ).Content # ---------------------------------------------------------------------------- # # Download Fonts # # ---------------------------------------------------------------------------- # Write-Host "Downloading Caskaydia Cove Nerd Fonts" wget $FontsURI -outfile $FontsDownloadFile Write-Host "Unzipping Files" Expand-Archive $FontsDownloadFile -DestinationPath $FontsDownloadFolder # ---------------------------------------------------------------------------- # # Install Fonts # # ---------------------------------------------------------------------------- # Write-Host "Installing Caskaydia Cove Nerd Fonts" Set-Location $FontsDownloadFolder $fonts = (New-Object -ComObject Shell.Application).Namespace(0x14) foreach ($file in Get-ChildItem *.ttf) { $fileName = $file.Name if (-not(Test-Path -Path "C:\Windows\Fonts\$fileName" )) { Get-ChildItem $file | % { $fonts.CopyHere($_.fullname) } } } Copy-Item *.ttf C:\Windows\Fonts\ # ---------------------------------------------------------------------------- # # Windows Terminal Settings # # ---------------------------------------------------------------------------- # if (!(Test-Path $TerminalFolder\settings.json)) { New-Item $TerminalFolder\settings.json -Force } Write-Host "Applying Windows Terminal Profile" Set-Content -Path $TerminalFolder\settings.json -Value $TerminalSettings -Force # ---------------------------------------------------------------------------- # # Starship Installation # # ---------------------------------------------------------------------------- # Write-Host "Installing StarShip" winget install --id Starship.Starship -h --accept-source-agreements --accept-package-agreements if (!(Test-Path $StarShipFolder\starship.toml)) { New-Item -ItemType Directory -Force $StarShipFolder New-Item -ItemType file $StarShipFolder/starship.toml } Write-Host "Applying StarShip Profile" Set-Content -Path $StarShipFolder/starship.toml -Value $StarShipSettings -Force -Encoding UTF8 # ---------------------------------------------------------------------------- # # Powershell Settings # # ---------------------------------------------------------------------------- # if (!(Test-Path -Path $PROFILE)) { New-Item -ItemType File -Path $PROFILE -Force } Write-Host "Installing modules." if (Get-Module -ListAvailable -Name NuGet) { Write-Host "NuGet Module is installed." } else { Write-Host "Installing NuGet Module." Install-Module -Name NuGet -Force -Confirm:$false } if (Get-Module -ListAvailable -Name PSReadLine) { Write-Host "PSReadLine Module is installed." } else { Write-Host "Installing PSReadLine Module." Install-Module -Name PSReadLine -Force -Confirm:$false } Write-Host "Applying PowerShell Profile" Set-Content $PROFILE -Value $PowerShellProfile # ---------------------------------------------------------------------------- # # Cleanup # # ---------------------------------------------------------------------------- # Write-Host "Cleaning up..." Remove-Item $FontsDownloadFile -Force Remove-Item $FontsDownloadFolder\*-Force $ProgressPreference = 'Continue'