While less featureful than Electron-based apps (no Node and Chromium here),
they are slimmer due to nearly-exclusive use of OS-shipped components.
$ du -hs build/macosx-x86_64-apple-macosx10.13/apps/{Slack,MacPin}.app/
2.0M build/macosx-x86_64-apple-macosx10.13/apps/Slack.app/ (mostly Assets.car icons)
4.0M build/macosx-x86_64-apple-macosx10.13/apps/MacPin.app/ (icons + 1.5MB MacPin.framework)
Uses swift 5.4 & WKWebView.
sites/**/main.js
tries to support some Electron idioms.
- federation of the applet packaging using ES6 modules is being explored
Apps present within a semi-featured Browser UI, having just an "OmniBox" and tab buttons.
MacPin-built apps are normal .app bundles that show in the Dock, App Switcher, & Launchpad.
They are dependent on the core MacPin.app (4.5MB) to be registered on the system, since it contains the MacPin.framework.
Custom URL schemes can also be registered to launch a MacPin App from any other app on your Mac.
Included Apps in the Release
- Facebook.app (mobile version!)
- Messenger.app
- WhatsApp.app
- Twitter.app (mobile version!)
- Slack.app
- Trello.app
- DevDocs.app
- Stack Overflow.app (mobile version!)
Some call these Apps Site-specific Browsers.
"Psuedo-browser" has a better ring to it and MacPin tries to support "normal" browsing behavior,
(address/status bars, middle-click, pop-ups) complementary to any scripts managing the app.
cd ~/src/MacPin
mkdir sites/MySite
$EDITOR sites/MySite/main.js
# find a large & square .png for the app, like an App Store image.
# ideally it should have a transparent back field
cp ~/Pictures/MySite.png sites/MySite/icon.png
make test_MySite
# test, tweak, repeat
make install
open -a MySite.app
Work is ongoing to make editing and creating app scripts easier, without requiring Xcode:CLI tools.
- DRM: Many sites (Spotify, Netflix) are using Chrome/FF only DRMs (Widevine) but Apple-built WebKit only supports FairPlay DRM.
- WebRTC: WebKit is compatible with H264 & VP8 codecs, but Google Chrome is pushing hardware-unaccelerated VP9 on all fronts (incl. general
<video>
).
/*eslint-env es6*/
/*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/
"use strict";
const {app, WebView, BrowserWindow} = require("@MacPin");
const browser = new BrowserWindow();
app.on('AppFinishedLaunching', function() {
browser.tabSelected = new WebView({
url: "http://vine.co",
transparent: true
});
});
Building main
branch requires macOS 11 "Big Sur" with Xcode 12.5+.
All other branches are obsolete & archived for users locked on older macOS (hardware),
but they will recieve no updates.
The UI is fully-programmatic (no NIBs or storyboard) using NSTabViewController APIs to containing tab's WKWebViews.
The AppScriptRuntime that evalutuates main.js
scripts is cobbled together from JavaScriptCore's C and ObjC APIs.
MacPin's UI ClassTypes are bridged to ObjC by SwiftCore and once more into Javascript space using the JSWrapperMap facility in the Apple JSC.
Swift Package Manager and GNU Make are the actual builders of the project, Xcode and xxcodebuild
are not used or supported.
vim Sources/MacPin/*.swift
vim sites/MacPin/main.js
make test.app
# CTRL-D when finished debugging ...
The JavaScript API for *.app/main.js
vaguely mimics Electron's main.js
.
If you want to play with it, run any MacPin app with the -i
argument in Terminal to get a JS console (or make repl
).
Debug builds (make test|test.app|apirepl
) can also be remotely inspected from Safari->Develop->
- Remote Inspection appears broken ATM
Some things I just haven't had need to write, but wouldn't mind having:
- Global history
- Undo/redo for Tab closings
- UI wizard to generate MacPin apps from MacPin.app itself (no Command Line Tools or Xcode!)
- maybe using JavaScript-for-Automation (JXA)?
- ReactNative, Vue/Weex, or NativeScript bindings in main.js for custom Browser UIs
- Electrino: inspiration for the revamp of MacPin's
main.js
- Firefox for iOS: another Swift-based browser for iOS.
- Chrome for iOS*
- yue on Mac & Linux