Commit Graph

9351 Commits

Author SHA1 Message Date
Andrew Zaech
09525ece8c extensionBase: Fix issue in lookupByURL()
The lookupByUUID() implementations in the subtypes return null
when the lookup failed, not undefined.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2879>
2023-08-10 16:04:51 +00:00
Andy Holmes
a703e192ed notificationDaemon: Export notification source classes
Out of the members of the notification daemon(s), these are the most
necessary and flexible to override. The daemons are used as singletons
and notifications are rather temporary, while the sources are more
flexible and make the most sense to override (and revert).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2869>
2023-08-10 13:33:13 +00:00
Florian Müllner
d6cfc13c3f screenshot: Export showScreen*UI() functions
showScreenshotUI() is needed by the system action, and
showScreenRecordingUI() is conceptually so similar that
it would be odd to export one and not the other.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6885

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2877>
2023-08-09 15:22:55 +00:00
Florian Müllner
ff010a11ab cleanup: Fixup wrong JSDoc comments
There are a handful of JSDoc comments that are invalid or don't
conform to the configured format. Fix them to remove the last
remaining bit of legacy configuration.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2866>
2023-08-09 15:10:38 +00:00
Florian Müllner
a42f7c2384 cleanup: Use type-safe comparisons
We have been using type-safe comparisons in new code for quite a while
now, however old code has only been adapted slowly.

Change all the remaining bits to get rid of another legacy style
difference.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2866>
2023-08-09 15:10:38 +00:00
Florian Müllner
9a3913d4a0 cleanup: Use consistent 4-space indent
This is another bit where we've made good progress, and just need
a final push to complete the transition.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2866>
2023-08-09 15:10:37 +00:00
Florian Müllner
071f92cfb6 cleanup: Remove spaces in object literals
We only adopted this style relatively recently, so there's a bit
more to adjust. Still, it's manageable and another step towards
getting rid of the legacy style.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2866>
2023-08-09 15:10:37 +00:00
Florian Müllner
6a22af83dc cleanup: Always use single quotes
We have made good progress with transitioning to the new style,
to the point where we can complete it with a final push.

Start with changing the remaining places that still use double
quotes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2866>
2023-08-09 15:10:37 +00:00
Carlos Garnacho
d56b05b5c3 js: Avoid Clutter.get_current_event() in Clutter.Actor event vfuncs
We sometimes obtained the current event through the general machinery
just so we could pass it along as a ClutterEvent instead of a specialized
subtype.

We now get that out of the box, so may avoid getting the current event
which is just a cast of the same current event we already have.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2872>
2023-08-09 13:46:14 +02:00
Carlos Garnacho
8423ba44fe js: Mass move to Clutter.Event getter methods in Clutter.Actor vfuncs
These traditionally got the various ClutterEvent subtype structs as their
argument, so it was not allowed to use ClutterEvent generic getter methods
in these vfuncs. These methods used direct access to struct fields instead.

This got spoiled with the move to make ClutterEvent opaque types, since
these are no longer public structs so GNOME Shell most silently failed to
fetch the expected values from event fields. But since they are not
ClutterEvents either, the getters could not be used on them.

Mutter is changing so that these vmethods all contain an alias to the
one and only Clutter.Event type, thus lifting those barriers, and making
it possible to use the ClutterEvent methods in these vfuncs.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2950
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2872>
2023-08-09 13:46:08 +02:00
Carlos Garnacho
5e36a06835 inputMethod: Check that there is an existing cursor location
Commit 17d9ec5788 made the input method call update() more eagerly,
but also at times that it does not have a cursor position yet. Make
it bail out correctly in that situation.

