Commit Graph

234 Commits

Author SHA1 Message Date
Florian Müllner
f6c74e93b7 window-list: Replace Meta.Rectangle
It's deprecated in favor of Mtk.Rectangle, which is a drop-in
replacement.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/306>
2024-02-22 00:02:40 +00:00
Florian Müllner
f53984670c window-list: Fix menu ornament in workspace indicator
The default ornament is now HIDDEN, so in order to align items,
we always have set an initial ornament.

In gnome-shell 46, the expected "counter ornament" to DOT is NO_DOT
rather than NONE, so use that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/305>
2024-02-21 00:07:15 +01:00
Florian Müllner
b00f5c4604 window-list: Fix window previews
St.Bin no longer expands its child automatically. Unless do we do
explicitly, the preview actor will be allocated with a size of 0x0.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/304>
2024-02-19 19:59:54 +01:00
Florian Müllner
071584621e window-list: Update visibility on window-type changes
The visibility depends on the type, so we should listen for
changes (even if the property is unlikely to change).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/292>
2023-12-01 19:10:08 +01:00
Florian Müllner
5c57f44838 window-list: Don't hide previews on other monitors
Workspace thumbnails are clipped, so there's no major benefit
of hiding the actors explicitly.

On the other hand, the check is useful on size/position changes
to avoid unnecessary relayouts.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/292>
2023-12-01 19:09:30 +01:00
Florian Müllner
93741e9e1c Revert "window-list: Only initialize preview visibility on map"
It is not possible to unmap an actor from within the map vfunc,
so the fix broke the initial visibility again.

This reverts commit 8b7cfff558.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/292>
2023-12-01 19:09:30 +01:00
Florian Müllner
836f81f2e2 window-list: Move additional padding into buttons
Commit ca1c4b0f9e added additional padding, which means that the
interactive area of buttons no longer extends to the bottom of
the screen.

Address this by moving the new padding into the buttons themselves.
That restores the Fittsability of the bottom bar, without affecting
the cleaner visual appearance.

Close https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/453

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/291>
2023-12-01 12:34:20 +00:00
Florian Müllner
574638328e window-list: Clean up stylesheet indent
Replaces tabs with spaces.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/291>
2023-12-01 12:34:20 +00:00
Florian Müllner
d10b98c4fc extensions: Stop using ClutterContainer API
The methods have long been deprecated in favor of the equivalent
ClutterActor methods, so use the latter instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/288>
2023-11-14 16:26:06 +00:00
Florian Müllner
8b7cfff558 window-list: Only initialize preview visibility on map
The check whether the window overlaps with the monitor the actor
is on requires the actor to be added to the stage first, so delay
the initial visibility update that was added in commit f576f1b1b6.

Fixes: f576f1b1 ("window-list: Initialize preview visibility")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/286>
2023-11-08 16:36:59 +00:00
Florian Müllner
91a1b8245b window-list: Remove window picker
Now that the overview is available again in the classic session,
the window picker that used to replace it is unused.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/287>
2023-11-07 17:43:18 +01:00
Florian Müllner
fb858ed0e4 window-list: Complete move to connectObject()
Commit 3bfaf6f88a removed the explicit disconnect, but forgot
to use connectObject() to connect the handler.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/459
Fixes: 3bfaf6f8 ("js: Use connectObject()")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/281>
2023-10-09 15:36:39 +02:00
Florian Müllner
f576f1b1b6 window-list: Initialize preview visibility
Otherwise we can end up showing window previews in the workspace
thumbnail that shouldn't be visible, if none of the properties we
track for updates changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/280>
2023-09-29 21:35:33 +02:00
Florian Müllner
2510bb3625 extensions: Stop using run_dispose()
It is considered bad practice, and mainly a lazy way of disconnecting
signal handlers without tracking individual handler IDs.

