WinDuo

Close your laptop and the screen leans away, blurring and dimming, the way an iPhone Duo does as it folds shut.

Apple has a hinge to read. Mac Duo has the MacBook's lid angle sensor. Your laptop has neither, so WinDuo watches the webcam instead.

Windows 10 version 2004 or later. Apache 2.0. No account, no telemetry.

Drag to close the lid

Notes on the hinge

The camera is bolted into the lid. When the lid turns, the camera turns with it, about the same axis, by the same amount.

So closing the lid slides the whole image straight down the frame, and the top of the view leaves through the edge. That slide is the measurement.

Roughly fifteen pixels per degree, on an ordinary webcam. So there is far more signal here than the effect needs.

Adding those shifts up would drift, so nothing tries to. Rest becomes zero, and travel is measured from there.

Sharp at the hinge, soft at the far edge. Exactly what the shader does, in about forty lines.

Or just scroll. The page does the same thing the app does.

Three devices, one effect, one missing sensor

Apple built the fold transition for a phone with a hinge it can measure. The port to MacBooks read the lid angle sensor. Windows laptops do not have one, and that is the whole problem worth solving.

  1. iPhone Duo. Apple's first folding iPhone. As it opens and closes, the interface blurs and stretches under perspective between the two displays, so the change in shape reads as continuous instead of a hard cut. It tracks the hinge the whole way, in both directions.
  2. Mac Duo. Within days, an open-source Mac app put the same effect on MacBook lids, driven by the lid angle sensor Apple has shipped since the 2019 16-inch MacBook Pro.
  3. WinDuo. This one. The same effect on Windows, and the first version that needs no angle sensor at all.

No sensor to read, so it watches instead

Mac Duo reads a hinge angle sensor over HID. Almost nothing outside recent MacBooks has that sensor, and there is no software way to add one.

A hinge is a single axis, though, and the camera sits on the far side of it. Rotating the lid rotates the camera by the same amount, with no panning and no rolling. Pitch alone moves the whole image vertically, so the quantity to recover is one number per frame: how far the picture slid.

Phase correlation on a pair of downscaled grey frames finds it in about two hundred microseconds, and there is plenty of signal to find.

The lid closes, the camera pitches down, and the scene rises out of the top of the frame. That distance is the whole measurement.

Zero is wherever the lid last stopped

Adding up per-frame shifts drifts. So nothing here ever tries to know the real angle. When the lid holds still, that position becomes zero, and the effect runs on travel away from it.

Error then only accumulates for the length of one lid movement, a second or two, and a fresh rest wipes it out. Which is also why it does not care whether the laptop is on a desk, on your lap, or held at some angle you would never call normal.

It removes a whole subsystem, too. Mac Duo needs a timeout setting to end the effect when you stop the lid partway and leave it there, because an absolute angle below the threshold stays below it forever. Here a stopped lid becomes the new zero, travel collapses on its own, and the picture eases back to flat without anything having to notice.

Twenty seconds of calibration

The camera measures pixels. Turning pixels into degrees needs one known angle, and no amount of image processing supplies that, so WinDuo asks for it once.

  1. Your normal viewing position

    Drag a silhouette until it matches the lid in front of you. Eyeballing it against a door frame is close enough; a few degrees out is invisible in the result.

  2. Roughly halfway down

    One anchor in the middle fits the second-order term. Shift per degree grows toward the edges of the frame, because the projection is a tangent rather than a ratio.

  3. Closed

    Windows' own lid switch says exactly when you get there, which gives a known zero for free. If the machine does not report one, the camera going dark against the keyboard does the same job.

The camera also swings on an arc about twenty centimetres from the hinge, so a degree of closing shifts it roughly three and a half millimetres sideways. Against a wall a metre away that parallax adds about a fifth to the apparent movement; at three metres, about a sixteenth. The error depends on how far away your room is, which is why the wizard asks you to sit where you normally sit rather than to measure anything.

What it will not do

Measuring rotation from a camera has failure cases, and hiding them would only mean you found them yourself, later.

The camera indicator stays lit
It has to. The baseline has to exist before the lid starts moving. Each frame is compared with the one before it and discarded; nothing is recorded and nothing leaves the machine.
Another app can take the camera
A call in Zoom or Teams claims it exclusively, and WinDuo then cannot read the lid. It says so in the tray rather than failing quietly.
Picking the laptop up can trigger it
Rotating the whole machine looks the same as closing the lid to anything measuring the frame as a whole. Both halves of the image have to move together for a reading to be trusted, which catches the common cases. Using a laptop on a train is not one of them.
A dark room costs accuracy
Exposure is forced short, because a lid closing at 180° per second covers six degrees inside one frame and ordinary indoor exposure smears that across eighty pixels. Short shutter in a dim room is a noisy image, and below a usable threshold the effect stays off rather than guessing.
Windows, and the primary display
Keeping the overlay out of its own capture needs an API that arrived in Windows 10 version 2004, and it has no portable equivalent. A Linux port is written up as a starting point; the angle estimation carries over unchanged.
The screen goes off when the lid shuts
So the effect only ever plays during the closing travel. That is the part worth watching, and it means no power settings need changing.

Try it on your own screen

It lives in the notification area and has no main window. Run it once and close the lid.

pip install git+https://github.com/BaselAshraf81/winduo
python -m winduo

The calibration wizard opens the first time. About twenty seconds, and then it lives in the notification area.

No camera and no lid to hand? python -m winduo --preview plays the effect once on whatever is on screen.