Giter VIP home page Giter VIP logo

cloudxtreme / macpin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kfix/macpin

0.0 0.0 0.0 8.33 MB

Generate Site Specific Browser apps for Mac OSX using Swift, WKWebView, and ES6-ish Javascript

License: GNU General Public License v3.0

Makefile 4.44% Objective-C 24.32% Shell 0.04% AppleScript 0.75% Swift 39.70% C 6.77% C++ 2.23% Objective-C++ 0.21% JavaScript 20.81% HTML 0.30% CSS 0.43%

macpin's Introduction

MacPin

MacPin creates OSX & [iOS](#iOS) apps for websites & webapps, configured with JavaScript. ![screenie](/dock_screenshot.png?raw=true)

The Browser UI is very minimal, just a toolbar (with site tabs) that disappears in Full-Screen mode.

MacPin apps are shown in OSX's Dock, App Switcher, and Launchpad.

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

OSX 10.11 "El Capitan" or iOS 9 is required.

Included Apps in the Release

Hangouts.app: SMS/IM/Video chat client for the desktop

Google Voice and Project Fi users can make & take phone calls and SMS/MMS messages.
Load up can take up to 30 seconds, so be patient.

New incoming messages are shown in the system's Notification Center,
which you can click on to reply back in the app.

Some optional goodies you can install:

  • [Call Phone with Hangouts](extras/Call Phone with Hangouts.workflow): (OSX) Call text-selected phone numbers from the context menu (right-click)
  • AddressBookHangoutsPlugin: (OSX) click-to-call phone number fields in Contacts and Spotlight

Several browser extensions can also make phone numbers found in webpages clickable.

When receiving a call, Hangouts.app will automatically steal focus so you can quickly answer or reject the call using the keyboard:

  • press Enter or Spacebar to accept the call
  • press Escape or Backspace to decline it

Hooked URLs:

  • sms:
  • tel:
  • hangouts:

Messenger.app: RIP WhatsApp in your Facebook while you Facebook

Digg.app: A replacement for Google Reader

If you are surfing a blog in Safari and want to subscribe to it in your Digg Reader account:

  • click Safari's Sharing button halp
  • click Add to Shared Links
  • click Cancel when asked to add to Shared Links.
  • Digg.app will popup and prompt you to subscribe if Safari found a feed or RSS metatag/mime-type.

You can further streamline this process with any of these extras:

Hooked URLs:

  • feed:
  • rss:

Trello.app: Mind-mapper and project planner

Hooked URLs:

  • [trello:](trello:search for something)

Vine.app: Mobile-layout edition for the desktop

  • shows a single-column stream
  • does not preload any videos
  • makes the controls mouse-friendly

Facebook.app: It knows who your friends are.

  • mobile edition
  • Facebook-in-your-facebook sidebars

Hooked URLs:

  • [facebook:](facebook:search for something)

CloudPebble.app: Use the Interweb to program your Dick Tracy watch.

ERMAHGERD ClerdPehble mah favrit smurtwerch & IDE evar!

DevDocs.app: Code documentaion browser for most front-end frameworks

Hooked URLs:

  • devdocs:

Creating an App

Some call these Apps Site-specific Browsers or Hybrid apps.
They are configured with an imperative JavaScript which you need to copy-paste and customize.

Userscripts can be added to facilitate posting to the Notification Center & recalling webapp locations/state from those posts.

Eventually, I plan to make a UI wizard to generate MacPin apps from MacPin. But for now:

cd ~/src/MacPin
mkdir sites/MySite
cp sites/MacPin/app.js sites/MySite
$EDITOR sites/MySite/app.js

# find a large & square .png for the app, like an App Store image.
cp ~/Pictures/MySite.png sites/MySite/icon.png

make sites/MySite/
open builds/macosx-x86*/apps/MySite.app
# test, tweak, lather, repeat

make install
open -a MySite.app

sample app.js

/*eslint-env applescript*/
/*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/
"use strict";

var delegate = {}; // our delegate to receive events from the webview app

delegate.AppFinishedLaunching = function() {
	$.browser.tabSelected = new $.WebView({
		url: "http://vine.co",
		preinject: ['unpreloader'], // this prevents buffering every video in a feed. If you have a fast Mac and Internet, comment out this line
		postinject: ['styler'],
		agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B411" // mobile version doesnt autoplay on mouseover
	});
};

delegate; //return this to macpin

Hacking MacPin

Its written in Swift using WKWebView and NSTabViewController with a fully programmatic NIB-less UI layout.
You need Xcode installed on OSX to get the Swift compiler and Cocoa headers.
Otherwise $EDITOR and make are your fork and knife.

vim execs/MacPin.swift
vim modules/MacPin/*.swift
make test.app
make only=sim test.ios

Web Inspector can be accessed for any tab by right clicking in the page and selecting "Inspect Element" from the context menu.
Debug builds (make test|test.app|repl) can be remotely inspected from Safari->Develop->

The JavaScript API for app construction is undocumented and non-final.
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).
Safari can also remotely inspect the JSContext of debug builds.

Some browser functionality is currently unimplementable in WKWebKit:

  • File Picker for upload via HTML4 <input type="file"> buttons
    • Workaround: drag files onto the buttons, it works!
  • Status Bar
    • Drag any link some distance to see a URL preview. Force Touch previewing should also work.
    • a JS emulation should be possible to preview any hovered links
  • Printing
    • Coming soon-ish (10.11.4?)
    • Workaround: Tab->Save Web Archive, open in Safari and then Print.

And some things I just haven't had need to write:

  • Global history
  • Undo/redo tabs

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

Safari Technology Preview

The future of MacPin is now! Install Safari Technology Preview first. use make stp & make stp.app to link and run MacPin against STP's WebKit. This makes up-and-coming WKWebView changes (find UI, printing) actually work!

iOS

Basic support has landed for generating iOS apps.
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...

Other WebKit browsers:

macpin's People

Contributors

kfix avatar marcopelegrini avatar swrobel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.