We can do better by using connectObject(), which provides the same
level of convenience without the dodginess of getting behind the
garbage collector's back.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/275>
2023-09-26 15:21:41 +00:00
Florian Müllner
b7f285d733 Make project compatible with Reuse Software spec
Provide all licenses used in the project in a LICENSES folder and
add SPDX license and copyright information for all files in
accordance with the Reuse Software[0] specification.

The copyright information is based on the file's git history,
using a fairly generous definition of "non-trivial".

As of the spec recommendation, the information is generally added
as comments in the files themselves, except for

 - NEWS, README and similar top-level standard files, so that
   a SPDX code isn't the first thing people encounter
 - files that don't support comments (json) or where they'd
   be a bit awkward (.desktop, .service)
 - anything under po/, to not interfere with translation teams

Those are covered by a .reuse/dep5 files, except for image assets,
where separate .license files are used (It would be possible to
add comments to SVG files, but I don't trust image editors to
preserve them).

[0] https://reuse.software/

Part-of:
<https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/224>
2023-08-17 11:51:48 +00:00
Florian Müllner
a911447375 js: Port to ESM
The shell pulled the trigger and switched to ESM for all its
imports, follow suit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/269>
2023-08-06 15:59:35 +02:00
Florian Müllner
2d3307c657 window-list: Use InjectionManager instead of custom classes
Once the shell is ported to ESM, it will no longer be possible
to replace entire classes (even when imported). Prepare for that
by overriding methods of the regular WorkspaceBackground class
instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/268>
2023-08-06 13:45:56 +02:00
Florian Müllner
d59bc0b7f0 window-list: Do not inject WindowPicker into Main
This will become impossible once Main is converted to ESM. Instead,
use the Extension class itself to hold the window picker.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/268>
2023-08-06 13:45:56 +02:00
Florian Müllner
f2c73329be extensions: Use new convenience classes
Convenience APIs for extensions are now provided as Extension/Prefs
base classes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/268>
2023-08-05 18:53:41 +02:00
Florian Müllner
e75a1a15ac extensions: Import ExtensionUtils as module
ExtensionUtils has been converted to ESM and split into two modules,
for extensions and prefs respectively.

Adjust to those changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/266>
2023-07-15 14:13:25 +02:00
Florian Müllner
1155170c7c window-list: Stop using getCurrentExtension()
The method is no longer exported. There will be a nicer alternative
soon, in the meantime we can just keep track of our main Extension
object ourselves.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/266>
2023-07-15 14:10:27 +02:00
Florian Müllner
3bfaf6f88a js: Use connectObject()
gnome-shell added (dis)connectObject() methods to partially automate
signal handling. It doesn't only save a significant amount of code,
but also makes it harder to miss cleaning up on destroy.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/263>
2023-07-09 18:45:07 +02:00
Florian Müllner
37baccd9fc window-list: Remove some dead code
The code that connected the signal was removed in 9fa522c29a.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/263>
2023-07-09 18:33:52 +02:00
Florian Müllner
cf007dd472 extensions: Turn extensions into modules
As gnome-shell is moving to ESM, it will now load extensions as
standard modules instead of using legacy imports. The change boils
down to exporting the Extension class as default, but we can also
start using standard imports for introspected modules now, so do
that at the same time.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/259>
2023-07-07 00:35:08 +02:00
Arik W
22b9f888fb window-list: Add tooltip for long window titles
Adds a tooltip feature to the window buttons.
If a button’s label is too long to fit, a tooltip will show the complete content when the user hovers over the button.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/170

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/251>
2023-06-18 19:08:53 +00:00
Florian Müllner
904ead1fb1 window-list: Replace classic- with light style
Now that classic styling is based on color scheme instead of
a dedicated "classic" stylesheet, we should do the same for
extension styling, with the bonus that it also works with the
regular appearance setting outside the classic session.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/254>
2023-05-26 20:26:43 +02:00
Alexander Weichart
ca1c4b0f9e window-list: Improve default stylesheet
Adjust colors to be more consistent with the current shell look.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/253>
2023-05-26 18:25:35 +02:00
robxnano
7e8ba59304 Center-align all menus
Make popup menus center-aligned on their parent buttons, to
match the default GNOME Shell panel menus. Affects:
- Places menu
- Drive menu
- Workspace indicator
- Window menu workspace indicator

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/246>
2023-01-13 16:12:03 +00:00
Florian Müllner
cc72a34973 window-list: Explicitly dispose settings on destroy
This will not only disconnect the signal handler, but also remove
any bindings. This works around a crash that happens if a setting
that triggers the binding changes at the same time as a setting
that rebuilds the window list; in that case, the binding handler
runs after gjs has dropped its wrapper object, but before the
binding is removed automaticalled when the object is finalized.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/416

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/243>
2022-09-30 19:55:44 +02:00
Florian Müllner
563d7770d3 lint: Sync with gnome-shell
gnome-shell started transitioning to gjs' object spacing rule,
i.e. `{foo: 42}` instead of `{ foo: 42 }`.

