[gnome-shell] status/system: "Move" spacer in desktop case



commit 6050229aa1627af73c71f18dc200c48a5cfa959c
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Aug 21 18:29:07 2022 +0200

    status/system: "Move" spacer in desktop case
    
    When we aren't showing the power toggle (read: on systems without
    a battery), all items in the top are located on one side. Address
    this by "moving" the spacer between "Settings" and "Screen Lock"
    in that case to balance items a bit better.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2439>

 js/ui/status/system.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/status/system.js b/js/ui/status/system.js
index 204a78ac34..a45697adb4 100644
--- a/js/ui/status/system.js
+++ b/js/ui/status/system.js
@@ -236,12 +236,22 @@ class SystemItem extends QuickSettingsItem {
         this._powerToggle = new PowerToggle();
         this.child.add_child(this._powerToggle);
 
-        // spacer
-        this.child.add_child(new Clutter.Actor({x_expand: true}));
+        this._laptopSpacer = new Clutter.Actor({x_expand: true});
+        this._powerToggle.bind_property('visible',
+            this._laptopSpacer, 'visible',
+            GObject.BindingFlags.SYNC_CREATE);
+        this.child.add_child(this._laptopSpacer);
 
         const settingsItem = new SettingsItem();
         this.child.add_child(settingsItem);
 
+        this._desktopSpacer = new Clutter.Actor({x_expand: true});
+        this._powerToggle.bind_property('visible',
+            this._desktopSpacer, 'visible',
+            GObject.BindingFlags.INVERT_BOOLEAN |
+            GObject.BindingFlags.SYNC_CREATE);
+        this.child.add_child(this._desktopSpacer);
+
         const lockItem = new LockItem();
         this.child.add_child(lockItem);
 


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