From 1189f86c1aa59c489ac19038df9b4147d5869188 Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Thu, 22 Dec 2022 12:40:39 +0100 Subject: [PATCH] Add Suspend/Resume support (#1535) * Add Suspend/Resume support * Support Suspend/Resume/Restart via API, UI and Systray * Support screen lock/unlock scenario * Handle idle scenario * Align with fix for #1368 * Update Windows build * Refactor SuspendHandler to maintain state * Do not start BG-Effect, if system goes into suspend mode * Correct Idle and Resume interaction --- .github/workflows/pull-request.yml | 9 +- .github/workflows/push-master.yml | 9 +- CHANGELOG.md | 11 + assets/webconfig/i18n/en.json | 3 + assets/webconfig/index.html | 33 ++ assets/webconfig/js/hyperion.js | 15 + assets/webconfig/js/settings.js | 15 + include/api/JsonAPI.h | 26 ++ include/hyperion/BGEffectHandler.h | 10 +- include/hyperion/ComponentRegister.h | 24 +- include/hyperion/Hyperion.h | 26 ++ include/hyperion/HyperionIManager.h | 27 +- libsrc/api/JSONRPC_schema/schema-system.json | 20 ++ libsrc/api/JSONRPC_schema/schema.json | 2 +- libsrc/api/JSONRPC_schemas.qrc | 3 +- libsrc/api/JsonAPI.cpp | 63 +++- libsrc/hyperion/ComponentRegister.cpp | 82 +++-- libsrc/hyperion/Hyperion.cpp | 21 +- libsrc/hyperion/HyperionIManager.cpp | 34 +- resources/icons/resume.svg | 1 + resources/icons/suspend.svg | 3 + src/hyperion-remote/JsonConnection.cpp | 72 +++++ src/hyperion-remote/JsonConnection.h | 30 ++ src/hyperion-remote/hyperion-remote.cpp | 50 ++- src/hyperiond/CMakeLists.txt | 13 + src/hyperiond/SuspendHandler.cpp | 312 +++++++++++++++++++ src/hyperiond/SuspendHandler.h | 79 +++++ src/hyperiond/hyperiond.cpp | 5 + src/hyperiond/hyperiond.h | 10 +- src/hyperiond/main.cpp | 17 +- src/hyperiond/systray.cpp | 30 +- src/hyperiond/systray.h | 6 + 32 files changed, 994 insertions(+), 67 deletions(-) create mode 100644 libsrc/api/JSONRPC_schema/schema-system.json create mode 100644 resources/icons/resume.svg create mode 100644 resources/icons/suspend.svg create mode 100644 src/hyperiond/SuspendHandler.cpp create mode 100644 src/hyperiond/SuspendHandler.h diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 92870ad1..4aab0779 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -150,11 +150,16 @@ jobs: with: path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey key: ${{ runner.os }}-chocolatey + +# - name: Install Python +# shell: powershell +# run: | +# choco install --no-progress python -y - - name: Install Python, OpenSSL, DirectX SDK + - name: Install OpenSSL, DirectX SDK shell: powershell run: | - choco install --no-progress python openssl directx-sdk -y + choco install --no-progress openssl directx-sdk -y - name: Install libjpeg-turbo run: | diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml index 44d99d7e..78584474 100644 --- a/.github/workflows/push-master.yml +++ b/.github/workflows/push-master.yml @@ -116,10 +116,15 @@ jobs: path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey key: ${{ runner.os }}-chocolatey - - name: Install Python, OpenSSL, DirectX SDK +# - name: Install Python +# shell: powershell +# run: | +# choco install --no-progress python -y + + - name: Install OpenSSL, DirectX SDK shell: powershell run: | - choco install --no-progress python openssl directx-sdk -y + choco install --no-progress openssl directx-sdk -y - name: Install libjpeg-turbo run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c8f8055..71a372a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,10 +10,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Allow to Disable / Enable all instances (#970) by + - Suspend/Resume support for Linux and Windows (#1493,#1282, #978). + Suspend/Resume/Restart is supported via API, UI, Systray and hyperion-remote + - Idle scenario via Screen Locking (Linux/Windows), Screensaver invokation (Linux), hyperion-remote or API + In Idle, all instances, components will be disabled besides the output processing (LED-Devices, smoothing). + The current priorities will be cleared and the background effect per instance will be executed, if enabled. + - Commands toogleSuspend and toggleIdle allow to flip between modes, e.g. might be used to trigger modes by a remote +- Add instance# in API response (#1504) + ### Changed ### Fixed +- Restart correctly, if running as service (#1368) + ## Removed ## [2.0.14](https://github.com/hyperion-project/hyperion.ng/releases/tag/2.0.14) - 2022-11 diff --git a/assets/webconfig/i18n/en.json b/assets/webconfig/i18n/en.json index 1ae5e0e4..bb3453b8 100644 --- a/assets/webconfig/i18n/en.json +++ b/assets/webconfig/i18n/en.json @@ -13,6 +13,9 @@ "infoDialog_password_current_text": "Current password", "infoDialog_password_minimum_length": "Passwords must be minimum 8 characters.", "infoDialog_password_new_text": "New password", + "InfoDialog_systemSuspend_title": "Suspend", + "InfoDialog_systemResume_title": "Resume", + "InfoDialog_systemRestart_title": "Restart", "infoDialog_username_text": "Username", "about_3rd_party_licenses": "3rd party licenses", "about_3rd_party_licenses_error": "We had trouble collecting 3rd party licenses information from web.
Please follow this link to the GitHub Resource.", diff --git a/assets/webconfig/index.html b/assets/webconfig/index.html index 44313cf5..bb1a7d0b 100644 --- a/assets/webconfig/index.html +++ b/assets/webconfig/index.html @@ -213,6 +213,39 @@ + +