From 49c46bf33f3ee7b2c3bddfbe3cf641de464b994e Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Mon, 21 Jun 2021 18:46:34 +0200 Subject: [PATCH 001/121] Update: Don't create object as result of `init()` being called Create `this.settings` on enable instead of on init/creation, so that no objects get created as a result of `init()` being called. See here for the relevant review: https://extensions.gnome.org/review/25308 And for the relevant documentation: https://wiki.gnome.org/Projects/GnomeShell/Extensions/Review#Only_use_.60init.28.29.60_for_initialization --- src/extension.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/extension.js b/src/extension.js index 7740169..efacc6d 100644 --- a/src/extension.js +++ b/src/extension.js @@ -30,10 +30,11 @@ const BoxOrderCreator = Me.imports.extensionModules.BoxOrderCreator; class Extension { constructor() { - this.settings = ExtensionUtils.getSettings(); } enable() { + this.settings = ExtensionUtils.getSettings(); + // Create an instance of AppIndicatorKStatusNotifierItemManager to handle AppIndicator/KStatusNotifierItem items. this._appIndicatorKStatusNotifierItemManager = new AppIndicatorKStatusNotifierItemManager.AppIndicatorKStatusNotifierItemManager(); From e45d438d61b3e4e72895eb255e051ea9600bf986 Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Mon, 21 Jun 2021 18:57:40 +0200 Subject: [PATCH 002/121] Other: Add template for message of annotated git tags Inspired by: https://drewdevault.com/2021/05/19/How-to-write-release-notes.html --- git_annotated_tag_template | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 git_annotated_tag_template diff --git a/git_annotated_tag_template b/git_annotated_tag_template new file mode 100644 index 0000000..7ad6f78 --- /dev/null +++ b/git_annotated_tag_template @@ -0,0 +1,13 @@ +Top Bar Organizer v1 includes the following changes: + +# Relevant and/or Breaking Changes + +The following relevant and/or breaking changes of this version: + + + +# `git shortlog` + +The git shortlog for this version: + + From 65304a989470d356f27fe19bcffac5862a34d1aa Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Mon, 21 Jun 2021 19:32:45 +0200 Subject: [PATCH 003/121] Docs: Add documentation on how to create a new tag --- docs/Creating_a_New_Tag.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/Creating_a_New_Tag.md diff --git a/docs/Creating_a_New_Tag.md b/docs/Creating_a_New_Tag.md new file mode 100644 index 0000000..9cfb87d --- /dev/null +++ b/docs/Creating_a_New_Tag.md @@ -0,0 +1,22 @@ +# Creating a New Tag + +To create a new tag, do the following: + +1. Fill out `git_annotated_tag_template`. +2. Run the following command: + + ``` + git tag -a -F git_annotated_tag_template -s --cleanup=verbatim [] + ``` + +3. Restore `git_annotated_tag_template` to its original state: + + ``` + git restore git_annotated_tag_template + ``` + +4. Push the new tag. + + ``` + git push --tags + ``` From d4514219ed42328884bc0f877497b3b85272cc97 Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Mon, 21 Jun 2021 21:26:26 +0200 Subject: [PATCH 004/121] Fix: Use correct child count when ordering right box Previously the `panelBoxChildCount` would just be the child count of the right box before new items got added, which would result in incorrect indices for new child insertions being used (in `panel.insert_child_at_index`), since `panelBoxChildCount` would just account for the current children, not for new ones. This resulted in the following issue: When you used the settings to move an item from e.g. the middle box to the right box, the right box would get ordered incorrectly. So fix this issue by getting the max of the right boxes current children and the `validBoxOrder.length`. --- src/extension.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extension.js b/src/extension.js index efacc6d..a5e1f7e 100644 --- a/src/extension.js +++ b/src/extension.js @@ -430,7 +430,7 @@ class Extension { // This could happen, when the box order gets set to a permutation // of an outdated box order. case "right": - panelBoxChildCount = panelBox.get_children().length; + panelBoxChildCount = Math.max(panelBox.get_children().length, validBoxOrder.length); for (let i = 0; i < validBoxOrder.length; i++) { const role = validBoxOrder[validBoxOrder.length - 1 - i]; // Get the indicator container associated with the current role. From 0eee0e8ef975e2b4b87ffa959f05eb1ef2eebe75 Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Mon, 21 Jun 2021 21:37:58 +0200 Subject: [PATCH 005/121] Other: Wrap comments longer than 80 characters at 80 characters --- src/extension.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/extension.js b/src/extension.js index a5e1f7e..1af0400 100644 --- a/src/extension.js +++ b/src/extension.js @@ -35,7 +35,8 @@ class Extension { enable() { this.settings = ExtensionUtils.getSettings(); - // Create an instance of AppIndicatorKStatusNotifierItemManager to handle AppIndicator/KStatusNotifierItem items. + // Create an instance of AppIndicatorKStatusNotifierItemManager to + // handle AppIndicator/KStatusNotifierItem items. this._appIndicatorKStatusNotifierItemManager = new AppIndicatorKStatusNotifierItemManager.AppIndicatorKStatusNotifierItemManager(); // Create an instance of BoxOrderCreator for the creation of special box @@ -433,7 +434,8 @@ class Extension { panelBoxChildCount = Math.max(panelBox.get_children().length, validBoxOrder.length); for (let i = 0; i < validBoxOrder.length; i++) { const role = validBoxOrder[validBoxOrder.length - 1 - i]; - // Get the indicator container associated with the current role. + // Get the indicator container associated with the current + // role. const associatedIndicatorContainer = Main.panel.statusArea[role].container; associatedIndicatorContainer.get_parent().remove_child(associatedIndicatorContainer); From 689a8107e2b2d04efb61e5acf3d1b677b3bb0c87 Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Tue, 22 Jun 2021 00:00:04 +0200 Subject: [PATCH 006/121] Fix: Fix incorrect ordering There was an issue where, when you started Gnome Shell, the icons weren't corrently ordered. It seems that this issue was caused by a combination of the following two things: 1. When determining the insertion index in `determineInsertionIndex` (in `getPositionAndBoxOverwrite` in `_overwritePanelAddToPanelBox`) the `boxOrder` got set to `boxOrders.something`, which doesn't make much sense considering that the `index` was determined by using `resolvedBoxOrders.something`. So set `boxOrder` to `resolvedBoxOrders.something` instead, to obtain an `insertionIndex`, which makes sense. 2. Ordering the `right` panel box from right to left (in `_orderTopBarItems`) seemed to cause issues (, which are probably caused by the indices not making sense with the children box counts at insertion time). Therefore and also because the regular (left-to-right) ordering seems to work just fine even for the case described in the comment (, which provides the reason for right-to-left ordering,) just use regular ordering for all boxes. Fixing these two things may also fix other incorrect ordering behaviour at other times. --- src/extension.js | 46 +++++++++------------------------------------- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git a/src/extension.js b/src/extension.js index 1af0400..ce8b341 100644 --- a/src/extension.js +++ b/src/extension.js @@ -248,21 +248,21 @@ class Extension { if (indices.left !== -1) { return { - position: determineInsertionIndex(indices.left, this._boxOrderCreator.createRestrictedValidBoxOrder("left"), boxOrders.left), + position: determineInsertionIndex(indices.left, this._boxOrderCreator.createRestrictedValidBoxOrder("left"), resolvedBoxOrders.left), box: "left" }; } if (indices.center !== -1) { return { - position: determineInsertionIndex(indices.center, this._boxOrderCreator.createRestrictedValidBoxOrder("center"), boxOrders.center), + position: determineInsertionIndex(indices.center, this._boxOrderCreator.createRestrictedValidBoxOrder("center"), resolvedBoxOrders.center), box: "center" }; } if (indices.right !== -1) { return { - position: determineInsertionIndex(indices.right, this._boxOrderCreator.createRestrictedValidBoxOrder("right"), boxOrders.right), + position: determineInsertionIndex(indices.right, this._boxOrderCreator.createRestrictedValidBoxOrder("right"), resolvedBoxOrders.right), box: "right" }; } @@ -407,41 +407,13 @@ class Extension { /// Go through the items (or rather their roles) of the validBoxOrder /// and order the panelBox accordingly. - // Declare panelBoxChildCount here, because we might need it later. - let panelBoxChildCount; - switch (box) { - // If the left or center box is the target box, order form left to - // right. - case "left": - case "center": - for (let i = 0; i < validBoxOrder.length; i++) { - const role = validBoxOrder[i]; - // Get the indicator container associated with the current - // role. - const associatedIndicatorContainer = Main.panel.statusArea[role].container; + for (let i = 0; i < validBoxOrder.length; i++) { + const role = validBoxOrder[i]; + // Get the indicator container associated with the current role. + const associatedIndicatorContainer = Main.panel.statusArea[role].container; - associatedIndicatorContainer.get_parent().remove_child(associatedIndicatorContainer); - panelBox.insert_child_at_index(associatedIndicatorContainer, i); - } - break; - // If the right box is the target box, order from right to left. - // The order direction is important for the case, where the box - // order got set to a box order, which doesn't include all the roles - // to cover all items of the respective box. - // This could happen, when the box order gets set to a permutation - // of an outdated box order. - case "right": - panelBoxChildCount = Math.max(panelBox.get_children().length, validBoxOrder.length); - for (let i = 0; i < validBoxOrder.length; i++) { - const role = validBoxOrder[validBoxOrder.length - 1 - i]; - // Get the indicator container associated with the current - // role. - const associatedIndicatorContainer = Main.panel.statusArea[role].container; - - associatedIndicatorContainer.get_parent().remove_child(associatedIndicatorContainer); - panelBox.insert_child_at_index(associatedIndicatorContainer, panelBoxChildCount - 1 -i); - } - break; + associatedIndicatorContainer.get_parent().remove_child(associatedIndicatorContainer); + panelBox.insert_child_at_index(associatedIndicatorContainer, i); } // To handle the case, where the box order got set to a permutation // of an outdated box order, it would be wise, if the caller updated the From 8bda3ea0ab201998ed93577460195141520c47e3 Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Tue, 22 Jun 2021 00:03:37 +0200 Subject: [PATCH 007/121] Other: Bump version to 2 --- src/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/metadata.json b/src/metadata.json index 3c0e438..79dc74c 100644 --- a/src/metadata.json +++ b/src/metadata.json @@ -2,7 +2,7 @@ "uuid": "top-bar-organizer@julian.gse.jsts.xyz", "name": "Top Bar Organizer", "description": "Organize the items of the top (menu)bar.", - "version": 1, + "version": 2, "shell-version": [ "40" ], "settings-schema": "org.gnome.shell.extensions.top-bar-organizer", "url": "https://gitlab.gnome.org/julianschacher/top-bar-organizer" From a4ea0c630ac9cac8a76fdb19ea1d3a02ed4e49aa Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Sun, 4 Jul 2021 02:20:56 +0200 Subject: [PATCH 008/121] Update: Make the preferences window content scrollable Previously it could happen that the preferences window got larger than the height of the screen (e.g. when having a bunch of items and a low vertical screen resolution). Fix this, by making the preferences window content scrollable. Also introduce a nice default window size. --- src/prefs-widget.ui | 124 +++++++++++++++++++++++--------------------- src/prefs.js | 23 +++++++- 2 files changed, 86 insertions(+), 61 deletions(-) diff --git a/src/prefs-widget.ui b/src/prefs-widget.ui index a153981..eaa64e4 100644 --- a/src/prefs-widget.ui +++ b/src/prefs-widget.ui @@ -18,81 +18,85 @@ along with this program. If not, see . --> -