How caldis/mos works
Project type and purpose
• This is a native macOS status‐bar application (Cocoa) that intercepts and smooths scroll events.
• It consists of a core scroll‐processing engine, a collection of UI windows/panels, singleton managers, utilities, localization bundles, build/package scripts, and a small web component for the project website.
File structure
Top-level layers:
• Mos/ – application source
· AppDelegate.swift – app lifecycle entry point
· ScrollCore/ – core smoothing engine
· Managers/ – NSStatusItem, Popover, Window, Desktop controllers
· Popovers/ – status‐item popover UI panels
· Windows/ – the various NSWindow‐based panels (Preferences, Monitor, Welcome)
· Options/ – domain model for user customization (whitelist/blacklist, curves)
· Utils/ – event intercept, logging, helpers
• dmg/ – DMG packaging scripts and assets
• docs/ & website/ – static website for documentation and download links
Key points from the README
• Goal: smooth mouse scrolling, separate touchpad vs. mouse, custom curves, per‐app settings, live charts.
• Dependencies: Charts library for graphical monitor window.
• Delivery via Homebrew Cask or DMG.
A. UI Layer
• Status Bar Item (NSStatusItem) → triggers PopoverManager
• Popovers & Windows
– Main Panel popover (controls on/off, flip direction)
– Preferences Window (tabs for General, Advanced, Exception lists, Updates)
– Monitor Window (live chart of scroll events using Charts framework)
– Welcome/Introduction window
B. Core Processing Layer
• EventMonitor / Interceptor (captures CGEvent taps for scroll events)
• ScrollCore
– ScrollEvent → ScrollFilter → Interpolator → ScrollPoster
– ScrollUtils, ScrollPhase, ScrollCurve config
C. Managers (Singletons)
• PopoverManager (shows/hides popovers)
• WindowManager (opens windows)
• DesktopManager (tracks active applications for white/black‐listing)
D. Options & Storage
• Options.swift + ExceptionalApplication.swift (model)
• Persist user settings (UserDefaults or Archive.swift)
E. Utilities
• Logger, Enhancers, Helpers
F. External Dependencies
• Charts framework (embedded)
G. Deployment/Packaging
• Xcode → Mos.app → create-dmg.command → .dmg
• Homebrew Cask recipe
Relationships and data flows
• User scrolls: OS → CGEventTap (Interceptor) → EventMonitor → ScrollCore pipeline → post back CGEvents → UI Chart (MonitorWindow)
• Changing preferences: PreferencesWindowController → updates Options → persists → informs ScrollCore / Managers
• Packaging: Xcode build → dmg/create-dmg.command → outputs distributable .dmg; Homebrew taps .app to /Applications
Architectural patterns and principles
• Cocoa/MVC: ViewControllers for each window/panel
• Singleton Managers for cross-module coordination
• Separation of concerns: UI vs. core smoothing logic vs. persistence
• Observer pattern: Options changes notify engine & UI
Detail level
• Charts library under “Monitor Window”
• Website/docs as an external system accessed by users for download