GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - kfix/MacPin: a webapp container & site specific browser made from WebKit.swift and JavaScriptCore

BranchesTags
Open more actions menu

Latest commit

 

History

781 Commits
781 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
Sources
Sources
 
 
Tools/iconify
Tools/iconify
 
 
modules
modules
 
 
sites
sites
 
 
templates
templates
 
 
.gitignore
.gitignore
 
 
.zipignore
.zipignore
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 
apple_dev_id.mk
apple_dev_id.mk
 
 
dock_screenshot.png
dock_screenshot.png
 
 
eXcode.mk
eXcode.mk
 
 

Repository files navigation

MacPin

MacPin creates pseudo-browsers managed with internal JavaScripts.

screenie

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)

Project Status

Uses swift 5.7 & 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

selfhosterings

  • Home Assistant.app

Gooblers

  • Google Drive.app
  • Google Photos.app
  • Google Chat.app
  • Google Voice.app
  • Google Maps.app

MetaVerses

  • Facebook.app (mobile version!)
  • Messenger.app
  • WhatsApp.app

et cetera

  • Twitter.app (mobile version!)
  • Slack.app
  • Trello.app
  • DevDocs.app
  • Stack Overflow.app (mobile version!)

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 demo_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 content-streaming sites use "Widevine" DRM but WebKit only support FairPlay DRM.

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

Building main branch requires macOS 13 "Ventura" with Xcode 14+.
Later versions of macOS can build with the Command Line Tools.

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.

basic workflow

vim Sources/MacPin/*.swift
vim sites/MacPin/main.js
make demo.app
# CTRL-D when finished debugging ...

JavaScript environment

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 demo|demo.app|apirepl) can also be remotely inspected from Safari->Develop->

  • Remote Inspection appears broken ATM

TODOs

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

Other WebKit browsers:

  • 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
  • Pake: based on Rust's tauri-wry library

About

a webapp container & site specific browser made from WebKit.swift and JavaScriptCore

Topics

javascriptcoreosxsite-specific-browserssbswiftwebkitwkwebview

Resources

Readme
GPL-3.0 license
Activity

Stars

342 stars

Watchers

5 watching

Forks

27 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.