How hruiccc/ruic-foldscreen works
RuiC-FoldScreen is a local macOS menu-bar app that bends the built-in display as the lid closes. Its main workflow reads lid angle, converts and smooths it into fold parameters, captures desktop frames, renders the perspective/blur effect, and presents it in an overlay; settings also provide presets, tuning, and a permission-free preview. The README documents reconnect and pause behavior plus CLI diagnostics. Wiring for unsampled UI and overlay internals is represented only where documented; optional scripted input is kept separate.
Main entry points: LiveFold.swift Live coordinator · FoldRenderer.swift Metal renderer · SettingsView.swift Settings window · FoldPreview.swift Fold preview
Components 20
App control
- App entry
Sources/FoldScreen/main.swift - Live coordinator
Sources/FoldScreen/Core/LiveFold.swift - System integration
Sources/FoldScreen/Support/SystemIntegration.swift - CLI diagnostics
Sources/FoldScreen/Support/Harness.swift
Angle and capture
- Lid angle source
Sources/FoldScreen/Core/LidAngle.swift - Scripted lid
Sources/FoldScreen/Core/LidAngle.swift - Desktop capture
Sources/FoldScreen/Capture/DesktopMirror.swift
Fold rendering
- Fold settings
Sources/FoldScreen/Core/FoldSettings.swift - Fold kinematics
Sources/FoldScreen/Core/FoldKinematics.swift - Frame handoff
Sources/FoldScreen/Render/FoldRenderer.swift - Metal renderer
Sources/FoldScreen/Render/FoldRenderer.swift - Fold shader
Shaders/Fold.metal - Preview artwork
Sources/FoldScreen/Render/PreviewArtwork.swift
User interface
- Screen overlay
Sources/FoldScreen/Render/OverlaySurface.swift - App delegate
Sources/FoldScreen/UI/AppDelegate.swift - Settings window
Sources/FoldScreen/UI/SettingsView.swift - Fold preview
Sources/FoldScreen/UI/FoldPreview.swift
Other components
- Mac user
- HID sensor
- Built-in display
Connections 28
- Mac user → App entry: launches
- App entry → App delegate: starts app
- App delegate → Live coordinator: creates
- App delegate → Settings window: opens
- Live coordinator → Lid angle source: starts and reads
- Lid angle source → HID sensor: reads reports
- Scripted lid → Lid angle source: supplies angles
- Live coordinator → Fold kinematics: computes closure
- Live coordinator → Fold settings: uses tuning
- Live coordinator → Desktop capture: starts and stops
- Desktop capture → Built-in display: captures frames
- Desktop capture → Frame handoff: delivers frames
- Live coordinator → Frame handoff: stores and clears
- Live coordinator → Metal renderer: configures scene
- Metal renderer → Frame handoff: reads latest frame
- Metal renderer → Fold shader: compiles and runs
- Live coordinator → Screen overlay: controls visibility
- Screen overlay → Metal renderer: draws effect
- Settings window → Live coordinator: toggles effect
- Settings window → Fold settings: edits values
- Settings window → Fold preview: hosts preview
- Fold preview → Preview artwork: builds scene
- Fold preview → Metal renderer: renders preview
- Fold preview → Fold kinematics: computes closure
- Live coordinator → System integration: uses hotkey
- App entry → CLI diagnostics: runs diagnostics
- CLI diagnostics → Metal renderer: exports frames
- CLI diagnostics → Lid angle source: checks sensor