113 Commits

Author SHA1 Message Date
e07411f9fd
Refactor: Use private instance methods instead of prefixing with _ 2023-01-22 20:35:13 +01:00
cc118d7796
Refactor: Remove empty constructor 2023-01-22 20:27:57 +01:00
596c8d3cdc
Refactor: Setup Drag Source and Drop Targets in UI files 2023-01-22 20:06:02 +01:00
5362629f94
Refactor: Add PrefsBoxOrderListBoxes via UI file a. let them self-init
Add the `PrefsBoxOrderListBox`es to the `PrefsPage` via the
`PrefsPage`es UI file.
Also let the `PrefsBoxOrderListBox`es initialize themselves based on the
given box order.
2023-01-22 19:28:55 +01:00
c54e24c151
Refactor: Add ScrollManager instance to globalThis
Do this so that we don't have to pass the `ScrollManager` instance to
each `PrefsBoxOrderItemRow` instance. This is useful for future
refactors.
2023-01-22 19:28:49 +01:00
34ba8a58cd
Refactor: Add settings to globalThis
Do this so that we don't have to get them in each class individually.
2023-01-22 15:48:35 +01:00
2f9f4d1a3f
Refactor: Use constructor instead of _init 2023-01-22 15:16:56 +01:00
cda099be24
Refactor: Move PrefsPage class into own file (PrefsPage.js) 2023-01-22 15:10:43 +01:00
7ed9329f2d
Refactor: Move UI files and gschema file to more standard locations 2023-01-22 14:59:40 +01:00
ddd0297868
Build: Use gnome-extensions pack for creating extension zip/bundle 2023-01-15 23:35:36 +01:00
d383908d5f
Other: Remove license notice, since its unnecessary and annoying 2023-01-04 23:57:21 +01:00
3299686041
Update: Show drag icon when reordering PrefsBoxOrderItemRows using DND
The following code from GNOME/gnome-control-center was used as a
reference to make this code work:
- ab7d752de9/panels/search/cc-search-panel-row.c (L96)
- ab7d752de9/panels/search/cc-search-panel-row.c (L84)
2022-10-24 01:07:24 +02:00
249f3554d5
Breaking: Make preferences usable again and support Gnome Shell 42
Make the preferences usable again (and look good) by using an
`AdwPreferencesPage` as well as various other libadwaita features (like
`AdwPreferencesGroup`, style classes, ...).
Also get rid of some code, which now doesn't seem to be necessary
anymore (making sure no horizontal scrollbar shows and setting a default
size for the preferences window).

