Commit Graph

46 Commits

Author SHA1 Message Date
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
dd8ee2931a screenshot-window-sizer: Handle wrapping around backwards
The mod takes care of wrapping at the top, but not when
decrementing 0. Fix this by using Array.prototype.at(),
which handles negative indexes.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/284>
2023-10-24 21:15:06 +02:00
Florian Müllner
f530acbf9e screenshot-window-sizer: Use built-in support for reversed bindings
Mutter has had explicit support for reversed bindings for a while now.
Use that, as it's more reliably than examining the modifiers manually.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/284>
2023-10-24 21:15:06 +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
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
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
1e833f542f screenshot-window-sizer: Delay size popup
We use the actual frame size for the popup rather than the target
size. That means (on wayland), we have to wait for the size to
actually change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/232>
2022-06-09 19:20:44 +02:00
Florian Müllner
faabfa11c2 screenshot-window-sizer: Remove superfluous check
We already filter out sizes that don't fit the screen when
building the scaledSizes array, no need to check again.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/232>
2022-06-09 19:06:24 +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
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
Willy Stadnick
a2b014ccbf screenshot-window-sizer: Fix cycling through all valid sizes
When cycling through window sizes, we should skip any sizes that are
bigger than the available area. We do that, but the current code
assumes that the possible sizes are sorted, which is no longer the
case since the addition of "phone" sizes in commit 5b43d4733c.

As a result, we may now skip sizes that would fit perfectly fine.
Address this by filtering out invalid sizes beforehand instead of
assuming a certain order (wich no longer work due to the addition
of a portrait format).

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/97
2019-11-26 00:49:08 +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
e217f23767 cleanup: Avoid unnecessary parentheses
Extra parentheses usually add noise rather than clarity, so avoid
them.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91
2019-08-21 15:13:43 +00:00
Florian Müllner
579a290bae screenshot-window-sizer: Rearrange calculation
eslint has a rule to prohibit unnecessary parentheses. While this is
generally a good idea stylistically, the parentheses in a calculation
of (a / b) * c add more clarity, as a / b * c lacks the unambiguity of
proper math notation:

   a                a
  --- * c   vs   -------
   b              b * c

We can still follow the style rule by rearranging to the unambiguous
c * a / b.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91
2019-08-21 15:13:43 +00:00
Florian Müllner
6aab09bd06 screenshot-window-sizer: Fix imports
Since we replaced Tweener with Clutter animations, we must import the
latter and don't need the former.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/88
2019-08-10 18:33:18 +02:00
Florian Müllner
80de26dc16 cleanup: Stop using Tweener
gnome-shell added convenience API for Clutter animations and replaced
Tweener everywhere; follow suite and do the same.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/87
2019-08-10 00:27:20 +02:00
Florian Müllner
2db4589dea cleanup: Re-order imports
They should be grouped between external (GI/gjs) and shell and in
alphabetical order. Until commit bab4be1a ExtensionUtils was special
as it was required for some imports, but that's no longer the case
for most extensions.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/76
2019-06-28 21:51:38 +02:00
Florian Müllner
cdd3fba593 screenshot-window-sizer: Reindent to conform with new style
Instead of aligning arguments like we used to do, use a consistent
four-space indent as mandated by gjs' current style guide.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/66
2019-05-22 20:40:18 +02:00
Adrien Plazas
5b43d4733c screenshot-window-sizer: Add phone screenshot sizes
This is going to be convenient to take fake screenshots for phones like
the Librem 5.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/65
2019-04-12 14:31:53 +02:00
Florian Müllner
fb039c0fb5 cleanup: Use Meta.MaximizeFlags.BOTH
This shorthand has been around for a long time, use it make (un)maximize
code more readable.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60
2019-03-04 19:35:10 +01:00
Florian Müllner
db35d7ae7c style: Change indentation style of object literals
Instead of keeping the first property on the same line as the opening
brace and aligning the properties, use a four-space indent. This brings
us closer to gjs' coding style, and as a bonus helps keeping lines in
the soft 80 character limit.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/57
2019-02-28 23:29:24 +01:00
Florian Müllner
0d41643866 cleanup: Use destructuring for imports from GI
This is *much* nicer than repetitive "imports.gi" lines ...

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/54
2019-02-16 00:49:44 +01:00
Florian Müllner
bab4be1a59 extensions: Drop Convenience library
Its methods are now provided by gnome-shell itself and can be used
as an easy drop-in replacement.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/44
2019-02-06 20:17:59 +01:00
Florian Müllner
3861ffae31 extensions: Mark exported symbols
eslint obviously doesn't know about gnome-shell's extension API, so
the various entry points trigger unused-variable errors. To fix,
explicitly mark those symbols as exported.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/50
2019-01-28 06:51:20 +01:00
Florian Müllner
3effc9cfc2 style: Fix indentation errors
While we have some style inconsistencies - mostly regarding split lines,
i.e. aligning to the first arguments vs. a four-space indent - there are
a couple of places where the spacing is simply wrong. Fix those.

Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/49
2019-01-28 06:37:28 +01:00
Florian Müllner
b741b1bbe2 cleanup: Remove empty init() functions
The method is optional, so there's no point at all in letting the
shell call an empty method during initialization.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/49
2019-01-28 06:37:28 +01:00
Florian Müllner
d7414025a5 cleanup: Remove unused variables
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/49
2019-01-28 06:37:28 +01:00
Florian Müllner
a317d75f70 cleanups: Clean up unused imports
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/49
2019-01-28 06:37:28 +01:00
Jonas Ådahl
6583eae622 Remove usage of MetaScreen
As of the libmutter API version 3 MetaScreen does no longer exist.
Functionality that previously depended on MetaScreen has been moved
elsewhere (e.g. MetaDisplay or MetaWorkspaceManager etc).

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:53:08 +02:00
Florian Müllner
968ae427f1 cleanup: Use arrow-notation for anonymous functions
Arrow notation is great, but as we only started using it recently,
we currently have a wild mix of Lang.bind(), function() and () => {}.
To make the style consistent again, change all anonymous functions
to arrow notation.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/30
2017-12-01 20:40:32 +01:00
Florian Müllner
ba38019049 build: Remove autotools support
Complete the switch to meson and drop autotools support ...

