All Projects → kfix → Macpin

kfix / Macpin

Licence: gpl-3.0
a webapp container & site specific browser made from WebKit.swift and JavaScriptCore

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Macpin

Wkwebviewjavascriptbridge
🌉 A Bridge for Sending Messages between Swift and JavaScript in WKWebViews.
Stars: ✭ 863 (+198.62%)
Mutual labels:  wkwebview, webkit
Mybrowser
我的浏览器,基于WKWebView实现的一个iOS浏览器,实现了无图模式、广告拦截、多窗口、扫描二维码、收藏夹/历史、无痕浏览、夜间模式等功能...
Stars: ✭ 127 (-56.06%)
Mutual labels:  wkwebview, webkit
Pywebview
Build GUI for your Python program with JavaScript, HTML, and CSS
Stars: ✭ 2,649 (+816.61%)
Mutual labels:  osx, webkit
mitm-play
Man in the middle using Playwright
Stars: ✭ 13 (-95.5%)
Mutual labels:  webkit
nodejs-system-sleep
Sleep function for Node.js All platforms.
Stars: ✭ 47 (-83.74%)
Mutual labels:  osx
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (+1021.45%)
Mutual labels:  osx
Macdriver
Native Mac APIs for Go
Stars: ✭ 3,582 (+1139.45%)
Mutual labels:  webkit
Popover
Custom macOS Popover 💬
Stars: ✭ 71 (-75.43%)
Mutual labels:  osx
Passepartout Apple
User-friendly OpenVPN client app for iOS and macOS.
Stars: ✭ 284 (-1.73%)
Mutual labels:  osx
Chronos Timetracker
Desktop client for JIRA. Track time, upload worklogs without a hassle.
Stars: ✭ 273 (-5.54%)
Mutual labels:  osx
Ltfinderbuttons
My Finder buttons collection for macOS.
Stars: ✭ 269 (-6.92%)
Mutual labels:  osx
Xdebug Osx
Simple bash script to toggle xdebug on/off in OSX
Stars: ✭ 258 (-10.73%)
Mutual labels:  osx
Mapmap
Open source video mapping software
Stars: ✭ 282 (-2.42%)
Mutual labels:  osx
omnitty
Omnitty: Multiple-Machine SSH Multiplexer
Stars: ✭ 20 (-93.08%)
Mutual labels:  osx
Darklightning
Simply the fastest way to transmit data between iOS/tvOS and OSX
Stars: ✭ 286 (-1.04%)
Mutual labels:  osx
AnyOption
C/C++ Command line and resource file option parsing
Stars: ✭ 83 (-71.28%)
Mutual labels:  osx
Dosxvpn
Easily deploy your own personal VPN server with DNS adblocking running on DigitalOcean
Stars: ✭ 284 (-1.73%)
Mutual labels:  osx
Imessage
💬 Send iMessages from command-line
Stars: ✭ 261 (-9.69%)
Mutual labels:  osx
12306formac
An unofficial 12306 Client for Mac
Stars: ✭ 2,796 (+867.47%)
Mutual labels:  osx
Playwright Go
Playwright for Go a browser automation library to control Chromium, Firefox and WebKit with a single API.
Stars: ✭ 272 (-5.88%)
Mutual labels:  webkit

MacPin

MacPin creates pseudo-browsers managed with internal JavaScripts.

screenie

the GitHub released apps are runnable under macOS 10.14.

While less featureful than Electron (no Node and Chromium here),
they are slim and fast like MacGap, thanks to use of macOS-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)

Project Status

Uses swift 5 & WKWebView. sites/**/main.js tries to support some Electron idioms.

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 (or Springboard on iOS), tabbing 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.

  • future work could create an easy-button "exporter" to vendor the framework

Custom URL schemes can also be registered to launch a MacPin App from any other app on your Mac.

Building swift5.1 branch requires macOS 10.14 "Mojave" with Xcode 11.

All other branches are obsolete & archived for users locked on older macOS (hardware),
but they will recieve no updates.

Included Apps in the Release

Gooblers

FaceHoles

et cetera

  • Slack.app: A hackable runtime for Slack (your co-workers will be thrilled)
  • Trello.app: Mind-mapper and project planner
  • DevDocs.app: Code documentaion browser for most front-end frameworks

Creating an App

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.

App porting issues

  • 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 ).

sample main.js

/*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
	});
});

Hacking MacPin

Its written in Swift using WKWebView and NSTabViewController with a fully programmatic NIB-less UI layout.
The AppScriptRuntime is purely based on 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.
You need Xcode 10 installed on macOS 12.13+ to get the Swift compiler and Cocoa headers.
make & $EDITOR are your hammer and chisel.

vim modules/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|repl) can also be remotely inspected from Safari->Develop->

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

use MacPin to make hybrid apps from existing projects

cd ~/src/SomeWebApp
test -d browser/SomeWebApp.com &&
  make -C ~/src/MacPin macpin_sites=$PWD/browser appdir=$PWD/hybrid xcassetdir=$PWD/hybrid $PWD/hybrid/SomeWebApp.com.app
open hybrid/SomeWebApp.com.app

iOS

Basic support has landed for generating iOS apps.
the iOS port has not been migrated to swift4 yet.
I keep it in the tree because there should be no blocking issues to bring it back up to parity with macOS.
iOS 10 has some PWA support now and macOS 10.15 will ship with UIKit-on-Mac (aka Project Catalyst aka Marzipan) which should accelerate the compile->test dev-cycle and provide a native macOS app.

Anyhow, its kinda pointless for most of sites/* since native apps exist for all of them.
But maybe you want to quickly package a React.js application for offline mobile use...

can i haz LinPin? WinPin?

Ok! A stubby port running /Lin/main.swift + AppScriptRuntime() using a "JSConly" build of JavaScriptCore
would be a good proof of concept for new MacPin platforms to spawn from.

(lol, y u no like V8 google?)

Swift runs on Lin/Win now and so do platform-ports of JavaScriptCore and WebKit, although without supported/prebuilt libs.

However, ObjC bindings for both Swift and the WebKit frameworks are not enabled (or possible?) outside of macOS.
So some additional pure-Swift bindings to the WebKit C/++ APIs will be needed before implementing symmetric platform-classes
And a some refactoring in AppScriptRuntime.swift to totally strip it of ObjC...

Also NSWindow & NSTabViewController aren't cross-platform but could be straightforwardly implement equivalent UIs from MFC or GTK.
Swift bindings to those toolkits would also be needed.

tvPin? No WKWebView on tvOS officially

Other WebKit browsers:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].