mirror of
https://gitlab.gnome.org/julianschacher/top-bar-organizer.git
synced 2025-10-27 15:19:09 +00:00
Compare commits
3 Commits
9a6474b947
...
114e1335d1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
114e1335d1 | ||
|
|
1e87992081 | ||
|
|
5a09b1a2c8 |
@ -215,13 +215,8 @@ export default class BoxOrderManager extends GObject.Object {
|
||||
roles = this.#taskUpUltraLiteItemRoles;
|
||||
}
|
||||
|
||||
// If there are no roles associated, continue.
|
||||
if (roles.length === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Otherwise create a new resolved box order item for each role and
|
||||
// add it to the resolved box order.
|
||||
// Create a new resolved box order item for each role and add it to
|
||||
// the resolved box order.
|
||||
for (const role of roles) {
|
||||
const newResolvedBoxOrderItem = JSON.parse(JSON.stringify(resolvedBoxOrderItem));
|
||||
newResolvedBoxOrderItem.role = role;
|
||||
@ -259,20 +254,15 @@ export default class BoxOrderManager extends GObject.Object {
|
||||
// Get a resolved box order.
|
||||
let resolvedBoxOrder = this.#getResolvedBoxOrder(box);
|
||||
|
||||
// ToDo: simplify.
|
||||
// Get the indicator containers (of the items) currently present in the
|
||||
// GNOME Shell top bar.
|
||||
// They should be St.Bins (see link), so ensure that using a filter.
|
||||
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/48.2/js/ui/panelMenu.js?ref_type=tags#L21
|
||||
const indicatorContainers = [
|
||||
const indicatorContainers = new Set([
|
||||
(Main.panel as CustomPanel)._leftBox.get_children(),
|
||||
(Main.panel as CustomPanel)._centerBox.get_children(),
|
||||
(Main.panel as CustomPanel)._rightBox.get_children(),
|
||||
].flat().filter(ic => ic instanceof St.Bin);
|
||||
|
||||
// Create an indicator containers set from the indicator containers for
|
||||
// fast easy access.
|
||||
const indicatorContainerSet = new Set(indicatorContainers);
|
||||
].flat().filter(ic => ic instanceof St.Bin));
|
||||
|
||||
// Go through the resolved box order and only add items to the valid box
|
||||
// order, where their indicator is currently present in the GNOME Shell
|
||||
@ -285,7 +275,7 @@ export default class BoxOrderManager extends GObject.Object {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (indicatorContainerSet.has(associatedIndicatorContainer)) {
|
||||
if (indicatorContainers.has(associatedIndicatorContainer)) {
|
||||
validBoxOrder.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,9 +28,9 @@ export default class PrefsPage extends Adw.PreferencesPage {
|
||||
}
|
||||
|
||||
_dndEnded?: boolean;
|
||||
_left_box_order_list_box!: PrefsBoxOrderListBox;
|
||||
_center_box_order_list_box!: PrefsBoxOrderListBox;
|
||||
_right_box_order_list_box!: PrefsBoxOrderListBox;
|
||||
declare _left_box_order_list_box: PrefsBoxOrderListBox;
|
||||
declare _center_box_order_list_box: PrefsBoxOrderListBox;
|
||||
declare _right_box_order_list_box: PrefsBoxOrderListBox;
|
||||
|
||||
constructor(params = {}) {
|
||||
super(params);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user