This change is marked as "Breaking", since I assume `AdwPreferencesPage`
doesn't work in Gnome Shell 40 and because I changed the supported Gnome
Shell version to 42 accordingly.
2022-10-23 22:10:36 +02:00
fd66911ff5
Other: Run npm install and npm update 2022-10-22 20:52:18 +02:00
6b4c75ad83
Docs: Add newer, cut down and commented panel.js from Gnome Shell 42.5 2022-10-22 19:14:54 +02:00
91b472c4fe
Docs: Add doc. holding some setup instructions and tips for a GSE Dev VM
Add this document to provide some setup instructions and tips for making
the most of a Gnome Shell Extensions Development VM.
2022-10-22 01:25:11 +02:00
37ece04211
Rename docs/panel.js to include source branch and date
Do this in preparation for the addition of more `panel.js` files from
other branches/tags and dates.
2022-10-21 19:27:59 +02:00
d4af68313f
Other: Bump version to 3 v3 2021-07-05 11:03:15 +02:00
10b491c252
Update: Handle the Dropbox client better
The Dropbox client appends its PID to the id, which gets used for the
application name in `handleAppIndicatorKStatusNotifierItemItem`. This
resulted in the creation of a new entry for the Dropbox client on
basically every Dropbox client start, which would fill up the extensions
settings and would also result in the user effectively not being able to
set the position for the Dropbox client permanently.
This commit fixes these issues by removing the PID (and the hypen before
it) for the Dropbox client application name.
2021-07-05 10:58:10 +02:00
03fb3355b4
Fix: Extension crashing, when no associatedRole can be found
There are situations, where no `associatedRole` for a given
`indicatorContainer` can be found (e.g. the GameMode GNOME Shell
Extension seems to cause such a situation, when you have it enabled and
lock and unlock GNOME).
Previously this would crash the extension. With this fix, those
`indicatorContainer`s just get ignored.
2021-07-05 10:06:51 +02:00
e76b24e813
Feature: Add forget action for top bar items
This forget action removes the top bar item from the top bar order
representation, which is present in the settings, and then saves the top
bar order.
This action is intended for forgetting top bar items, which aren't
present in the top bar anymore, so that the user can clean up their
settings.
So if an item isn't in the top bar at the time of action activation,
activating the action removes it from the saved top bar order. If an
item is in the top bar at the time of action activation, the item
position just gets lost (since it gets automatically re-added to the top
bar order).
2021-07-05 08:41:08 +02:00
309e2c07b9
Refactor: Let PrefsBoxOrderItemRow handle item association
Let `PrefsBoxOrderItemRow` handle the association of itself with an item
itself.
Doing so makes the code cleaner, since the association isn't done
externally anymore.
2021-07-05 07:58:01 +02:00
bd69f816eb
Refactor: Move logic for saving box order to PrefsBoxOrderListBox
Move the logic for saving the box order represented by a
`PrefsBoxOrderListBox` (and its `PrefsBoxOrderItemRows`) to the
`PrefsBoxOrderListBox` class.
This makes the code cleaner and allows for easy reuse of the logic in
the future.
2021-07-05 07:46:08 +02:00
28fb67ad4d
Refactor: Create custom class for prefs box order GtkListBoxes
Create a custom class (`PrefsBoxOrderListBox`) for GtkListBoxes, which
are used in the preferences window for holding box order settings.
Having a custom class for these GtkListBoxes is useful, since it can
hold logic related to box order settings. Future commits will bring more
of this logic into this class.
2021-07-05 07:22:19 +02:00
edfa50f254
Update: Scroll preferences window content on Drag-and-Drop
Scroll the content of the preferences window on Drag-and-Drop, when the
mouse is in the upper or lower part of the content of the preferences
window.
This helps a user, who has e.g. a lot of items, but the preferences
window with a low height, to easily move any item to any position.
2021-07-04 05:16:32 +02:00
a4ea0c630a
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.
2021-07-04 02:20:56 +02:00
8bda3ea0ab
Other: Bump version to 2 v2 2021-06-22 00:03:37 +02:00
689a8107e2
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.
2021-06-22 00:00:04 +02:00
0eee0e8ef9
Other: Wrap comments longer than 80 characters at 80 characters 2021-06-21 21:37:58 +02:00
d4514219ed
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`.
2021-06-21 21:26:26 +02:00
65304a9894
Docs: Add documentation on how to create a new tag 2021-06-21 19:32:45 +02:00
e45d438d61
Other: Add template for message of annotated git tags
Inspired by:
https://drewdevault.com/2021/05/19/How-to-write-release-notes.html
2021-06-21 18:57:40 +02:00
49c46bf33f
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
2021-06-21 18:46:34 +02:00
569fc6a683
Update: Set Panel._originalAddToPanelBox to undefined on disable
Clean up more on disable by setting `Panel._originalAddToPanelBox` to
`undefined`.
v1
2021-06-19 22:47:07 +02:00
cc2098b597
Build: Add script for packaging this extension 2021-06-19 22:26:23 +02:00
aba4d06f73
Other: Ignore gschemas.compiled files, since they're not source code 2021-06-19 22:11:01 +02:00
a7513cc6c2
Docs: Describe what "New" in old commit messages means
Since I apparently used "New" in old commit messages instead of
"Feature", add relevant information to the `CONTRIBUTING.md`.
2021-06-19 21:53:56 +02:00
3431b12c47
Feature: Add repo url to metadata.json 2021-06-19 21:53:08 +02:00
e69997b487
Refactor: Move logic for creation of special box orders into own class
Move the logic for the creation of special box orders
(`createValidBoxOrder` and `createRestrictedValidBoxOrder`) into an own
class.
Moving this logic into an own class makes the `Extension` class lighter.
2021-05-27 06:44:36 +02:00
158a4b584e
Refactor: Move AppIndicator/KStatusNotifierItem logic into an own class
Move the AppIndicator/KStatusNotifierItem logic
(`handleAppIndicatorKStatusNotifierItemItem`, `createResolvedBoxOrder`
and `_applicationRoleMap`) into an own class.
Moving this logic into an own class makes the `Extension` class lighter.

Introduce for the new file a new directory `src/extensionModules`.
2021-05-27 01:25:54 +02:00
1f8305a2f0
Refactor: Move some classes from src/prefs.js into own files
Introduce for these new files a new directory `src/prefsModules`.
2021-05-27 00:17:41 +02:00
b0ebe468aa
Feature: Add initial preferences dialog
Add an initial preferences dialog, which allows the user to easily
reorder the Gnome Shell top bar items.
2021-05-25 00:24:44 +02:00
a3f5ad96f4
Fix: Consider all boxes, when adding items to box orders
Fix the following issues:

1. Let's assume we have a default (reduced) Gnome Shell top bar like
   this:
   - left box: activities, appMenu
   - center box: dateMenu
   - right box: keyboard, aggregateMenu
   And now assume, we changed the (reduced) configured box orders to
   define the top bar like this (while the extension wasn't running for
   this test case):
   - left box: activites, keyboard, appMenu
   - center box: dateMenu
   - right box: aggreateMenu
   Now for the old version of this extension, the following would
   happen:
   The extension would put the "keyboard" into the configured right box
   order on extension start, despite it being already in the configured
   left box order.
   This would happen, because the extension would look at each box
   individually at startup to determine if new items should be added to
   its box order.
   And therefore it would add "keyboard" to the configured right box
   order, leading to the (reduced) corrupted box orders looking like
   this:
   - left box: activites, keyboard, appMenu
   - center box: dateMenu
   - right box: keyboard, aggreateMenu
   And then, since the extension orders the top bar initially on start,
   the extension would put the "keyboard" item into the right box (since
   the right box would get ordered after the left box).
   (And even if the config situation were different, so that the
   originally configured box would have been ordered after the wrongly
   configured box, the configured box orders would have still been
   corrupted.)

   Fix this issue by considering all top bar boxes in
   `_createUpdatedBoxOrder/s`.

2. Let's assume we have the default (reduced) configured box orders like
   this:
   - left box:
   - center box:
   - right box: appindicator-kstatusnotifieritem-KeePassXC
   And now assume, we changed the (reduced) configured box orders to
   define the top bar like this (while the extension and the
   "KStatusNotifierItem/AppIndicator Support" extension weren't running
   for this test case):
   - left box: appindicator-kstatusnotifieritem-KeePassXC
   - center box:
   - right box:
   Now we would first start this extension and then the
   "KStatusNotifierItem/AppIndicator Support" extension.
   For the old version of this extension, the following would happen:
   The extension would have put the KeePassXC
   KStatusNotifierItem/AppIndicator into the configured right box order
   and the right box, leading to the (reduced) corrupted configured box
   orders looking like this:
   - left box: appindicator-kstatusnotifieritem-KeePassXC
   - center box:
   - right box: appindicator-kstatusnotifieritem-KeePassXC
   This would happen, because the logic for the `Panel._addToPanelBox`
   overwrite assumed that the new item should be added to the box the
   item addition initiator requested (even tho the item might be
   configured to go into another box).

   Fix this issue by considering all top bar boxes for the
   `Panel._addToPanelBox` overwrite.

One can see based on those two test cases, how those two issues create
problems.
So fix the issues as explained above and fix them together in this one
commit, since they are related.
2021-05-21 04:15:20 +02:00
4faf976155
Update: Handle permutations of outdated box orders getting saved better 2021-05-17 19:44:00 +02:00
c2c4237bd3
Refactor: Move creation of updated box order into own method
Move the creation of an updated box order into an own method, so that
this method can be used elsewhere in the future to easily get an updated
box order.
2021-05-17 19:37:05 +02:00
c55b9e2648
Feature: Make it possible to move items to other top bar boxes 2021-05-17 18:09:06 +02:00
b938d7a28f
Other: Introduce ESLint for code linting 2021-05-17 17:45:22 +02:00
0c845336e6
Other: License this project
License this project under the GNU General Public License version 3.
2021-05-17 14:37:57 +02:00
0b7a15e55c
Breaking: Handle AppIndicator/KStatusNotifierItem items better
Handle AppIndicator/KStatusNotifierItem items differently (and better)
for the following reasons:
- These items have a role, which isn't very helpful for identifying the
  associated application.
- These roles seem to be different for each application run.
- There can be multiple AppIndicator/KStatusNotifierItem items for the
  same application (multiple instances of that application running).
2021-05-17 13:16:29 +02:00
572c6b69c1
Refactor: Group "private" methods
Group "private" methods to make their purpose clearer.
2021-05-17 11:38:17 +02:00