Commit Graph

110 Commits

Author SHA1 Message Date
Florian Müllner
537530707e workspace-indicator: Fix menu ornament
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:01:11 +01:00
Florian Müllner
a326fa737e workspace-indicator: 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
30a15387b5 workspace-indicator: 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:14:26 +01:00
Florian Müllner
b5b841dd38 workspace-indicator: 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:13:42 +01:00
Florian Müllner
5f2b199627 Revert "workspace-indicator: 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 25a75e1b0e.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/292>
2023-12-01 19:11:42 +01: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
25a75e1b0e workspace-indicator: 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 b9d2a445b2.

Fixes: b9d2a445 ("workspace-indicator: Initialize preview visibility")
Closes:
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/469

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/286>
2023-11-08 16:36:59 +00:00
Florian Müllner
b9d2a445b2 workspace-indicator: Initialize preview visibility
Otherwise we can end up showing windows 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:33:04 +02: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
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
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
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
Florian Müllner
701b14ecbf extensions: Use extension class for all extensions
This will be the only supported entry point when extension loading
switches to dynamic imports, so prepare for that by wrapping the
remaining standalone enable()/disable() methods in Extension classes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/259>
2023-07-07 00:12:41 +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
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
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
f91275ffd2 workspace-indicator: Bind list to model
Using a model gives us a clear separation between data and representation,
as well as between regular rows and the "new item" row at the end.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/218>
2022-02-18 13:02:17 +01:00
Florian Müllner
f0e46f4b12 workspace-indicator: Change 'update' action to 'rename'
Limiting the action to the row that changed instead of the list as
a whole makes it easier to only update the changed value and not
recreate the entire list.

This doesn't make a difference right now, because we carefully sync
the list to reuse existing rows, but we are about to back the list
with a GListModel instead of updating it manually.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/218>
2022-02-18 12:55:57 +01:00
Florian Müllner
57f7f21ecb workspace-indicator: Bind name to action target
Since we now have an override for bind_properties_full(), we can
use that instead of an explicit notify handler.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/218>
2022-02-18 12:42:07 +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
0be8b10995 cleanup: Simplify action handling
GTK4 has dedicated API for widget-specific actions, make use of that
instead of explicitly managing an action group.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/215>
2022-02-18 03:34:06 +00:00
Florian Müllner
dd3c524c49 prefs: Replace 'content' list style
It's deprecated in favor of 'boxed-list'.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/213>
2022-02-12 02:05:50 +00:00
Florian Müllner
3f89b57c96 workspace-indicator: 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
8dd8d6f561 workspace-indicator: Fix cancelling editing with Esc
The CallbackAction's callback must return true to stop the event
from propagating to the dialog, where it will trigger the close
binding.

It makes sense to still allow closing the dialog with Escape while
not editing a row. The easiest way to achieve that is by moving the
controller to the entry.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/208>
2022-01-26 10:55:59 +00: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
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
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
fdfa46099b workspace-indicator: Improve preview styling
The current styling doesn't indicate the active workspace very well, and
makes it difficult to differentiate empty workspaces from workspaces with
maximized windows.

Tweak the styling to address those issues.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/166>
2021-03-11 12:08:38 +00:00
Florian Müllner
f987e5f13d workspace-indicator: Reindent stylesheet
For some reason the CSS here uses a different indentation than
gnome-shell or the other extensions, fix that.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/166>
2021-03-11 12:08:38 +00:00
Florian Müllner
bb2b1204b4 workspace-indicator: Only show previews for up to six workspaces
On request of GNOME Classic users, we add GNOME2-like workspace previews
when using a horizontal workspace layout. The previews scale a lot worse
than the menu though, with the risk that they take up all the available
width in extreme cases.

Address this by also taking the number of workspaces into account, and
switch to the menu when we have more than six.