Fixes: 17d9ec5788 ("inputMethod: Keep Capabilite.FOCUS before context.focus_in/focus_out")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2876>
2023-08-09 12:44:30 +02:00
Carlos Garnacho
c9741ae3d5 ui/slider: Handle emulated scroll events through the Clutter.EventFlags
Emulated scroll events no longer get event.is_pointer_emulated() set to
True, instead this information is propagated through the Clutter.EventFlags
of the event.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2871>
2023-08-08 17:23:33 +00:00
Takao Fujiwara
17d9ec5788 inputMethod: Keep Capabilite.FOCUS before context.focus_in/focus_out
If context.focus_out() is called *after* context.set_capabilities(0),
The FocusOut D-Bus method is ignored because of no FOCUS capability.
If context.focus_out() is called *before* context.set_capabilities(0),
The 0 capability is set to the next focused context and the
FocusIn D-Bus method is ignored because of no FOCUS capability.
So context.set_capabilities(0) should not be called.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6415
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2666>
2023-08-08 10:20:28 +00:00
Takao Fujiwara
1cfaa2379d inputMethod: Try to connect require-surrounding-text signal
require-surrounding-text signal has been added since IBus 1.5.28.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6405
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2668>
2023-08-08 11:59:02 +02:00
Carlos Garnacho
f40a641801 padOsd: Simplify continuation of edition into further ring/strip directions
Inline the checks, so that we call stopEdition() from a single place.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2766>
2023-08-07 20:49:20 +00:00
Carlos Garnacho
457f3ae15b padOsd: Use per-direction labels on ring/strip actions
Rely on new Mutter API in order to separate mapping/labeling of buttons
and rings/strips, so that the latter may have per-direction labels.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6631
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2766>
2023-08-07 20:49:20 +00:00
Florian Müllner
477011a364 js: Port dbusUtils to ESM
The module is shared between the various D-Bus services and the
main gnome-shell process, so it was originally left out to allow
porting different bits at their own speed.

Now that everything has been ported to ESM, there is no reason
to not move that particular module as well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2868>
2023-08-07 19:05:50 +00:00
Florian Müllner
57662c1673 portalHelper: Fix import
fileutils.js is in a different directory than the main entry point.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2868>
2023-08-07 19:05:50 +00:00
Sebastian Keller
232e30108a polkitAgent: Fix misc import path
This was causing the importing of the component to get stuck, meaning it
would not get enabled.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2864>
2023-08-06 19:51:17 +02:00
Sebastian Keller
81692280bf keyring: Fix misc import path
This was causing the importing of the component to get stuck, meaning it
would not get enabled.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2864>
2023-08-06 19:50:55 +02:00
Evan Welsh
a751e213f6 js: Port to modules
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1499>
2023-08-06 13:02:49 +02:00
Evan Welsh
d9198317ae components: Change component loading to be asynchronous
Some components use build time optional dependencies such as
GNOME Bluetooth, so we need to import the components
conditionally.

Also rename to get rid of __init__.js file

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1499>
2023-08-05 22:16:23 +02:00
Evan Welsh
12f6d7027b listModes: Port listModes command to ES module
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1499>
2023-08-05 22:16:23 +02:00
Evan Welsh
b6e97fe449 js: Remove unused GDM utility functions
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1499>
2023-08-05 22:16:23 +02:00
Evan Welsh
64aa871a8a js: Add JSDoc to exported functions and fix incorrect JSDoc formatting
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1499>
2023-08-05 22:16:23 +02:00
Florian Müllner
910829f270 status/backlight: Sync checked on level changes
Since switching to property bindings/notifications, value changes
only happen on actual changes, so we cannot rely on them as the sole
source of updating the checked state.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2862>
2023-08-05 20:02:57 +00:00
Florian Müllner
987435f1cc status/backlight: Update icon assets
… following design review.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6875

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2861>
2023-08-05 19:46:48 +00:00
Florian Müllner
a332771562 injectionManager: Support overriding vfuncs
Overriding vfuncs can be useful, in particular when we convert
to ES modules, and exported symbols cannot easily be swapped out.

Adapt overrideMethod() to work correctly in that case as well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2809>
2023-08-05 12:35:30 +02:00
Florian Müllner
f70a75a905 extensionUtils: Add InjectionManager
It is fairly common for extensions to monkey-patch existing
classes. Add a small helper class that makes this a tad bit
more convenient.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2809>
2023-08-05 12:34:41 +02:00
Florian Müllner
7c4b1d4ae6 status/backlight: Notify slider value changes
The custom setter used by the slider item isn't emitting change
notifications, so the property binding that uses it as source
never propagates the new value.

Fix this by emitting proper change notifications.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2856>
2023-08-05 00:46:29 +00:00
Sam Hewitt
a466029374 panel: Fix drawing functions for light theme
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2823>
2023-08-02 20:05:39 +00:00
Florian Müllner
6bcb4f310f popupMenu: Hide ornament by default
We have always defaults to an empty ornament, so that menu items
are always aligned, even when radio items are used.

However radio items are fairly rare, so most of the time we end
up with an extra margin with no purpose. The design team now
prefers radio items to only align with each other, so that regular
items get the expected margin.

Change the defaults accordingly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2843>
2023-08-01 17:32:53 +00:00
Florian Müllner
8e9398be7e popupMenu: Never add ornament padding to image items
PopupImageMenuItem moves the ornament after the label, so we don't
need the additional padding that accounts for visible ornaments
for regular items.

Spotted by Sebastian Keller.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2843>
2023-08-01 17:32:53 +00:00
Sebastian Keller
ad34082fd1 popupMenu: Use correct padding for items with hidden ornaments
This also restores the padding adjustments that were erroneously removed
in a0fde0ee, but now they only apply to ornamented items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2843>
2023-08-01 17:32:53 +00:00
Florian Müllner
6a3dfbee8b status/network: Only show ornament in radio-mode
Soon only radio items should use a visible ornament, to avoid
unnecessary extra margins in regular items.

Network items can act as both radio- and regular items, so
update the ornament accordingly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2843>
2023-08-01 17:32:53 +00:00
Florian Müllner
2f8a2c3166 status/keyboard: Explicitly initialize ornament
Layout items use the ornament to indicate the active layout, so
their ornament should always be NONE or DOT.

The default is about to change to HIDDEN, so explicitly initialize
the ornament to NONE to keep the current radio item appearance.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2843>
2023-08-01 17:32:53 +00:00
Florian Müllner
62db8dc16e status/backlight: Add new quick toggle
Settings no longer exposes a slider for the keyboard brightness,
leaving keyboard shortcuts as the only way of adjusting it.

This is good enough in most cases, because devices with keyboard
backlight usually include corresponding keys on their keyboard.

However for devices without those keys, it would be good for the
settings to be exposed somewhere again. Quick settings seems like
a more appropriate place than "proper" Settings, since it gives
quick access that doesn't require a major focus change.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6765

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2820>
2023-07-30 11:12:50 +00:00
Florian Müllner
797df4f52f extensions: Make ExtensionPreferences more flexible
Extensions must now export a class with a fillPreferencesWindow()
method in their prefs. That is less convenient for extensions
with simple preferences than the old buildPrefsWidget() hook, as
they must wrap their widget in page/group widgets.

Address this by adding a default fillPreferencesWindow() implementation
that calls a getPreferencesWidget() method and wraps it as necessary.

This is flexible enough to support different cases fairly conveniently,
from simple single-widget prefs over tweaking the window to complex
multi-page prefs:

```js
class SimplePreferences extends ExtensionPreferences {
    getPreferencesWidget() {
        return new SimplePrefsWidget();
    }
}

class TinkerPreferences extends ExtensionPreferences {
    getPreferencesWidget() {
        return new SimplePrefsWidget();
    }

    fillPreferencesWindow(window) {
        super.fillPreferencesWindow(window);

        window.set_default_size(123, 456);
    }
}

class FullPreferences extends ExtensionPreferences {
    fillPreferencesWindow(window) {
        const page1 = new GeneralPage();
        window.add(page1);

        const page2 = new FoobarPage();
        window.add(page2);
    }
}
```

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
2023-07-30 10:29:44 +03:00
Florian Müllner
0483dd31f0 extensionBase: Set up translations automatically
If an extension provides the gettext domain in its metadata,
then we can simply set up translations from the constructor,
so do that for a bit more convenience.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
2023-07-30 10:29:44 +03:00
Florian Müllner
abdd1346da extensionBase: Stop injecting extensionManager
All extension lookups now happen through the dedicated
Extension/ExtensionPreferences classes, so the shared
code no longer has to access the extensionManager.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
2023-07-30 10:29:44 +03:00
Florian Müllner
82237a398f extensions: Add static lookupByUUID() method
This allows the Extension/Preferences classes to provide
the UUID -> extension lookup without exposing the underlying
extension manager.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
2023-07-30 10:29:44 +03:00
Florian Müllner
931ca5e4ab extensions: Replace exported gettext functions
Use the new defineTranslationFunctions() method from the previous
commit to create gettext functions for the module, instead of
re-exporting from the shared module.

