From 921557161d277eb568a21a1a07152a5d89c287de Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Wed, 27 Jul 2016 12:50:59 +0200 Subject: [PATCH] Add option to enable kios mode --- README.md | 16 ++++++++-------- js/defaults.js | 3 ++- js/electron.js | 6 +++++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e1cf7e8c..75bd50d6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Known Vulnerabilities

-**MagicMirror²** is an open source modular smart mirror platform. With a growing list of installable modules, the **MagicMirror²** allows you to convert your hallway or bathroom mirror into your personal assistant. **MagicMirror²** is built by the creator of [the original MagicMirror](http://michaelteeuw.nl/tagged/magicmirror) with the incredible help of a [growing community of contributors](https://github.com/MichMich/MagicMirror/graphs/contributors). +**MagicMirror²** is an open source modular smart mirror platform. With a growing list of installable modules, the **MagicMirror²** allows you to convert your hallway or bathroom mirror into your personal assistant. **MagicMirror²** is built by the creator of [the original MagicMirror](http://michaelteeuw.nl/tagged/magicmirror) with the incredible help of a [growing community of contributors](https://github.com/MichMich/MagicMirror/graphs/contributors). MagicMirror² focuses on a modular plugin system and uses [Electron](http://electron.atom.io/) as an application wrapper. So no more web server or browser installs necessary! @@ -22,7 +22,7 @@ MagicMirror² focuses on a modular plugin system and uses [Electron](http://elec - [community](#community) - [Contributing Guidelines](#contributing-guidelines) -## Usage +## Usage #### Raspberry Pi Support Electron, the app wrapper around MagicMirror², only supports the Raspberry Pi 2 & 3. The Raspberry Pi 1 is currently **not** supported. If you want to run this on a Raspberry Pi 1, use the [server only](#server-only) feature and setup a fullscreen browser yourself. @@ -59,9 +59,9 @@ If you want to update your MagicMirror² to the latest version, use your termina ```` git pull -```` +```` -If you changed nothing more than the config or the modules, this should work without any problems. +If you changed nothing more than the config or the modules, this should work without any problems. Type `git status` to see your changes, if there are any, you can reset them with `git reset --hard`. After that, git pull should be possible. ## Configuration @@ -75,6 +75,7 @@ The following properties can be configured: | **Option** | **Description** | | --- | --- | | `port` | The port on which the MagicMirror² server will run on. The default value is `8080`. | +| `kioskmode` | This allows MagicMirror² to run in Kiosk Mode. It protects from other programs popping on top of your screen. The default value is `false`| | `language` | The language of the interface. (Note: Not all elements will be localized.) Possible values are `en`, `nl`, `ru`, `fr`, etc., but the default value is `en`. | | `timeFormat` | The form of time notation that will be used. Possible values are `12` or `24`. The default is `24`. | | `units` | The units that will be used in the default weather modules. Possible values are `metric` or `imperial`. The default is `metric`. | @@ -108,7 +109,7 @@ For more available modules, check out out the wiki page: [MagicMirror² Modules] ## Known issues - Electron seems to have some issues on certain Raspberry Pi 2's. See [#145](https://github.com/MichMich/MagicMirror/issues/145). -- MagicMirror² (Electron) sometimes quits without an error after an extended period of use. See [#150](https://github.com/MichMich/MagicMirror/issues/150). +- MagicMirror² (Electron) sometimes quits without an error after an extended period of use. See [#150](https://github.com/MichMich/MagicMirror/issues/150). ## Community @@ -120,10 +121,9 @@ Contributions of all kinds are welcome, not only in the form of code but also wi Please keep the following in mind: -- **Bug Reports**: Make sure you're running the latest version. If the issue(s) still persist: please open a clearly documented issue with a clear title. +- **Bug Reports**: Make sure you're running the latest version. If the issue(s) still persist: please open a clearly documented issue with a clear title. - **Minor Bug Fixes**: Please send a pull request with a clear explanation of the issue or a link to the issue it solves. - **Major Bug Fixes**: please discuss your approach in an GitHub issue before you start to alter a big part of the code. - **New Features**: please please discuss in a GitHub issue before you start to alter a big part of the code. Without discussion upfront, the pull request will not be accepted / merged. -Thanks for your help in making MagicMirror² better! - +Thanks for your help in making MagicMirror² better! diff --git a/js/defaults.js b/js/defaults.js index 1d81252c..0688595c 100644 --- a/js/defaults.js +++ b/js/defaults.js @@ -9,11 +9,12 @@ var defaults = { port: 8080, + kioskmode: false, language: "en", timeFormat: 24, units: "metric", - + modules: [ { module: "helloworld", diff --git a/js/electron.js b/js/electron.js index ce3efa88..1631deae 100644 --- a/js/electron.js +++ b/js/electron.js @@ -17,7 +17,11 @@ let mainWindow; function createWindow() { // Create the browser window. - mainWindow = new BrowserWindow({width: 800, height: 600, fullscreen: true, autoHideMenuBar: true, darkTheme: true, webPreferences: {nodeIntegration: false}}); + if (config.kioskmode) { + mainWindow = new BrowserWindow({width: 800, height: 600, x: 0, y: 0, kiosk:true, darkTheme: true, webPreferences: {nodeIntegration: false}}); + } else { + mainWindow = new BrowserWindow({width: 800, height: 600, x: 0, y: 0, fullscreen: true, autoHideMenuBar: true, darkTheme: true, webPreferences: {nodeIntegration: false}}); + } // and load the index.html of the app. //mainWindow.loadURL('file://' + __dirname + '../../index.html');