[gnome-shell] status/brightness: Hide when proxy has no owner



commit 87e4eda46db625eba4388aaea9d6503ec518b594
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Jul 30 14:34:12 2022 +0200

    status/brightness: Hide when proxy has no owner
    
    Properties are null while a proxy has no owner. Javascript helpfully
    coerces that into `Number(null)` (a.k.a. 0), so we end up with a
    broken slider.
    
    Explicitly check that the value is an integer before doing the
    comparison to catch that case.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>

 js/ui/status/brightness.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/status/brightness.js b/js/ui/status/brightness.js
index aa60206603..61258bd59e 100644
--- a/js/ui/status/brightness.js
+++ b/js/ui/status/brightness.js
@@ -67,7 +67,8 @@ class Indicator extends PanelMenu.SystemIndicator {
     }
 
     _sync() {
-        let visible = this._proxy.Brightness >= 0;
+        const brightness = this._proxy.Brightness;
+        const visible = Number.isInteger(brightness) && brightness >= 0;
         this._item.visible = visible;
         if (visible)
             this._changeSlider(this._proxy.Brightness / 100.0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]