Fixes https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/31
2017-12-01 17:43:21 +01:00
Florian Müllner
3ab01aebec build: Support the meson build system
Meson is on track to replace autotools as the build system of choice,
so support it in addition to autotools.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/31
2017-12-01 17:41:04 +01:00
Piotr Drąg
824e79d83e gschema: Fix gettext-domain 2017-10-01 19:10:42 +02:00
Florian Müllner
74643a62d1 screenshot-window-sizer: Add explicit keybinding for backward cycling
The REVERSES flag was removed from Meta.KeyBindingFlags a while ago, as
gnome-control-center doesn't recognize it and the corresponding "magic"
shift handling. That is, nowadays reversible keybindings need to
provide an explicit reversed binding.

https://bugzilla.gnome.org/show_bug.cgi?id=784079
2017-07-05 17:06:37 +02:00
Florian Müllner
db3e910b76 build: Say good-bye to intltool
intltool is unmaintained nowadays while upstream gettext gained
support for everything we used it for, so make the switch.

https://bugzilla.gnome.org/show_bug.cgi?id=769077
2016-08-19 22:17:07 +02:00
Will Thompson
5b1f7704a6 screenshot-window-sizer: hidpi support
The new logical dimensions are reported in the overlay, rather than the
pixel dimensions. That is: if scaleFactor is 2, a window might be
resized to 2400×1350 device pixels, which will be reported as 1200×675
in the overlay.

This is consistent with (for example) the DevTools in Chrome, which
reports the logical size of the viewport when you resize the window,
rather than the physical pixel size.

Tested with a freely-resizable window and with a constrained-geometry
window (GNOME Terminal), on a hidpi display.

https://bugzilla.gnome.org/show_bug.cgi?id=754607
2016-01-08 14:09:48 +00:00
Florian Müllner
0b18b15fee screenshot-window-size: Update for mutter API changes 2015-03-17 19:46:05 +01:00
Florian Müllner
0e0f7c80c2 Update for KeyBindingMode => ActionMode change 2014-12-19 16:13:29 +01:00
Florian Müllner
e669aa75b6 Revert "screenshot-window-sizer: Do not translate schema for now"
This reverts commit 53b1149d0a0316602bea310b624f3ad8b839541e.
2014-10-14 21:43:16 +02:00
Florian Müllner
8696067186 screenshot-window-sizer: Do not translate schema for now
It's not worth a string freeze break, we can revert after the freeze
has been lifted ...
2014-09-17 07:05:22 +02:00
Florian Müllner
1d5ab0f0de screenshot-window-sizer: New extension
Originally from hughsie's github[0], but way too useful to leave
in a 3rd party repo :-)

[0] https://github.com/hughsie/gnome-shell-extension-screenshot-window-sizer

https://bugzilla.gnome.org/show_bug.cgi?id=736470
2014-09-17 07:05:22 +02:00