Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"]
# Setting entrypoint to Powershell with no banner
ENTRYPOINT ["pwsh", "-NoLogo"]
7 changes: 6 additions & 1 deletion config/Microsoft.PowerShell_profile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
115 changes: 83 additions & 32 deletions config/ohmyposh-container.json → config/blue-psl-10k.omp.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
{
"type": "os",
"style": "diamond",
"leading_diamond": "╭─",
"leading_diamond": "\u256d\u2500\ue0b2",
"foreground": "#000000",
"background": "p:surface0",
"template": " {{ if .WSL }}WSL at {{ end }}{{.Icon}} "
},
{
"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
Expand All @@ -58,7 +58,7 @@
{
"type": "git",
"style": "powerline",
"powerline_symbol": "",
"powerline_symbol": "\ue0b0",
"foreground": "p:base",
"background": "p:green",
"background_templates": [
Expand All @@ -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
}
Expand All @@ -84,77 +84,129 @@
"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
}
},
{
"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
}
},
{
"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
}
},
{
"type": "text",
"style": "plain",
"foreground": "p:surface0",
"template": "─╮"
"template": "\u2500\u256e"
}
]
},
Expand All @@ -167,7 +219,7 @@
"type": "text",
"style": "plain",
"foreground": "p:surface0",
"template": "╰┄"
"template": "\u2570\u2504"
}
]
},
Expand All @@ -178,12 +230,11 @@
"type": "text",
"style": "plain",
"foreground": "p:surface0",
"template": "┄╯"
"template": "\u2504\u256f"
}
]
}
],
"console_title_template": "{{ .Shell }} in {{ .Folder }}",
"final_space": true
}

}
2 changes: 1 addition & 1 deletion tests/integration/test_ohmyposh_integration.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"* ]]
}
Expand Down