extras/powershell_greeting: fix WezTerm logo stretch (iterm + preserveAspectRatio)
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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ terminals.
|
||||
| JSON parsing | `jq` / `python3` / grep | `ConvertFrom-Json` (built-in) |
|
||||
| MIME detection | `file --mime-type` | PNG/JPEG/GIF magic bytes |
|
||||
| GIFs | `gifsicle` + `kitten icat` | none: static first frame in Windows Terminal, animated in WezTerm (its `kitty-direct` plays the GIF) |
|
||||
| fastfetch logo | `--logo-type kitty --logo ... --logo-width 35` | `sixel` in Windows Terminal, `kitty-direct` in WezTerm, no image elsewhere |
|
||||
| fastfetch logo | `--logo-type kitty --logo ... --logo-width 35` | `sixel` in Windows Terminal, `iterm` (aspect-preserving box) in WezTerm, no image elsewhere |
|
||||
| Logs | `~/.config/j621Logos/logs.log` | `%APPDATA%\j621Logos\logs.log` |
|
||||
|
||||
## Install
|
||||
@@ -99,8 +99,10 @@ switch, or just edit the file.
|
||||
- **No image logo in Windows Terminal**: WT 1.22+ is required for sixel;
|
||||
update with `winget upgrade Microsoft.WindowsTerminal`.
|
||||
- **WezTerm**: kitty graphics must be on - `config.enable_kitty_graphics = true`
|
||||
in `~/.wezterm.lua`. If the default looks wrong, try
|
||||
`J621_LOGO_TYPE=kitty`, `sixel`, or `iterm`.
|
||||
in `~/.wezterm.lua`. The default uses the `iterm` logo type with
|
||||
`preserveAspectRatio`, which never stretches. If something looks off, try
|
||||
`J621_LOGO_TYPE=kitty-direct`, `kitty`, or `sixel` (note: through ConPTY,
|
||||
plain `kitty` falls back to ASCII and `kitty-direct` stretches tall images).
|
||||
- **VS Code / other terminals**: no image protocol, so the greeting prints a
|
||||
plain fastfetch on purpose (no fetch delay). `J621_ALWAYS_FETCH=1` still
|
||||
fetches and prints the link.
|
||||
|
||||
@@ -20,5 +20,7 @@ if (-not $env:J621_BASE) { $env:J621_BASE = 'https://j621.rainbow-herring.ts.net
|
||||
# if (-not $env:J621_FASTFETCH_CONFIG) { $env:J621_FASTFETCH_CONFIG = 'jake' }
|
||||
|
||||
# Force a fastfetch logo type instead of the per-terminal default
|
||||
# (Windows Terminal -> sixel, WezTerm -> kitty-direct, others -> no image).
|
||||
# if (-not $env:J621_LOGO_TYPE) { $env:J621_LOGO_TYPE = 'kitty-direct' }
|
||||
# (Windows Terminal -> sixel, WezTerm -> iterm with preserveAspectRatio,
|
||||
# others -> no image).
|
||||
# if (-not $env:J621_LOGO_TYPE) { $env:J621_LOGO_TYPE = 'iterm' }
|
||||
# if (-not $env:J621_LOGO_HEIGHT) { $env:J621_LOGO_HEIGHT = '25' }
|
||||
|
||||
Reference in New Issue
Block a user