From cc6db0a9d4bf1877594f78302418acf95abfab66 Mon Sep 17 00:00:00 2001 From: JezerM Date: Sat, 26 Jun 2021 21:39:22 -0600 Subject: [PATCH] Updated to brightness signal --- themes/gruvbox/js/brightness.js | 3 --- themes/gruvbox/js/debug.js | 10 ++++++++++ themes/gruvbox/js/index.js | 9 +++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/themes/gruvbox/js/brightness.js b/themes/gruvbox/js/brightness.js index 9e86082..b09b546 100644 --- a/themes/gruvbox/js/brightness.js +++ b/themes/gruvbox/js/brightness.js @@ -20,9 +20,6 @@ class Brightness { _setTimer() { if (!lightdm.can_access_brightness) return this._updateData() - setInterval(() => { - this._updateData() - }, 1000) // Every second } diff --git a/themes/gruvbox/js/debug.js b/themes/gruvbox/js/debug.js index 3305f47..cf49329 100644 --- a/themes/gruvbox/js/debug.js +++ b/themes/gruvbox/js/debug.js @@ -12,6 +12,12 @@ class Debug { return false } + window.greeter_config = { + greeter: { + debug_mode: true, + } + } + window.lightdm = { is_authenticated: false, authentication_user: null, @@ -85,15 +91,19 @@ class Debug { }, shutdown: () => { console.log("System is shutting down...") + setTimeout(() => location.reload(), 2000) }, restart: () => { console.log("System is rebooting...") + setTimeout(() => location.reload(), 2000) }, hibernate: () => { console.log("System is hibernating") + setTimeout(() => location.reload(), 2000) }, suspend: () => { console.log("System is suspending") + setTimeout(() => location.reload(), 2000) }, batteryData: { name: "Battery 0", diff --git a/themes/gruvbox/js/index.js b/themes/gruvbox/js/index.js index 65f49f9..01c9107 100644 --- a/themes/gruvbox/js/index.js +++ b/themes/gruvbox/js/index.js @@ -19,12 +19,17 @@ async function wait(ms) { } async function initGreeter() { + + if (greeter_config.greeter.debug_mode) { + debug = new Debug() + } + if (lightdm.authentication_complete) { lightdm.authentication_complete.connect(() => authentication_done()) } - if (greeter_config.greeter.debug_mode) { - debug = new Debug() + if (lightdm.brightness_update) { + lightdm.brightness_update.connect(() => brightness._updateData()) } accounts = new Accounts()