We have a much smaller code base than the shell and aren't using
a secondary "allowed-but-deprecated" configuration that allows a
gradual transition, so just pull the switch and update to the new
style.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/240>
2022-08-20 19:00:32 +02:00
Florian Müllner
4667b4704d window-list: Open menu on long press
Right-click isn't available on touch, so implement long-press as
an alternative.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/146

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/233>
2022-06-20 14:45:58 +02:00
Florian Müllner
fe60614b41 window-list: Fix primary button action on touch
If a click event was triggered via touch rather than a pointer
device, the button parameter is 0 rather than a mouse button
number.

Account for that to make sure that touch events are not misinterpreted
as right clicks.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/146

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/233>
2022-06-20 14:45:58 +02:00
Jason Lynch
412762ae9d window-list: Set visibility based on the target monitor.
Currently, the visibility of the window list on a given monitor is set
according to the fullscreen status of the primary monitor. When a
fullscreen application is on a secondary monitor (but not on the primary
monitor), entering and exiting the overview will lead to the window list
incorrectly being visible on the monitor with the fullscreen
application.

Instead, determine the visibility based on the fullscreen status of the
monitor being evaluated.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/400

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/230>
2022-05-19 18:31:33 -07:00
Florian Müllner
a51145f9db window-list: Fix cleaning up signal on removal
The map uses windows as key, so trying to remove the handler ID
will leave stray windows/signals.

Spotted by Ron Yorston.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/225>
2022-03-29 17:06:40 +02:00
Florian Müllner
72a9696249 build: Remove unused stylesheets
The only reason for installing empty stylesheets is minimizing
build system differences between extensions. That's not a very
good reason and we don't do this for other optional files like
schemas.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/223>
2022-03-24 00:53:13 +01:00
Florian Müllner
9f673f27ef cleanup: Use static class blocks for gtype registration
gjs enabled support for static class blocks, which gives us a
less error-prone and more readable alternative to _classInit(),
provided we make sure to call registerClass() first.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/215>
2022-02-18 03:34:06 +00:00
Florian Müllner
08db193b31 cleanup: Use regular constructors in GObject subclasses
As a side-effect of supporting class fields, regular constructors
now work in GObject subclasses. Using _init() still works and
there's no functional difference, but it's simply much nicer
to use the same syntax for all classes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/215>
2022-02-18 03:34:06 +00:00
Florian Müllner
69527857f8 window-list: Adapt to Clutter.Grab changes
pushModal() now returns a grab object that has to be passed to
popModal() to release the grab.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/212>
2022-02-10 00:12:22 +01:00
Florian Müllner
e0128a7817 window-list: Use libadwaita for preferences
libadwaita has now become stable and will be part of the GNOME 42
platform. Time to embrace it and get fancier preferences with
less code.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/209>
2022-02-08 19:22:41 +00:00
Florian Müllner
d340922fea window-list: Track window-created/unmanaged
Shell's WindowTracker switched to those signals instead of tracking
windows through MetaWorkspace's window-added/removed signals.