This is particularly important now that we switched to a horizontal
layout by default.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/165>
2021-03-10 20:11:18 +01:00
Florian Müllner
c33be29f56 workspace-indicator: Add tooltips to workspace thumbnails
When showing previews instead of the menu, the workspace names from
our preferences don't appear anywhere. Some users care strongly about
those, so expose them as tooltip on hover.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/155>
2021-01-20 23:58:13 +01:00
Florian Müllner
5df0fa145b workspace-indicator: Use Gtk.Button.icon_name property
Image buttons are a very common pattern, so GTK4 added some
convenience API we can use to construct them.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
f0ff0e1400 workspace-indicator: Stop using header func for separators
GTK4 added built-in support for this common pattern, so use that
instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
22ea58a849 workspace-indicator: Port to GTK4
With this port, all extensions now use GTK4 for their preferences.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
50d3ee5703 workspace-indicator: Use overlap to determine preview visibility
In order to better reflect the actual workspace, show any preview
that is at least partially located on the monitor, not only those
that have the major part on that monitor.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/142>
2020-12-02 19:27:44 +01:00
Florian Müllner
6949a5d075 workspace-indicator: Account for monitor offset in window previews
Windows' frame rects are in screen coordinates, while the workspace
thumbnails are based on the monitor work area. Unless we account
for the difference, previews end up mispositioned in multi-monitor
setups.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/142>
2020-12-02 19:22:12 +01:00
Florian Müllner
f5128e13f2 workspace-indicator: Round calculated preview sizes
While not strictly necessary, there's no reason to differ from the
copy in the window-list extension ...

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/142>
2020-12-02 19:17:36 +01:00
Florian Müllner
81be1d2e2f workspace-indicator: Use custom layout manager for thumbnails
The current code positions window previews explicitly using a fixed
layout manager. For that it relies on a valid parent allocation,
which is error-prone and frequently results in warnings.

Address this by moving the positioning code into a custom layout
manager, and only update the visibility from the window preview.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/260
2020-10-21 03:09:40 +02:00
Florian Müllner
623bc6dbf3 workspace-indicator: Adjust to overview changes
Window DND in the overview is now based on the metaWindow,
not the window actor (misnamed as "real window").

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/133
2020-10-21 01:05:07 +00:00
Florian Müllner
8c53fd9590 workspace-indicator: Stop using obsolete StBin properties
Those properties were deprecated (and made no-ops) last cycle, and
have now been removed altogether.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/122
2020-05-28 02:46:06 +02:00
Florian Müllner
90d3c5c51d workspace-indicator: Overhaul prefs widget
Inline toolbars are an outdated UI pattern, and both the toolbar widget
and the inline styling have been removed from GTK4. Making sure the
extension doesn't get in the way of a future GTK4 port is a good excuse
for modernizing the UI, so do just that :-)

Replace treeview and toolbar with an editable list as outline in the HIG:
https://developer.gnome.org/hig/stable/lists.html.en

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/120
2020-04-17 17:54:15 +02:00
Florian Müllner
95131dc252 workspace-indicator: Exclude DESKTOP windows from window previews
While nautilus removed its desktop support a while ago in favor of an
extension, it's still possible that some external X11 desktop icon app
is used. As DESKTOP windows cannot be moved between workspaces or stacked,
and aren't perceived as regular windows, it doesn't make sense to show
them as previews in the workspace switcher.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/93
2019-11-21 21:42:16 +00:00
Florian Müllner
30ad3d670f extensions: Stop setting GTypeName
The type name generated by gjs now includes the filename, so we
don't have to set it ourselves to make sure it's unique.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/95
2019-11-21 22:25:43 +01:00
Florian Müllner
7c170e7e90 cleanup: Always use type-safe comparisons
The type coercion performed by the regular == and != operators can
have surprising results. It is therefore considered good practice
to use the type-safe === and !== variants instead.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91
2019-08-21 15:13:44 +00:00
Florian Müllner
eb79f5b512 cleanup: Require "dangling" commas
Since ES5, trailing commas in arrays and object literals are valid.
We generally haven't used them so far, but they are actually a good
idea, as they make additions and removals in diffs much cleaner.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91
2019-08-21 15:13:44 +00:00
Florian Müllner
eceff51ba1 cleanup: Use consistent brace style of blocks
Our coding style has always been to avoid braces when all blocks
are single-lines. Make sure we apply that style consistently.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91
2019-08-21 15:13:44 +00:00
Florian Müllner
fdc3dda484 cleanup: Fix stray/missing spaces
Those are wrong according to our style guidelines, but the previous
eslint ruleset didn't catch them.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91
2019-08-21 15:13:44 +00:00