From 645976b7c5f92096d728da03d0a341e8f7040368 Mon Sep 17 00:00:00 2001 From: Jeremy Combs Date: Sun, 18 Jan 2026 12:47:42 -0500 Subject: [PATCH 1/2] feat: improve container startup experience - Add -NoLogo flag to PowerShell entrypoint to suppress version banner - Rename theme file from ohmyposh-container.json to blue-psl-10k.omp.json - Update profile to reference new theme filename - Add automatic container info display on startup (configurable via SHOW_CONTAINER_INFO) - Fix indentation in Dockerfile for ubuntu user deletion - Remove redundant font installation comment from Dockerfile --- Dockerfile | 18 ++- config/Microsoft.PowerShell_profile.ps1 | 7 +- ...h-container.json => blue-psl-10k.omp.json} | 115 +++++++++++++----- 3 files changed, 96 insertions(+), 44 deletions(-) rename config/{ohmyposh-container.json => blue-psl-10k.omp.json} (60%) diff --git a/Dockerfile b/Dockerfile index db7aa57..7a636cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,10 +27,10 @@ ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/${PS_MAJOR_VERSION} # If exists, remove 'ubuntu' user RUN if id "ubuntu" &>/dev/null; then \ - echo "Deleting user 'ubuntu'" && userdel -f -r ubuntu || echo "Failed to delete ubuntu user"; \ - else \ - echo "User 'ubuntu' does not exist"; \ - fi; + echo "Deleting user 'ubuntu'" && userdel -f -r ubuntu || echo "Failed to delete ubuntu user"; \ + else \ + echo "User 'ubuntu' does not exist"; \ + fi; # Install sudo and other necessary packages RUN apt-get update \ @@ -107,10 +107,6 @@ RUN curl -LO ${PS_PACKAGE_URL} \ # Install Oh My Posh RUN curl -s https://ohmyposh.dev/install.sh | bash -s -- -d /usr/local/bin -# NOTE: Nerd Font installation removed - fonts must be installed on the HOST machine -# where your terminal emulator runs, not inside the container. -# See README.md for host font installation instructions. - # Oh My Posh Environment Variables (runtime configuration) # ENABLE_OHMYPOSH: Set to 'false' or '0' to disable Oh My Posh prompt # OHMYPOSH_THEME: Theme name (e.g., 'atomic') or URL; empty uses embedded Blue PSL 10K @@ -125,7 +121,7 @@ RUN mkdir -p /home/$USERNAME/.config/powershell # Copy PowerShell profile and Oh My Posh configuration COPY --chown=$USERNAME:$USERNAME config/Microsoft.PowerShell_profile.ps1 /home/$USERNAME/.config/powershell/ -COPY --chown=$USERNAME:$USERNAME config/ohmyposh-container.json /home/$USERNAME/.config/powershell/ +COPY --chown=$USERNAME:$USERNAME config/blue-psl-10k.omp.json /home/$USERNAME/.config/powershell/ # Install PowerShell modules during build # Terminal-Icons: Provides file/folder icons in terminal listings @@ -142,5 +138,5 @@ RUN pwsh -NoProfile -Command " \ # Switching back to interactive after container build ENV DEBIAN_FRONTEND=dialog -# Setting entrypoint to Powershell -ENTRYPOINT ["pwsh"] \ No newline at end of file +# Setting entrypoint to Powershell with no banner +ENTRYPOINT ["pwsh", "-NoLogo"] \ No newline at end of file diff --git a/config/Microsoft.PowerShell_profile.ps1 b/config/Microsoft.PowerShell_profile.ps1 index 7c8720c..b8b41ea 100644 --- a/config/Microsoft.PowerShell_profile.ps1 +++ b/config/Microsoft.PowerShell_profile.ps1 @@ -29,7 +29,7 @@ if (Get-Module PSReadLine) { # Initialize Oh My Posh (unless disabled) if ($env:ENABLE_OHMYPOSH -ne 'false' -and $env:ENABLE_OHMYPOSH -ne '0') { $ohmyposhPath = '/usr/local/bin/oh-my-posh' - $embeddedTheme = '/home/coder/.config/powershell/ohmyposh-container.json' + $embeddedTheme = '/home/coder/.config/powershell/blue-psl-10k.omp.json' if (Test-Path $ohmyposhPath) { $themeConfig = $embeddedTheme @@ -85,5 +85,10 @@ function Show-ContainerInfo { # Alias for container info Set-Alias -Name info -Value Show-ContainerInfo +# Automatically show container info for interactive sessions (can be disabled via SHOW_CONTAINER_INFO env var) +if ($Host.Name -eq 'ConsoleHost' -and $env:SHOW_CONTAINER_INFO -ne 'false' -and $env:SHOW_CONTAINER_INFO -ne '0') { + Show-ContainerInfo +} + # Reset error preference $ErrorActionPreference = 'Continue' diff --git a/config/ohmyposh-container.json b/config/blue-psl-10k.omp.json similarity index 60% rename from config/ohmyposh-container.json rename to config/blue-psl-10k.omp.json index 43b83a3..1aadcca 100644 --- a/config/ohmyposh-container.json +++ b/config/blue-psl-10k.omp.json @@ -37,7 +37,7 @@ { "type": "os", "style": "diamond", - "leading_diamond": "╭─", + "leading_diamond": "\u256d\u2500\ue0b2", "foreground": "#000000", "background": "p:surface0", "template": " {{ if .WSL }}WSL at {{ end }}{{.Icon}} " @@ -45,11 +45,11 @@ { "type": "path", "style": "powerline", - "powerline_symbol": "", + "powerline_symbol": "\ue0b0", "foreground": "p:base", "background": "p:path_blue", - "template": " {{ .Path }} ", - "properties": { + "template": " \uf07c {{ .Path }} ", + "options": { "home_icon": "~", "style": "agnoster_short", "max_depth": 2 @@ -58,7 +58,7 @@ { "type": "git", "style": "powerline", - "powerline_symbol": "", + "powerline_symbol": "\ue0b0", "foreground": "p:base", "background": "p:green", "background_templates": [ @@ -67,9 +67,9 @@ "{{ if gt .Ahead 0 }}p:sky{{ end }}", "{{ if gt .Behind 0 }}p:green{{ end }}" ], - "template": " {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} {{ .StashCount }}{{ end }} ", - "properties": { - "branch_icon": " ", + "template": " {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \ueb4b {{ .StashCount }}{{ end }} ", + "options": { + "branch_icon": "\uf126 ", "fetch_status": true, "fetch_upstream_icon": true } @@ -84,11 +84,11 @@ "type": "node", "style": "powerline", "invert_powerline": true, - "powerline_symbol": "", + "powerline_symbol": "\ue0b2", "foreground": "p:base", "background": "p:teal", - "template": " {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ", - "properties": { + "template": " {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} \ue718 ", + "options": { "fetch_version": true } }, @@ -96,11 +96,23 @@ "type": "go", "style": "powerline", "invert_powerline": true, - "powerline_symbol": "", + "powerline_symbol": "\ue0b2", "foreground": "p:base", "background": "p:sky", - "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ", - "properties": { + "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue627 ", + "options": { + "fetch_version": true + } + }, + { + "type": "julia", + "style": "powerline", + "invert_powerline": true, + "powerline_symbol": "\ue0b2", + "foreground": "p:base", + "background": "p:sapphire", + "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue624 ", + "options": { "fetch_version": true } }, @@ -108,45 +120,85 @@ "type": "python", "style": "powerline", "invert_powerline": true, - "powerline_symbol": "", + "powerline_symbol": "\ue0b2", "foreground": "p:base", "background": "p:yellow", - "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ", - "properties": { + "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue235 ", + "options": { "display_mode": "files", "fetch_virtual_env": false } }, { - "type": "dotnet", + "type": "ruby", "style": "powerline", "invert_powerline": true, - "powerline_symbol": "", + "powerline_symbol": "\ue0b2", "foreground": "p:base", "background": "p:mauve", - "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ", - "properties": { + "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue791 ", + "options": { + "display_mode": "files", "fetch_version": true } }, + { + "type": "azfunc", + "style": "powerline", + "invert_powerline": true, + "powerline_symbol": "\ue0b2", + "foreground": "p:base", + "background": "p:peach", + "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \uf0e7", + "options": { + "display_mode": "files", + "fetch_version": false + } + }, + { + "type": "aws", + "style": "powerline", + "invert_powerline": true, + "powerline_symbol": "\ue0b2", + "foreground": "p:base", + "background_templates": [ + "{{if contains \"default\" .Profile}}p:yellow{{end}}", + "{{if contains \"jan\" .Profile}}p:mauve{{end}}" + ], + "template": " {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} \ue7ad ", + "options": { + "display_default": false + } + }, + { + "type": "root", + "style": "powerline", + "invert_powerline": true, + "powerline_symbol": "\ue0b2", + "foreground": "p:base", + "background": "p:red", + "template": " \uf0ad " + }, { "type": "executiontime", "style": "powerline", "invert_powerline": true, - "powerline_symbol": "", + "powerline_symbol": "\ue0b2", "foreground": "p:base", "background": "p:yellow", - "template": " {{ .FormattedMs }} " + "template": " {{ .FormattedMs }} \uf252 " }, { "type": "status", "style": "diamond", "foreground": "#ffffff", "background": "p:green", - "background_templates": ["{{ if gt .Code 0 }}p:red{{ end }}"], - "template": " {{ if gt .Code 0 }}{{ reason .Code }}{{ else }}{{ end }} ", - "trailing_diamond": "", - "properties": { + "background_templates": [ + "{{ if gt .Code 0 }}p:red{{ end }}" + ], + "template": " {{ if gt .Code 0 }}{{ reason .Code }}{{ else }}\uf42e{{ end }} ", + "trailing_diamond": "\ue0b0", + "options": { "always_enabled": true } }, @@ -154,7 +206,7 @@ "type": "text", "style": "plain", "foreground": "p:surface0", - "template": "─╮" + "template": "\u2500\u256e" } ] }, @@ -167,7 +219,7 @@ "type": "text", "style": "plain", "foreground": "p:surface0", - "template": "╰┄" + "template": "\u2570\u2504" } ] }, @@ -178,12 +230,11 @@ "type": "text", "style": "plain", "foreground": "p:surface0", - "template": "┄╯" + "template": "\u2504\u256f" } ] } ], "console_title_template": "{{ .Shell }} in {{ .Folder }}", "final_space": true -} - +} \ No newline at end of file From cad89d09c44b5f3a35b88bcd254676c7127d1229 Mon Sep 17 00:00:00 2001 From: Jeremy Combs Date: Sun, 18 Jan 2026 13:06:20 -0500 Subject: [PATCH 2/2] fix: update integration test to reference new theme filename --- tests/integration/test_ohmyposh_integration.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_ohmyposh_integration.bats b/tests/integration/test_ohmyposh_integration.bats index 07708f3..688cf68 100644 --- a/tests/integration/test_ohmyposh_integration.bats +++ b/tests/integration/test_ohmyposh_integration.bats @@ -18,7 +18,7 @@ load '../test_helper' } @test "Oh My Posh theme configuration exists" { - run docker run --rm jmcombs/powershell:latest -NoProfile -c "Test-Path '/home/coder/.config/powershell/ohmyposh-container.json'" + run docker run --rm jmcombs/powershell:latest -NoProfile -c "Test-Path '/home/coder/.config/powershell/blue-psl-10k.omp.json'" [ "$status" -eq 0 ] [[ "$output" == *"True"* ]] }