From 47f29626b6b6e5b726613805a2234909e3c69beb Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Fri, 28 Jun 2019 12:42:50 +0200 Subject: [PATCH] Sleep button on main screen for etcher-pro Change-type: patch --- lib/gui/app/app.js | 26 ++++++++++++++++++++++++++ lib/gui/app/index.html | 20 +++++++++++++++++--- lib/gui/app/modules/screensaver.ts | 2 +- lib/gui/app/scss/main.scss | 16 ++++++++++++++++ lib/gui/assets/moon.svg | 3 +++ lib/gui/css/main.css | 13 +++++++++++++ 6 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 lib/gui/assets/moon.svg diff --git a/lib/gui/app/app.js b/lib/gui/app/app.js index 235e7d9c..fb449e4c 100644 --- a/lib/gui/app/app.js +++ b/lib/gui/app/app.js @@ -456,6 +456,32 @@ app.controller('HeaderController', function (OSOpenExternalService) { this.shouldShowHelp = () => { return !settings.get('disableExternalLinks') } + + /** + * @summary Whether to show the sleep button + * @function + * @public + * + * @returns {Boolean} + * + * @example + * HeaderController.shouldShowSleep() + */ + this.shouldShowSleep = () => { + return settings.get('showScreensaverDelay') + } + + /** + * @summary Enables the screensaver + * @function + * @public + * + * @example + * HeaderController.sleep() + */ + this.sleep = () => { + screensaver.off() + } }) app.controller('StateController', function ($rootScope, $scope) { diff --git a/lib/gui/app/index.html b/lib/gui/app/index.html index 89ab9b73..d28d6aae 100644 --- a/lib/gui/app/index.html +++ b/lib/gui/app/index.html @@ -11,22 +11,36 @@
+ +