├── .gitignore ├── Dockerfile.template ├── LICENSE.md ├── README.md ├── index.html ├── launch_app.sh ├── main.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /Dockerfile.template: -------------------------------------------------------------------------------- 1 | FROM resin/%%RESIN_MACHINE_NAME%%-node:4.0.0 2 | MAINTAINER Craig Mulligan 3 | ENV INITSYSTEM on 4 | 5 | ENV DEBIAN_FRONTEND noninteractive 6 | 7 | # native deps for electron 8 | RUN apt-get update && apt-get install -yq --no-install-recommends \ 9 | xserver-xorg-core \ 10 | xorg \ 11 | libgtk2.0-0 \ 12 | libnotify4 \ 13 | libgconf2-4 \ 14 | libnss3 \ 15 | libasound2 \ 16 | matchbox && \ 17 | apt-get clean && rm -rf /var/lib/apt/lists/* 18 | 19 | 20 | RUN mkdir -p /usr/src/app && ln -s /usr/src/app /app 21 | COPY package.json /usr/src/app/package.json 22 | WORKDIR /usr/src/app 23 | RUN JOBS=MAX npm install --unsafe-perm 24 | 25 | COPY . /usr/src/app 26 | 27 | CMD ["xinit", "/usr/src/app/launch_app.sh", "--kiosk", "--", "-nocursor"] 28 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 GitHub Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Update: This project is no longer maintained - instead use [resin-electronjs](https://github.com/fwrgit/resin-electronjs) 2 | 3 | Our friends at [snappin.io](http://snappin.io/) have their own [boilerplate](https://github.com/fwrgit/resin-electronjs) that is actively maintained and used in production. 4 | 5 | # electron-rpi-quick-start 6 | 7 | This fork of the [electron-quick-start](https://github.com/atom/electron-quick-start) app was made to jumpstart any electron app development on the rasperrypi (or any [resin.io supported device that has screen output](https://resin.io/#supported-devices)). Resin.io allows you to easily deploy and manage your application across a fleet of devices making it a great fit for distributed electron app. You can read more about how resin.io works [here](https://resin.io/how-it-works/) 8 | 9 | ## To Use 10 | 11 | Follow this getting started guide to get your device connected to [resin.io](https://resin.io/) 12 | 13 | Then clone this repository 14 | ``` 15 | git clone https://github.com/resin-io-projects/electron-rpi-quick-start && cd electron-rpi-quick-start 16 | ``` 17 | 18 | Add your resin.io applications remote endpoint 19 | ``` 20 | git remote add resin @git.resin.io:/.git 21 | ``` 22 | 23 | Make sure your device has a screen attached. If you are using the Raspberry Pi 7” Touchscreen Display, follow the instructions [here](http://docs.resin.io/#/pages/hardware/i2c-and-spi.md#raspberry-pi-7-touchscreen-display). 24 | 25 | Finally, push your application to your device. 26 | 27 | ``` 28 | git push resin master 29 | ``` 30 | 31 | You can learn more about each of these components within the [Quick Start Guide](http://electron.atom.io/docs/latest/tutorial/quick-start). 32 | 33 | Learn more about Electron and its API in the [documentation](http://electron.atom.io/docs/latest). 34 | 35 | #### License [MIT](LICENSE.md) 36 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World! 5 | 6 | 7 |

Hello World!

8 | We are using node , 9 | Chrome , 10 | and Electron . 11 | 12 | 13 | -------------------------------------------------------------------------------- /launch_app.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | # Disable DPMS / Screen blanking 4 | xset -dpms 5 | xset s off 6 | xset s noblank 7 | 8 | mkdir /root/.config 9 | sudo matchbox-window-manager -use_cursor no -use_titlebar no & 10 | npm start 11 | sleep 2s -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | var app = require('app'); // Module to control application life. 2 | var BrowserWindow = require('browser-window'); // Module to create native browser window. 3 | 4 | // Report crashes to our server. 5 | require('crash-reporter').start(); 6 | 7 | // Keep a global reference of the window object, if you don't, the window will 8 | // be closed automatically when the JavaScript object is garbage collected. 9 | var mainWindow = null; 10 | 11 | // Quit when all windows are closed. 12 | app.on('window-all-closed', function() { 13 | // On OS X it is common for applications and their menu bar 14 | // to stay active until the user quits explicitly with Cmd + Q 15 | if (process.platform != 'darwin') { 16 | app.quit(); 17 | } 18 | }); 19 | 20 | // This method will be called when Electron has finished 21 | // initialization and is ready to create browser windows. 22 | app.on('ready', function() { 23 | // Create the browser window. 24 | mainWindow = new BrowserWindow({width: 800, height: 600}); 25 | 26 | // and load the index.html of the app. 27 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 28 | 29 | // Open the DevTools. 30 | mainWindow.webContents.openDevTools(); 31 | 32 | // Emitted when the window is closed. 33 | mainWindow.on('closed', function() { 34 | // Dereference the window object, usually you would store windows 35 | // in an array if your app supports multi windows, this is the time 36 | // when you should delete the corresponding element. 37 | mainWindow = null; 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-quick-start", 3 | "version": "1.0.0", 4 | "description": "A minimal Electron application on Raspberry Pi", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "electron main.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/resin-io-projects/electron-rpi-quick-start.git" 12 | }, 13 | "keywords": [ 14 | "Electron", 15 | "quick", 16 | "start", 17 | "tutorial" 18 | ], 19 | "author": "GitHub", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/resin-io-projects/electron-rpi-quick-start/issues" 23 | }, 24 | "homepage": "https://github.com/atom/electron-quick-start#readme", 25 | "devDependencies": { 26 | "electron-prebuilt": "^0.36.10" 27 | }, 28 | "dependencies": { 29 | } 30 | } 31 | --------------------------------------------------------------------------------