From 6050229aa1627af73c71f18dc200c48a5cfa959c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 21 Aug 2022 18:29:07 +0200 Subject: [PATCH] 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: --- 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 204a78ac3..a45697adb 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);