Skip to content

v2 - Complete Swift rewrite and modernization of the codebase - #102

Open
santoru wants to merge 25 commits into
archagon:masterfrom
santoru:master
Open

v2 - Complete Swift rewrite and modernization of the codebase#102
santoru wants to merge 25 commits into
archagon:masterfrom
santoru:master

Conversation

@santoru

@santoru santoru commented May 14, 2026

Copy link
Copy Markdown

Changelog

2.0.0

Complete Swift rewrite and modernization of the codebase.

Added

  • SwiftUI app lifecycle (@main entry point)
  • Graceful failure handling — if gesture synthesis fails, the button press passes through instead of being swallowed
  • Menu bar icon flash on synthesis failure
  • Periodic Accessibility (TCC) permission monitoring — disables gracefully if permission revoked
  • Global hotkey ⌘⇧B to toggle menu bar icon visibility
  • macOS version check — warns if running on an untested release
  • Event tap re-enable backoff (prevents tight loop if system keeps disabling)
  • Hardened runtime enabled
  • Universal binary (arm64 + x86_64)
  • GitHub Actions CI — automatic build and release on merge to master
  • NSSupportsAutomaticTermination / NSSupportsSuddenTermination lifecycle declarations

Changed

  • Replaced Carbon RegisterEventHotKey with modern NSEvent monitors
  • Menu item state tracking uses tags instead of fragile title-string lookups
  • TCC permission polling interval reduced from 5s to 30s (saves battery)
  • SwipeDirection is now a proper RawRepresentable enum
  • Bundle identifier changed to com.santoru.sensible-side-buttons
  • Copyright updated to 2018–2026

Fixed

  • kAXTrustedCheckOptionPrompt memory leak (takeUnretainedValue instead of takeRetainedValue)

Removed

  • Carbon.HIToolbox dependency

1.x

Original Objective-C implementation by Archagon.

Jason and others added 25 commits December 6, 2017 08:12
…vements

- Add NULL checks in gesture synthesis to prevent crashes on incompatible macOS
- Cache NSUserDefaults in static vars (read on toggle, not every event)
- Graceful fallback: pass events through if synthesis fails instead of swallowing
- Auto re-enable event tap on OS timeout
- Enable hardened runtime with entitlements
- Fix memory leak in SwipeSimulator (remove extra CFRetain)
- Make swipeInfo immutable after initialization
- Set ARCHS=$(ARCHS_STANDARD) for universal binary (arm64+x86_64)
- Add periodic TCC permission check; disable tap gracefully if revoked
New Swift target in SideButtonFixer/Swift/:
- archagon#3: Flash menu bar icon on gesture synthesis failure, pass event through
- archagon#4: Full Swift + SwiftUI port (declarative menu, no manual frame math)
- archagon#5: Menu items accessed by title, not fragile index
- archagon#8: macOS version check at launch, warns on untested releases
- archagon#9: Global hotkey ⌘⇧B to toggle menu bar icon visibility
- archagon#10: No manual layout — SwiftUI handles everything
- archagon#11: Accessibility labels on all menu items
- archagon#13: Donation nag removed entirely

Also: CF_RETURNS_RETAINED annotation on tl_CGEventCreateFromGesture for
proper Swift memory management, updated README with shortcuts table.
New target 'SensibleSideButtonsSwift' in the existing project:
- Sources: Swift/*.swift + External/TouchEvents.c
- Bridging header configured
- Hardened runtime, universal binary (arm64+x86_64)
- Deployment target: macOS 10.13
- build.sh defaults to Swift target now
- Create SideButtonFixer/Swift/Info.plist without NSMainStoryboardFile
  or NSPrincipalClass (conflicts with @main Swift entry point)
- Add HEADER_SEARCH_PATHS = External so bridging header finds TouchEvents.h
- Add GENERATE_INFOPLIST_FILE = NO to prevent Xcode from overriding
- Populate .gitignore (build/, DerivedData/, xcuserdata/, .DS_Store)
- Bump TCC permission check interval to 30s (saves battery)
- Fix kAXTrustedCheckOptionPrompt memory leak (takeUnretainedValue)
- Make SwipeDirection a proper RawRepresentable enum
- Replace Carbon RegisterEventHotKey with NSEvent monitors
- Use menu item tags instead of fragile title-string lookups
- Add event tap re-enable backoff (prevents tight loop)
- Add NSSupportsAutomaticTermination/NSSupportsSuddenTermination
- Update copyright to 2018-2026, credit @santoru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants