Commit Graph

62 Commits

Author SHA1 Message Date
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
93a2e7bdba extensions: Stop using global.log()
It has been deprecated since 3.6(!) in favor of the actually
global log().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/264>
2023-07-10 06:51:45 +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
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
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
b92973df00 cleanup: Simplify promisify() calls
If the finish function isn't specified, promisify will now try
to use the async name without '_async'/'_begin' suffix (if any)
and '_finish' appended.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/214>
2022-02-11 16:22:38 +01:00
Florian Müllner
0b7e8f9720 user-theme: Stop using Gio._LocalFilePrototype
Now that promisify() works on interfaces, we don't need this
cludge anymore.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/214>
2022-02-11 16:22:38 +01:00
Florian Müllner
01537b401f user-theme: 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
Just Perfection
762ec75601 user-theme: Extensions review guidelines compatibility
Extensions review guidelines enforces extensions to
don't create objects in the constructor of the class
that init() returns. so creating settings object in enable()
can make the extension compatible with the ego review guidelines.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/197>
2021-11-06 21:58:59 +00: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
53f5a92dc8 user-theme: Stop using header func for separators
GTK4 provides 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
3bef6be7c1 user-theme: Port to GTK4
With the previous preparations in place, the actual GTK4 port is
now trivial:
 - replace Gtk.Container methods with widget-specific methods
 - stop using show_all()

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
b83d38a72e user-theme: Track GSettings to sync checkmark
GTK4 removes the generic GtkWidget API for accessing an inserted
action group, so we need an alternative for tracking the currently
selected theme.

Using the underlying GSettings object looks like the easiest option,
so do that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:54 +01:00
Florian Müllner
5b73960f34 extensions: Stop using :margin shortcut
The property has been removed in GTK4, so prepare for a port by
setting the four individual margin properties instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:54 +01:00
Florian Müllner
ac937b9549 user-theme: Make rows non-selectable
A row has to be activated to select a theme, not merely selected.
The selection therefore doesn't do anything, so disable it.
2020-04-29 21:44:13 +02:00
Florian Müllner
5b2bdd138a user-themes: Support session mode styles
Session mode stylesheets are installed in gnome-shell's theme
directory instead of a subdirectory of the global themes direc-
tory.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/118
2020-04-17 16:33:03 +00:00
Florian Müllner
739b1e11a0 user-themes: Add preference widget
While we don't endorse or support 3rd party theming, the extension
exists and is actively used. However right now the most convenient
way of setting it up is by installing Tweak Tool; give users an
alternative by providing a simple settings dialog ourselves.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/117
2020-04-12 04:13:25 +02: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
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
a26380d56e user-theme: Clarify some code
Commit 2582ab accidentally pointed out that the current theme loading code
obfuscates which directories are searched for themes. Rewrite it with modern
JS features to make it more obvious.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60
2019-03-04 19:35:18 +01:00
Florian Müllner
ab334d95e0 Revert "User theme: compatibility with XDG Base Directory"
We already handled themes in XDG_DATA_HOME before commit 2582ab
by prepending it to the system dirs.

This reverts commit 2582ab4fd0.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60
2019-03-04 19:35:10 +01:00
Tomasz Gąsior
2582ab4fd0 User theme: compatibility with XDG Base Directory
See https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/55
2019-02-20 01:15:49 +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
8a2b9abc09 style: Stop using string concatenation
String concatenation is considered bad style after ES6 added
template strings. The latter is the replacement we generally
want, except where the aforementioned xgettext bug would trip
over the backtick/slash combination.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/49
2019-01-28 06:37:28 +01:00
Florian Müllner
f75d1d75af style: Fix stray/missing semi-colons
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
194e294d2c user-theme: Don't use concatenation to build filenames
Since template strings were added in ES6, string concatenation is
considered bad style. There's a catch though: xgettext currently
has a nasty bug concerning the combination of backticks and slashes.
Avoid that issue by building filenames with the corresponding GLib
helper function.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/49
2019-01-28 06:37:28 +01:00
Florian Müllner
ba27cc4a64 cleanup: Get rid of Lang.bind()
After replacing Lang.Class with ES6 classes and adopting arrow notation
for anonymous callbacks, we only use the Lang module to bind `this` to
named callbacks. However since ES5, this functionality is already provided
by Function.prototype.bind() - in fact, Lang.bind() itself uses it when
no extra arguments are specified.

So just use the built-in function directly instead of the wrapper.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/30
2017-12-01 20:50:52 +01:00
Florian Müllner
48399d46c0 cleanup: Port non-GObject classes to ES6 classes
ES6 finally adds standard class syntax to the language, so we can
replace our custom Lang.Class framework with the new syntax. Any
classes that inherit from GObject will need special treatment,
so limit the port to regular javascript classes for now.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/30
2017-12-01 20:50:46 +01:00
Florian Müllner
30e7ff5a8f cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for porting to ES6 classes.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/30
2017-12-01 20:50:28 +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
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
Florian Müllner
8c6644f1be Revert "user-theme: Temporarily work around a gnome-shell regression"
The issue has been fixed in gnome-shell master, so we can revert the
workaround.
2014-11-27 14:49:43 +00:00
Florian Müllner
dd3c7ca199 user-theme: Temporarily work around a gnome-shell regression
setThemeStylesheet() stopped accepting %null to revert to the default
stylesheet. The issue is fixed in gnome-shell master, but work around
it for 3.15.2 to not ship broken (again).
2014-11-27 14:42:01 +00:00
Giovanni Campagna
ae9df9f001 user-theme: look for gnome-shell themes in ~/.local/share too
Just like we look in XDG_DATA_DIRS, we should honor XDG_DATA_HOME
as well.
For compatibility reasons, we look in ~/.themes first, then ~/.local/share,
then /usr/share.
2013-07-14 15:19:14 +02:00
Giovanni Campagna
274a6f040c Update descriptions of extensions
Mark classic mode extensions as such, so bug reports don't go
lost in my inbox.
2013-05-20 19:06:59 +02:00
Giovanni Campagna
9b6374881d all: port to the new class framework
A long due update, since this was merged in gjs and core shell.
We no longer need to mess with __proto__ and prototype, and can
use decent syntax for true object oriented programming.
(This affects all except xrandr-indicator, since I want to port
that to GDBus too, using the new bindings right from the start)
2012-02-10 15:16:46 +01:00
Giovanni Campagna
3630228cac all: port to the new convienence module
Retrieve Convenience from the extension helper object (Me), and
pass no arguments to initTranslations and getSettings (since the
metadata has all that is required)
2012-02-09 18:43:28 +01:00
Giovanni Campagna
9ebfd1f495 build system: factor out setting schema generation
Introduce a common settings.mk file, which is included in extensions
that need GSettings, to ensure that conventions are respected, and
necessary fixes can be applied from one place.
2012-02-08 18:01:00 +01:00
Giovanni Campagna
dfca68062c build system: add additional automatic metadata
Add "gettext-domain", "extension-id" (containing the base part of the
UUID) and "gschemabase" (which, combined with "extension-id", gives
the GSettings schema) to metadata.json, autogenerated by the build
system.
2012-02-08 18:00:56 +01:00
Giovanni Campagna
c49c20fe38 user-theme: fix enable after disable
In disable(), _settings was cleared, despite being created in
init(), therefore a subsequent enable() would find it null.
2012-01-11 17:41:28 +01:00
Giovanni Campagna
7a6777f703 Remove all references to localedir from metadata.json
It is not used anymore, now that translations are bundled with
the extension. Also, in the zip files it ended up with my home
folder, which is not nice.
2011-11-20 00:40:20 +01:00
Giovanni Campagna
c5d79240fd Introduce a convenience module for initialization
Common code for retrieving translations and GSettings schemas has
been factored out into lib/convenience.js, which is part of
every extension installation.
Since that code relies on renames done at zip file creation time,
extensions can no longer be installed with "make install". Instead,
one should create the zip file and install it with the tweak-tool.
There is also a bash script, local-install.sh, that will install
everything in zip-files.
Also, since the GSettingsSchemaSource code is not yet in a stable
GLib release, extensions using GSettings have seen their stable
shell version removed.
2011-11-19 16:54:20 +01:00
Giovanni Campagna
9e4156a706 Add capability to build extension zip-files
Now, typing "make zip-file" will create a standard zip-file for each
extension, with everything necessary, including translations and GSettings schemas.
These files can then be installed with the tweak-tool or uploaded
at extensions.gnome.org

Based on an earlier patch by Jasper St. Pierre.
2011-11-19 15:42:27 +01:00