Skip to content

Fix app bundle crash, code signing, and add hide-from-dock toggle#3

Open
AsapShadzy wants to merge 1 commit intoHyperNoodlez:mainfrom
AsapShadzy:fix/app-bundle-and-dock-toggle
Open

Fix app bundle crash, code signing, and add hide-from-dock toggle#3
AsapShadzy wants to merge 1 commit intoHyperNoodlez:mainfrom
AsapShadzy:fix/app-bundle-and-dock-toggle

Conversation

@AsapShadzy
Copy link
Copy Markdown

@AsapShadzy AsapShadzy commented Apr 3, 2026

Summary

  • Fix: App crashes when launched from .app bundle / DMG — SwiftPM's auto-generated Bundle.module looks for the resource bundle at the .app root, but macOS code signing doesn't allow files there ("unsealed contents"). Replaced with a custom BundleAccessor.swift that looks in Contents/Resources/, enabling proper code signing and the native macOS icon styling.
  • Fix: Remove manual Dock icon override — The programmatic NSApp.applicationIconImage and DockTile override bypassed macOS's native icon rendering (rounded rectangle). Now CFBundleIconFile handles it natively.
  • Feature: "Hide from Dock on close" toggle — New toggle in General > Startup. When enabled, closing the window hides the app from the Dock while it stays in the menu bar. Re-opening via the menu bar icon restores the Dock icon.
  • Fix: Menu bar icon size — Reduced from 22pt to 18pt to match standard macOS menu bar icon size.

Changes

File What
Package.swift Exclude Resources from SwiftPM auto-bundling
BundleAccessor.swift (new) Custom Bundle.module that finds resources in Contents/Resources/
PhemyNativeApp.swift Remove manual Dock icon, add hide-on-close delegate methods, smaller menu bar icon
GeneralSettingsView.swift Add "Hide from Dock on close" toggle

Test plan

  • Build with ./build-rust.sh && swift build -c release
  • Run scripts/create-dmg.sh — verify the .app bundle has resources in Contents/Resources/ and code signs cleanly
  • Launch from DMG — should not crash
  • Verify Dock icon shows native macOS rounded rectangle styling
  • Toggle "Hide from Dock on close" ON, close window — app should hide from Dock, remain in menu bar
  • Click menu bar icon > "Show Settings" — window and Dock icon should reappear

Note

create-dmg.sh should also be updated to place the resource bundle in Contents/Resources/ instead of the .app root, matching the new BundleAccessor.swift lookup paths.

- Replace SwiftPM auto-generated resource_bundle_accessor with custom
  BundleAccessor.swift that looks in Contents/Resources/, fixing the
  crash when launching from a .app bundle (Bundle.module couldn't find
  PhemyNative_PhemyNative.bundle at the .app root)
- Remove manual Dock tile icon override — let macOS handle icon natively
  via CFBundleIconFile for proper rounded-rectangle styling
- Add "Hide from Dock on close" toggle in General > Startup settings
- Reduce menu bar icon from 22pt to 18pt (standard macOS size)
- Update Package.swift to exclude Resources from SwiftPM bundling
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.

1 participant