← all posts site ↗

the screenshot toast that looked glassy

i wanted print screen to do a region select, copy the image straight to the clipboard, and then show a small notification i could click to open the full editor, instead of that big popup that always got in the way. the first version worked but the notification was plain and ugly, so it became a custom dark card with a rounded thumbnail on the left, a title and subtitle, and a thin colored border with an annotate pill on the right. it fades in and out on its own after a few seconds, and clicking the card or the pill opens the editor on the saved file.

the reason it is a window and not a real notification is that the shell's notification server has no image capability at all. it supports actions, body, persistence and inline reply but no thumbnails, so a plain notification can never show the picture preview. a small gtk window gives full control of the look and position.

the corners were sharp and the card looked glassy, which took a minute to untangle. the card is a normal window, so its surface is a rectangle, and the radius in the css only rounded the painted background inside that rectangle, leaving a square window edge with a curve drawn in it. fixing that meant the compositor itself has to round the window, since css cannot round a wayland toplevel. the glassy look was a shell visual effect plugin that applies its liquid pass to every window with no way to exclude one, so the card had to go fully opaque to stop the blur and specular showing through. forced opacity to full in the window rule and the card finally reads clean. the layout also got a rebuild so padding, thumbnail size, gaps and the button are all even instead of askew.