aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-15 18:34:28 +0200
committerDanilo M. <danix@danix.xyz>2026-09-15 18:34:28 +0200
commit49f884f1d23f4b9d8b93f1f69478ab09649b0af1 (patch)
tree84a146c7d139488b9952736910d4bfc9ed3e61fd /internal
parent8087086bc0a996e7dc020ba8bcf1332dd843f034 (diff)
downloadnotifyd-49f884f1d23f4b9d8b93f1f69478ab09649b0af1.tar.gz
notifyd-49f884f1d23f4b9d8b93f1f69478ab09649b0af1.zip
fix(notify): treat icons up to 256px as an app icon, not a preview
A 256px themed icon or logo was still drawn as a large balloon preview. The bound is now 256 on the long side, which covers kitty's own PNG and typical application logos; a screenshot stays well above it.
Diffstat (limited to 'internal')
-rw-r--r--internal/notify/classify.go8
-rw-r--r--internal/notify/classify_test.go6
2 files changed, 10 insertions, 4 deletions
diff --git a/internal/notify/classify.go b/internal/notify/classify.go
index c7e0dc8..d00a7fa 100644
--- a/internal/notify/classify.go
+++ b/internal/notify/classify.go
@@ -21,10 +21,10 @@ import (
"strings"
)
-// IconMaxPixels is the long-side bound below which a content image is treated
-// as an icon rather than a preview. A screenshot is far larger; a themed icon
-// or an application logo is not.
-const IconMaxPixels = 128
+// IconMaxPixels is the long-side bound at or below which a content image is
+// treated as an icon rather than a preview. A themed icon or an application
+// logo is 256 or less; a screenshot is far larger.
+const IconMaxPixels = 256
// IsIconImage reports whether a content image should fill the app-icon slot
// instead of the large preview. Clients disagree about where the icon goes:
diff --git a/internal/notify/classify_test.go b/internal/notify/classify_test.go
index 6234008..bbe7989 100644
--- a/internal/notify/classify_test.go
+++ b/internal/notify/classify_test.go
@@ -39,8 +39,12 @@ func TestIsIconImage(t *testing.T) {
small := filepath.Join(dir, "logo.png")
large := filepath.Join(dir, "shot.png")
svg := filepath.Join(dir, "icon.svg")
+ exactly := filepath.Join(dir, "256.png")
+ over := filepath.Join(dir, "over.png")
writeTestPNG(t, small, 32, 32)
writeTestPNG(t, large, 800, 600)
+ writeTestPNG(t, exactly, 256, 256)
+ writeTestPNG(t, over, 256, 257)
if err := os.WriteFile(svg, []byte("<svg/>"), 0o644); err != nil {
t.Fatal(err)
}
@@ -52,6 +56,8 @@ func TestIsIconImage(t *testing.T) {
{"theme name", "utilities-terminal", "/x/apps/16/utilities-terminal.svg", true},
{"svg", svg, svg, true},
{"small raster", small, small, true},
+ {"at the bound", exactly, exactly, true},
+ {"just over the bound", over, over, false},
{"large raster", large, large, false},
{"missing file", "/no/such.png", "/no/such.png", false},
{"empty", "", "", false},