Skip to content

Instantly share code, notes, and snippets.

@jfhbrook
Last active April 19, 2024 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfhbrook/35ccb86af818f4ebbb8ec632e3b9cc55 to your computer and use it in GitHub Desktop.
Save jfhbrook/35ccb86af818f4ebbb8ec632e3b9cc55 to your computer and use it in GitHub Desktop.
Select an oh-my-posh theme (MacOS + Homebrew)
function Initialize-Omp {
param(
[string] $Config,
[string] $Theme
)
$OmpPath = "$(brew --prefix oh-my-posh)"
if ($Theme) {
$Config = "$OmpPath/themes/$Theme.omp.json"
}
if ($Config -eq "") {
oh-my-posh init pwsh | Invoke-Expression
} else {
oh-my-posh init pwsh --config "$Config" | Invoke-Expression
}
}
function Select-OmpTheme {
$OmpPath = "$(brew --prefix oh-my-posh)"
$Theme = (Get-ChildItem "$OmpPath/themes").Name | fzf
if ($Theme -eq "") {
Write-Warning "No theme selected."
} else {
oh-my-posh init pwsh --config "$OmpPath/themes/$Theme" | Invoke-Expression
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment