extras/powershell_greeting: fix WezTerm logo stretch (iterm + preserveAspectRatio)
CI / Frontend build & lint (push) Successful in 22s
CI / Backend tests (push) Successful in 2m12s

kitty-direct sends c= but no rows through ConPTY (the terminal guesses the height and stretches); the plain kitty type needs tty pixel queries that ConPTY drops. The iterm type with preserveAspectRatio=1 letterboxes any aspect ratio.
This commit is contained in:
2026-09-30 09:44:36 -05:00
parent d2f857d3ee
commit 4889c5c355
3 changed files with 21 additions and 7 deletions
+12 -2
View File
@@ -23,6 +23,7 @@
# J621_LOGO_TYPE force a fastfetch logo type (sixel, kitty-direct, ...)
# J621_ALWAYS_FETCH=1 fetch even in terminals without image support
# J621_LOGO_WIDTH logo width in columns (default 35)
# J621_LOGO_HEIGHT iterm box height in rows (default 25)
#Requires -Version 5.1
@@ -99,7 +100,7 @@ function Show-J621Greeting {
$logoType = $env:J621_LOGO_TYPE
if (-not $logoType) {
if ($env:WT_SESSION) { $logoType = 'sixel' }
elseif ($env:WEZTERM_PANE) { $logoType = 'kitty-direct' }
elseif ($env:WEZTERM_PANE) { $logoType = 'iterm' }
}
$fetchImage = [bool]$logoType -or ($env:J621_ALWAYS_FETCH -eq '1')
$ffArgs = @(Get-J621FastfetchArgs)
@@ -169,7 +170,16 @@ function Show-J621Greeting {
# --- Display result ---
if ($logoType) {
& fastfetch @ffArgs --logo-type $logoType --logo $tempFile --logo-width $logoWidth
$logoArgs = @('--logo-type', $logoType, '--logo', $tempFile, '--logo-width', $logoWidth)
if ($logoType -eq 'iterm') {
# Box + preserveAspectRatio: never stretched, whatever the aspect ratio
# (kitty-direct cannot do this through ConPTY: its payload has no rows).
$logoHeight = if ($env:J621_LOGO_HEIGHT) { $env:J621_LOGO_HEIGHT } else { '25' }
$logoArgs += @('--logo-height', $logoHeight, '--logo-preserve-aspect-ratio', 'true')
} elseif ($env:J621_LOGO_HEIGHT) {
$logoArgs += @('--logo-height', $env:J621_LOGO_HEIGHT)
}
& fastfetch @ffArgs @logoArgs
} else {
& fastfetch @ffArgs
}