As ::window-created is only emitted after a window has been added to
its workspace, looking up its app on ::window-added now fails because
the window isn't tracked yet.

Address this by switching to the same signals for window tracking
(which is simpler anyway).

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/372

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/207>
2022-01-26 12:33:35 +00:00
Florian Müllner
02e5029eb6 window-list: Fix OSK
The reveal animation moved from Main.layoutManager.keyboardBox to
the keyboard itself, so instead of applying an additional translation
for the bottom panel, we override the translation that would reveal
the keyboard (and thus prevent it from showing altogether).

Fix this by moving our translation to the keyboardBox instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/199>
2021-11-26 20:01:40 +01:00
Florian Müllner
201339345d window-list: Only show at the end of the overview transition
gnome-shell now considers the work area in the overview, so popping
up at the beginning of the overview transition is now more jarring
than at the end.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/185>
2021-08-26 23:36:53 +02:00
Florian Müllner
6ee4205f1e window-list: Fix initial visibility
Mutter uses an undefined initial in-fullscreen state, so it will
always emit the `in-fullscreen-changed` signal when it determines
the actual initial state.

This didn't use to be an issue when the shell started in the session,
but now results in the window list ending up visible in the overview
on startup.

Work around this by hiding ourselves again when the in-fullscreen
state changes in the overview.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/185>
2021-08-26 23:28:44 +02:00
Florian Müllner
cc45bd63ab cleanup: Use new gettext() convenience
gnome-shell now includes convenience helpers for gettext functions that
use an extension's text domain (as initialized by initTranslations()).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/183>
2021-08-14 23:15:56 +02:00
Florian Müllner
1340b209f9 window-list: Simplify radio handling
Instead of handling the active state manually and updating settings
on changes, we can use GActions to leave the nitty-gritty to GTK.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/181>
2021-08-13 05:22:41 +02:00
Florian Müllner
d0b9c9b54a cleanup: Document functions
gjs now enforces this in its eslint configuration. Adding type
information generally is a good idea, so add appropriate comments
to public functions before picking up that configuration change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/180>
2021-08-13 04:48:22 +02:00
Florian Müllner
6284b0c489 window-list: Move functions into base class
The helper functions date back to a time when AppButton and WindowButton
were unconnected classes. But nowadays they share a common base class, so
we have a better place for them than external helper functions.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/180>
2021-08-13 04:39:00 +02:00
Florian Müllner
0d06cc685e extensions: Pick up gettext domain from metadata
Since commit a6ee142f21, the extension archives that are uploaded
to extensions.gnome.org only contain strings that are relevant for
the extension, not all translations from all extensions.

Unfortunately all extensions still share a common gettext domain,
so the extension with the last bind_textdomain() call wins and
leaves the others without translations.

We'll address this by using distinct domains when not installed
system-wide. That becomes easier if there is a canonical place
for the text domain, with the existing metadata key being the
natural choice.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/335

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/179>
2021-08-11 18:42:43 +02:00
Florian Müllner
94b907f46d window-list: Init translations
Whoops, we are missing the bindtextdomain() call, which means translations
won't work when no other extension that shares the same domain is used
(like in GNOME Classic for instance).

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/340

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/174>
2021-07-12 16:04:50 +00:00
Adam Goode
d6648b0b5c window-list: Don't use panel-button class for the workspace indicator
The panel-button introduces some horizontal padding which is insensitive
to scroll events. Without this change, there is a small dead zone in the
corner that cannot be used to switch workspaces with the mouse wheel.

For useMenu mode, this has the effect of removing all of the horizontal
space to the edge of the screen, so I add some back with the
status-label-bin margin.

This a is similar change to 8bad8a3b63.

Fixes #315.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/171>
2021-05-26 11:57:41 +00:00