From 8b4082e6e169380c427526dfc7fe4e9d64748b47 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 27 Jul 2023 03:07:24 +0200 Subject: [PATCH] Refactor Oh My Posh customization --- scripts/Windows/Collections/Personal.ps1 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/Windows/Collections/Personal.ps1 b/scripts/Windows/Collections/Personal.ps1 index 924b22f7..e0fa2e43 100644 --- a/scripts/Windows/Collections/Personal.ps1 +++ b/scripts/Windows/Collections/Personal.ps1 @@ -148,9 +148,14 @@ function Restore-PersonalApps([Context] $context) { nvs link latest; # Terminal - $profileRoots = @($PROFILE, (powershell -c '$PROFILE')) | ForEach-Object { Split-Path -Parent $_; }; - $profileRoots | ForEach-Object { Remove-Item "$_/profile.d/*Oh My Posh*.ps1"; }; - $context.AddPowerShellProfileStatement($false, "999_Oh My Posh", "oh-my-posh init pwsh --config ~/Nextcloud/.omp/manuel.omp.json | Invoke-Expression"); + @($PROFILE, (powershell -c '$PROFILE')) | ForEach-Object { + Get-Item "$(Split-Path -Parent $_)/profile.d/*Oh My Posh*"; + } | ForEach-Object { + Get-Content $_ | ForEach-Object { + $indicator = "oh-my-posh init"; + $_ -replace $indicator,"$indicator --config ~/Nextcloud/.omp/manuel.omp.json"; + } | Set-Content $_; + } # Gaming choco install -y goggalaxy;