Conversation
vinzdg#320 gave the folded pill the Theme's colours. In Light it was near-white, and vanished against a white document. In Dark its #2e2e2e edge was 1.4:1 against a black wallpaper, where that edge is the only thing showing the pill at all. The folded pill now takes no part in Theme: black, as the Mac's Solid black and Dark glass styles draw it, with a #5c5c5c edge, 3:1 against black. The open notch and the card still follow Theme. (The Mac's default, Liquid Glass, makes the folded pill glass, which Windows has no material for.)
A black pill with a visible edge can be found anywhere, but over a dark editor or wallpaper it is only the edge. The iPhone's home indicator solves the same problem by following what is under it: light over dark content, dark over light. Appearance → Adaptive pill does that here. It is off unless switched on, because it reads the screen. While the notch is folded, backdrop.rs reads a strip of the screen beside the pill twice a second (GDI BitBlt, already in the windows crate's features), reduces it to one average luminance, and tells the page when the other pill would stand out 1.5 times more. The margin is hysteresis: a middling backdrop, or a page scrolling past, keeps the pill it has. The page sends the strip with the wake rectangle, beside the pill rather than under it, because what a screen read sees of the notch window changes with click-through, and beside the pill nothing is drawn while folded. With the switch off, the notch open, or Show on Always show, nothing is read, and only the average is ever kept. The Settings caption and the README both say so. Switching it off puts the black pill back at once. The Mac's default gets much the same from its material: in the Liquid Glass style the folded pill is glass, which follows the Mac's appearance and takes on what is behind it. Windows has no such material, so this reads the screen instead. It can be dropped without touching the previous commit.
|
Thanks @RawJat. The idea is good and the careful parts are genuinely careful — the probe is only sent in the folded branch, the hysteresis and settle delay are sound, and the "beside, not under" reasoning is right and unit-tested. Three things before it can land. Blocker — it wakes 10 times a second, forever, whether or not the feature is on. Blocker — the two new strings aren't translated. Your call needed — it changes the default look. On Smaller: Fix the wake-ups and the strings, and tell me which way you want the default pill, and I'll take it. |
Folded, the notch is a 10 × 79 pill at the screen edge, and it is all Codenotch shows. Since #320 that pill took the Theme's colours: near-white in Light, which vanished against a white page, and black in Dark with a #2e2e2e edge, 1.4:1 against a black wallpaper.
Two commits. The first is a fix. The second is an opt-in that reads the screen, so it is your call, and it can be dropped without touching the first.
1. The folded pill leaves Theme. Black in both appearances, as the Mac's Solid black and Dark glass styles draw it, with a #5c5c5c edge, 3:1 against black. The open notch and the card still follow Theme. CSS only.
2. Appearance → Adaptive pill, off by default. With it on, the pill turns light over a dark backdrop, the way the iPhone's home indicator follows what is under it. The Mac's default gets much the same from its material: in the Liquid Glass style the folded pill is glass (since
a85139e), which follows the Mac's appearance and takes on what is behind it. Windows has no such material, so this reads the screen instead.backdrop.rsreads a thin strip of the screen beside the pill twice a second (GDIBitBlt, no new dependency) and reduces it to one average luminance.Only the pill adapts. The open notch and card are the user's choice through Theme; the pill's only job is to be found.
Test plan
cargo test: 137 pass, 5 new inbackdrop.rs; the ignoredreads_the_screenpasses on a desktop