It is now up to extension developers to use the more effective

```js
import {Extension} from 'etensions/extension.js';
const {gettext: _} =
    Extension.defineTranslationFunctions(import.meta.url);
```

or the more convenient

```js
import {Extension, gettext} from 'extensions/extension.js';
const _ = gettext;
```

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
2023-07-30 10:29:44 +03:00
Florian Müllner
f59d523694 extensions: Add static defineTranslationFunctions() method
The method can be used to define a set of gettext functions that
call the corresponding method of an extension.

Those functions are very similar to the gettext functions we are
exporting, except that:

 - looking up the extension is delegated to the
   Extension/Preferences class
 - it is possible to avoid examining the stack
   when called with `import.meta.url`

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
2023-07-30 10:29:44 +03:00
Florian Müllner
cd99fbae50 extensionBase: Add static lookupByURL() method
With convenience API like getSettings() now being provided by
the ExtensionObject subclass, extensions will need to access
their entry point more often.

Having to pass a pointer through the hierarchy can be annoying,
so add a static method that allows them to look it up:

```js
    const ext = Extension.lookupByURL(import.meta.url);
    this._settings = ext.getSettings();
```

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
2023-07-30 10:29:44 +03:00
Florian Müllner
3e4fd4b67a extensions: Add Extension/Preferences base classes
Extensions now must export a class that conforms to a particular
interface both for the actual extension as well as for prefs:

enable()/disable() methods for the former, fillPreferencesWindow()
for the latter.

This is quite similar to the previous method-based entry points,
but it also gives us a more structured way of providing convenience
API in form of base classes.

Do that in form of Extension and ExtensionPreferences classes on
top of a common ExtensionBase base class.

getSettings(), initTranslations() and the gettext wrappers are
now methods of the common base, while openPreferences() moves
to the Extension class.

Based on an original suggestion from Evan Welsh.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
2023-07-29 15:20:20 +03:00
Florian Müllner
6a34b2636d dbusServices/extensions: Include dir and path in metadata
As we did for extensions in the previous commit, pass the path and
dir properties alongside other metadata to extensions preferences.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
2023-07-29 15:20:20 +03:00
Florian Müllner
1c98a95974 extensionSystem: Include dir and path in data passed to extension
Extensions often need to set up additional resources from their
directory, like settings, translations or image assets.

So far extensions have used getCurrentExtension() to access the
shell's internal extension object which contains path and dir
properties. That's far from ideal, first because it requires
generating a stack to figure out the current extension, and
second because the internal object also contains state that
extensions shouldn't meddle with.

Just include those properties in the metadata we pass to the
extension constructor.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
2023-07-29 15:20:20 +03:00
robert.mader@collabora.com
63c3f3e7be status/camera: New indicator
Add a new status indicator following the system-status-indicators
mockup.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2840>
2023-07-29 13:55:15 +03:00
robert.mader@collabora.com
02f1952851 status/volume: Split indicator into output and input
Use the new privacy indicator class for the input one and move it next
to the other privacy indicators.

While on it move all privacy indicators to the front, following the
system-status-indicators mockup.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2840>
2023-07-29 13:55:15 +03:00
robert.mader@collabora.com
cbcb56972f style: Generalize sharing indicator class
To have a shared style for various privacy related indicators.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2840>
2023-07-29 13:55:15 +03:00