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>
This commit is contained in:
Florian Müllner 2022-08-21 18:29:07 +02:00 committed by Marge Bot
parent e2cd66169b
commit 6050229aa1

View File

@ -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);