Show posters as real images in kitty and Ghostty (Kitty graphics with Unicode placeholders)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 23:03:29 +02:00
co-authored by Claude Sonnet 5.5
parent dc82b0b95d
commit 108541af91
12 changed files with 601 additions and 49 deletions
+7 -4
View File
@@ -40,8 +40,11 @@ type UI struct {
// CoverStyle selects the block characters posters are drawn with:
// "quadrant" (2x2 pixels per cell, every font has the glyphs), "sextant"
// (2x3, sharper, needs a font with the Symbols for Legacy Computing
// block, e.g. kitty, WezTerm, foot, Ghostty) or "auto" (default: sextant
// on terminals known to draw them, quadrant elsewhere).
// block, e.g. kitty, WezTerm, foot, Ghostty), "kitty" (real images through
// the Kitty graphics protocol with Unicode placeholders: kitty and
// Ghostty) or "auto" (default: the Kitty protocol where the terminal is
// known to support it, else sextant on terminals known to draw them, else
// quadrant). The block styles are also the fallback for "kitty".
CoverStyle string `json:"cover_style,omitempty"`
}
@@ -161,9 +164,9 @@ func (c *Config) Validate() error {
}
}
switch c.UI.CoverStyle {
case "", "auto", "quadrant", "sextant":
case "", "auto", "quadrant", "sextant", "kitty":
default:
errs = append(errs, fmt.Errorf(`ui.cover_style: %q must be "auto", "quadrant" or "sextant"`, c.UI.CoverStyle))
errs = append(errs, fmt.Errorf(`ui.cover_style: %q must be "auto", "kitty", "sextant" or "quadrant"`, c.UI.CoverStyle))
}
return errors.Join(errs...)
}
+2 -2
View File
@@ -100,12 +100,12 @@ func TestShowCovers(t *testing.T) {
func TestCoverStyleValidation(t *testing.T) {
base := `{"radarr":{"url":"http://r","apikey":"k"},"sonarr":{"url":"http://s","apikey":"k"},"sabnzbd":{"url":"http://a","apikey":"k"},"ui":{"cover_style":`
for _, ok := range []string{`"auto"`, `"quadrant"`, `"sextant"`, `""`} {
for _, ok := range []string{`"auto"`, `"quadrant"`, `"sextant"`, `"kitty"`, `""`} {
if _, err := Parse([]byte(base + ok + `}}`)); err != nil {
t.Errorf("%s rejected: %v", ok, err)
}
}
if _, err := Parse([]byte(base + `"braille"}}`)); err == nil {
if _, err := Parse([]byte(base + `"sixel"}}`)); err == nil {
t.Error("unknown style accepted")
}
}