<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Satiya Ganes on Medium]]></title>
        <description><![CDATA[Stories by Satiya Ganes on Medium]]></description>
        <link>https://medium.com/@satiyaganes.sg?source=rss-2e15685bb358------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*QiUEk4JkpZW34jHQ</url>
            <title>Stories by Satiya Ganes on Medium</title>
            <link>https://medium.com/@satiyaganes.sg?source=rss-2e15685bb358------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 06:52:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@satiyaganes.sg/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I Built a macOS App That Animates Your Desktop as You Close the Lid, Inspired by iPhone Duo]]></title>
            <link>https://medium.com/@satiyaganes.sg/i-built-a-macos-app-that-animates-your-desktop-as-you-close-the-lid-inspired-by-iphone-duo-21f1bef65eb7?source=rss-2e15685bb358------2</link>
            <guid isPermaLink="false">https://medium.com/p/21f1bef65eb7</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[metal]]></category>
            <category><![CDATA[macos]]></category>
            <dc:creator><![CDATA[Satiya Ganes]]></dc:creator>
            <pubDate>Wed, 16 Sep 2026 14:13:40 GMT</pubDate>
            <atom:updated>2026-09-16T14:13:40.703Z</atom:updated>
            <content:encoded><![CDATA[<p>Six Metal-rendered effects, driven by the real lid-angle sensor and your screen never leaves your GPU.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mnVK0qo2xnocSyBgY2dLBA.png" /></figure><p>There is a moment, right when you start closing a MacBook lid, where the desktop just… sits there. Frozen. Oblivious. Then the screen goes black and that is it. I always thought that transition deserved something better something that acknowledged the physical movement of the lid and responded to it in real time.</p><p>That is what MacBook Duo is.</p><p>It is a native Swift menu bar app that captures your desktop the moment you start closing your lid, then renders it as a rigid pane that tilts around the hinge, expands toward you, blurs, dims, and disappears, tracking the exact angle your lid is at. Stop mid-close and the effect holds. Open it back up and everything reverses, sharpening back to your live desktop.</p><p>Landing page: <a href="https://macbookduo.satiyaganes.site/">macbookduo.satiyaganes.site</a> <br>GitHub: <a href="https://github.com/satiyaganes06/Macbook-Duo">github.com/satiyaganes06/Macbook-Duo</a></p><h3>Why this exists</h3><p>I spend a lot of time thinking about how software interacts with hardware. Most of my day job is mobile security runtime protection, threat detection, SDK integration. But outside of that I keep coming back to the same question: why do operating systems ignore so much of the physical context the device is already sensing?</p><p>Your MacBook knows exactly how far open the lid is. Apple silicon models poll that sensor at up to 120 Hz. The OS uses it to switch between displays and manage sleep. That is more or less where the story ends.</p><p>I wanted to see what it felt like to actually use that data for something visible. So I built MacBook Duo.</p><figure><img alt="MacBook Duo macOS app infographic showing how the desktop responds to a closing MacBook lid. Five stages illustrate the process from the lid fully open, through movement detection and real-time visual effects, to the lid fully closed. The infographic also showcases six effects — Duo, Shutter, Iris, Roll, Wave, and Fade — and a pipeline from the lid-angle sensor through progress tracking, filtering, ScreenCaptureKit, Metal rendering, and the overlay window." src="https://cdn-images-1.medium.com/max/1024/1*VoQAvBdiakivIzfQ_TvUmg.png" /></figure><h3>The pipeline, from sensor to screen</h3><p>The whole thing runs roughly like this:</p><pre>Lid sensor (IOKit HID feature report, polled 30–120 Hz)<br>    -&gt; ReferenceAngleTracker   resting angle, re-baseline<br>    -&gt; LidProgressModel        movement beyond dead zone -&gt; progress (ease-out)<br>    -&gt; CriticallyDampedFilter  smooth whole-degree reports, no overshoot<br>    -&gt; EffectCurves            tilt / blur level / brightness<br>ScreenCaptureKit (own process excluded, overlay window sharingType = none)<br>    -&gt; FrameStore              one IOSurface-backed frame, wrapped as a Metal texture<br>    -&gt; FoldRenderer            blur pyramid (4 levels) + projective fold composite<br>    -&gt; OverlayWindow           borderless, click-through, built-in display only</pre><p>The hardest part was not the Metal rendering. It was the sensor layer.</p><p>Apple silicon lid sensors report in whole degrees. That means you get jumps, the angle sits at 45° for a while, then snaps to 44°. If you drive an animation directly off that, it looks terrible. I added a CriticallyDampedFilter that smooths those transitions without introducing lag or overshoot. The spring constants are tuned so the overlay tracks the lid close enough to feel live, but never bounces.</p><p>ReferenceAngleTracker handles calibration. When you first launch the app, it does not know what &quot;fully open&quot; looks like on your specific machine. It watches for the lid to sit still at a consistent angle for about 20 seconds, then uses that as the baseline. Every angle below the baseline becomes progress from 0 to 1. You can also manually re-baseline from the menu bar.</p><p>LidProgressModel sits between the sensor and the effects. It adds a dead zone so tiny vibrations do not arm the overlay, eases the progress curve so the effect accelerates naturally as the lid closes, and is the single source of truth for every renderer.</p><h3>Six effects, one capture</h3><p>The app captures your desktop exactly once per lid-close, on the first degree of movement. That frame lives in GPU memory as a Metal texture and never hits disk. Every style pulls from the same texture.</p><p><strong>Duo</strong> (the default): the desktop tilts around the hinge as a rigid plane, expands slightly toward you via perspective projection, picks up a 4-level blur pyramid as it rotates, dims from 35% to 90% opacity, and ends black. This one took the most iteration. Getting the perspective transform to feel like the lid physically rotating, not a flat image skewing required careful matching between the fold geometry in FoldGeometry.swift and the vertex shader in Shaders.metal. They are documented to be identical on purpose.</p><p><strong>Shutter</strong>: six rigid panels slide down behind each other, with overlapping edges and contact shadows, until the stack settles on the hinge. The shadow work here is purely geometric no lighting model, just offset quads with alpha.</p><p><strong>Iris</strong>: eight dark blades close around the desktop with a 35° twist, bevelled edges, and visible seams between them. The bevel is rendered as a thin inner stroke per blade, which keeps the edges readable even when the blades overlap.</p><p><strong>Roll</strong>: a roller rises from the hinge and the desktop winds onto it like a retracting projector screen, shaded as a cylinder. The cylindrical shading uses a cosine falloff on the texture coordinates as they wrap around the roller radius.</p><p><strong>Accordion</strong>: the desktop folds into horizontal pleats collapsing toward the hinge, with faces alternating light and dark and crease shadows along each fold. This one is the most geometry-heavy; each pleat is a separate quad pair with a shared crease edge.</p><p><strong>Fade</strong>: a plain black veil, no capture needed. This is what runs automatically if you have “Reduce Motion” enabled in Accessibility settings.</p><p>Every style ends black, so the display sleeps on a blank frame rather than a mid-animation snapshot.</p><h3>The state machine</h3><p>EffectEngine manages four states: idle → arming → ready → active.</p><ul><li><strong>idle</strong>: nothing happening, sensor being polled.</li><li><strong>arming</strong>: first degree of lid movement detected. ScreenCaptureKit starts capturing. The overlay is hidden.</li><li><strong>ready</strong>: capture is running and a fresh frame is in FrameStore. Still hidden, waiting for progress to cross the arm threshold.</li><li><strong>active</strong>: overlay is rendering. The effect tracks lid progress in real time.</li></ul><p>Any failure drops straight back to idle and removes the overlay. Sensor timeout, capture permission revoked mid-session, display configuration change, all of these tear the overlay down and restore the desktop immediately. I added a system-wide Emergency Stop shortcut (⌃⌥⌘F) that does the same thing manually, in case the overlay ever gets stuck. It has not happened in normal use, but it felt important to have an escape hatch.</p><h3>Privacy</h3><p>Desktop frames stay on the GPU. Nothing touches disk, nothing goes over the network, nothing is analyzed. The Screen Recording permission is required by macOS for ScreenCaptureKit — there is no way around that — but the app excludes its own process from capture and marks the overlay window with sharingType = none so it does not appear in other screen recordings.</p><h3>What does not work yet</h3><p>Macs without the continuous lid-angle sensor, anything that only exposes an open/closed switch, run in manual mode. The preview works, the effects work, but automatic lid-following is disabled because there is no angle data to follow. Most Intel MacBooks fall into this category. Apple silicon MacBooks have the sensor.</p><p>The signing situation for local builds is a bit annoying. macOS ties the Screen Recording grant to the app’s code signature, and ad-hoc signing changes the hash on every build, so the grant disappears silently. I wrote a script (scripts/make-signing-identity.sh) that creates a stable local certificate, which fixes this. The README walks through it.</p><h3>How to run it</h3><p>Build from source:</p><p>bash</p><pre>git clone https://github.com/satiyaganes06/Macbook-Duo.git<br>cd Macbook-Duo<br>scripts/build-app.sh<br>open &quot;build/MacBook Duo.app&quot;</pre><p>Or grab the .dmg directly from the landing page: <a href="https://macbookduo.satiyaganes.site/">macbookduo.satiyaganes.site</a></p><p>If you want to package a drag-to-install disk image:</p><p>bas</p><pre>scripts/build-dmg.sh</pre><p>The app sits in the menu bar. The menu shows the live lid angle, the resting angle it calibrated against, and the current state. Pick your effect, hit “Preview Effect” to see the full arc without closing your lid, and turn it off any time with the “Enabled” toggle.</p><h3>The parts I found interesting to build</h3><p>The blur pyramid was more involved than I expected. A single-pass Gaussian blur at high pixel counts is slow. The FoldRenderer uses a 4-level pyramid instead: downsample the texture three times, blur each level, then composite them. The blur gets progressively heavier at lower resolutions and progressively lighter as the lid opens back up. At rest — lid fully open — the overlay is completely hidden, so there is no cost at all.</p><p>The reference tracking calibration was also worth thinking through carefully. The naive version is: record the angle when the app launches and call that the resting position. That breaks the moment you prop your laptop at a different angle. The ReferenceAngleTracker watches for the lid to hold a stable angle for 20 seconds and re-baselines automatically. It does this silently, without interrupting the effect. You can also force it from the menu if you want to calibrate immediately after repositioning.</p><h3>Open source</h3><p>The fold geometry is documented in Sources/DuoCore/Model/FoldGeometry.swift and mirrored one-to-one in foldVertex in Shaders.metal, so if you want to add a new effect style, the two files are the things to change. The state machine, sensor layer, and capture pipeline are all separate from the renderer by design, so a new style is just a new renderer that receives the same progress value everything else gets.</p><p>If you build something with it or fork it in a direction I have not thought of, I would be curious to hear about it.</p><p><a href="https://macbookduo.satiyaganes.site/">macbookduo.satiyaganes.site</a> · <a href="https://github.com/satiyaganes06/Macbook-Duo">github.com/satiyaganes06/Macbook-Duo</a></p><p><em>Built by Shatthiya Ganes — Mobile Security Engineer by day, open source tinkerer otherwise. Find me on </em><a href="https://www.linkedin.com/in/satiya-ganes-b0a315209"><em>LinkedIn</em></a><em> or </em><a href="https://github.com/satiyaganes06"><em>GitHub</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21f1bef65eb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[  ,   ?]]></title>
            <link>https://medium.com/@satiyaganes.sg/-41f93b6583d6?source=rss-2e15685bb358------2</link>
            <guid isPermaLink="false">https://medium.com/p/41f93b6583d6</guid>
            <category><![CDATA[app-security-hardening]]></category>
            <category><![CDATA[cross-platform-mobile-app]]></category>
            <category><![CDATA[mobile-security-android]]></category>
            <category><![CDATA[flutter-vs-native]]></category>
            <dc:creator><![CDATA[Satiya Ganes]]></dc:creator>
            <pubDate>Wed, 05 Aug 2026 15:36:00 GMT</pubDate>
            <atom:updated>2026-08-05T15:36:00.582Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqlKzphxXEqjhPh9dTCQaQ.gif" /></figure><p>Wrong question.</p><p>I’ve shipped Flutter apps to 20,000+ university users, integrated a mobile security SDK into a banking app with 20M+ active users, and done mobile testing on both platforms.</p><p>Here’s what I actually think:</p><p>𝑭𝒍𝒖𝒕𝒕𝒆𝒓 𝒘𝒊𝒏𝒔 𝒘𝒉𝒆𝒏:<br>• You have one team, two platforms, and a deadline<br>• Business logic is complex but UI is standard<br>• You need a single codebase your team can actually maintain<br>• Speed to market matters more than pixel-perfect native behavior</p><p>𝑵𝒂𝒕𝒊𝒗𝒆 𝒘𝒊𝒏𝒔 𝒘𝒉𝒆𝒏:<br>• You need deep OS-level access (security SDKs, runtime protection)<br>• Platform-specific UX is non-negotiable<br>• You’re building system-level integrations</p><p>𝐍𝐨𝐰 𝐭𝐡𝐞 𝐬𝐞𝐜𝐮𝐫𝐢𝐭𝐲 𝐚𝐧𝐠𝐥𝐞, 𝐛𝐞𝐜𝐚𝐮𝐬𝐞 𝐭𝐡𝐢𝐬 𝐜𝐨𝐦𝐞𝐬 𝐮𝐩 𝐚 𝐥𝐨𝐭.<br>A client once asked me: “𝘚𝘩𝘰𝘶𝘭𝘥 𝘸𝘦 𝘴𝘸𝘪𝘵𝘤𝘩 𝘵𝘰 𝘯𝘢𝘵𝘪𝘷𝘦 𝘪𝘮𝘮𝘦𝘥𝘪𝘢𝘵𝘦𝘭𝘺 𝘫𝘶𝘴𝘵 𝘵𝘰 𝘱𝘳𝘰𝘵𝘦𝘤𝘵 𝘰𝘶𝘳 𝘢𝘱𝘱?”<br>My answer was honest.<br>Neither Flutter nor native is 100% secure. A determined attacker will eventually get in regardless of your stack. The real difference is time.</p><p>If a hacker spends 12 hours breaking a Flutter app, the same attack on a well-hardened native app might take 16 hours to a full day.</p><p>That’s not a reason to rewrite your entire codebase. That’s a reason to invest in proper runtime protection, certificate pinning, and threat detection. This applies regardless of which platform you’re on.</p><p>Security is not a framework decision. It’s an engineering discipline.</p><p>𝐓𝐡𝐞 𝐫𝐞𝐚𝐥 𝐪𝐮𝐞𝐬𝐭𝐢𝐨𝐧 𝐞𝐧𝐠𝐢𝐧𝐞𝐞𝐫𝐬 𝐬𝐡𝐨𝐮𝐥𝐝 𝐚𝐬𝐤:<br>“What are my constraints, and what does this product actually need?”<br>Frameworks are tools. Good engineers match tools to problems, not problems to tools.</p><p>What’s your experience building cross-platform vs. native? Curious where you’ve hit the limits, especially around security.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41f93b6583d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>