Commit Graph

9263 Commits

Author SHA1 Message Date
Florian Müllner
5e93791708 main: Load perf scripts as modules
The perf scripts that can be used to script the gnome-shell UI
for testing are sufficiently separate from the rest of the code
base to allow porting them to ESM modules before the rest of
the code base.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2812>
2023-07-07 19:43:28 +02:00
Florian Müllner
1f08056977 extensionSystem: Remove "disable" file on shutdown
The file indicates to the systemd shutdown scripts that extensions
should be disabled, so that extensions that crash the shell on
startup cannot lock out the user indefinitely.

For that purpose, we create the file before initializing extensions,
and remove it after 60 seconds. That generally works, because it's
highly unlikely that a session genuinely ends within the first minute.

It's possible though (for example during developments or when running
tests), so also remove the file when shutting down cleanly before
the timeout.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2807>
2023-07-07 11:34:44 +00:00
Florian Müllner
c76861b3c1 extensionUtils: Remove installImporter()
The method is now unused, so remove it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2795>
2023-07-06 18:41:29 +00:00
Florian Müllner
972a3b2d44 dbusServices/extensions: Load preferences as module
Now that extensions themselves are imported as modules, do the
same for their preference dialogs.

Extensions must now export a class with a `fillPreferencesWindow()`
method as default.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2795>
2023-07-06 18:41:29 +00:00
Florian Müllner
e8ee845e41 extensionSystem: Load extensions as modules
Continue the move to ESM by loading modules dynamically with
the standard import() expression, rather than by installing a
custom (legacy) importer.

This is a breaking change that affects all extensions, as they
now need to explicitly export the expected symbols.

As we are already breaking all extensions, take that opportunity
and remove support for the individual entry points: Using a
class with enable()/disable() methods has been the recommended
pattern for a long time, it is now the only entry point.

Instead of instantiating the class from an `init()` function,
the class must now be exported as default to be recognized.

Additionally, we no longer install an importer on the extension
object, so extensions that consist of more than one file MUST
import those files as modules now.

There will be a second breaking change for extensions when
gnome-shell's own code is ported to ESM, so most extension
developers will likely want to wait until the port is complete
before starting to port their extensions.

Based on a commit from Evan Welsh.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2795>
2023-07-06 18:41:29 +00:00
Florian Müllner
097c21d140 animations: Stop syncing size manually
The returned slice actors are now set up to fill their parent,
accounting for any difference between loaded- and displayed size,
so we can stop syncing the size manually.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2798>
2023-07-05 10:36:14 +00:00
Florian Müllner
ace8676ad0 windowManager: Add shortcut for toggling quick settings
Ever since the various status menus were combined into a single
aggregate menu, the menu has been an important entry point. Alas,
we never got around to adding a shortcut for it, not least because
there never was a good candidate.

We just freed super+s which works as either "system" or
"(quick) settings", so use that.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2716>
2023-06-21 18:11:05 +00:00
Florian Müllner
e9cabd00fb windowManager: Reindent shortcuts setup
We require all new code to use the non-legacy style. Updating code
on a case-by-case basis works fairly well most of the time, but
here we have a big uniform block, where any addition with a different
style would stick out badly.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2716>
2023-06-21 18:11:05 +00:00
Evan Welsh
0705c7a4eb js: Fix linting errors from line shifts
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2794>
2023-06-21 04:50:33 -07:00
Evan Welsh
1e9b906cbc js: Split gi imports to be on new lines to prepare for ES modules
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2794>
2023-06-21 04:50:33 -07:00
Florian Müllner
8d562ff71c portalHelper: Port to ESM
The helper app that provides the login dialog for network portals
is another separate process that can be moved to ESM separately.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2786>
2023-06-21 13:26:42 +02:00
Florian Müllner
612e04165e dbusServices: Port to ESM
We want to replace gjs' custom (and now legacy) imports system
with standard EcmaScript modules: JS developers are already
familiar with them, they have better tooling support and using
standard features over non-standard ones is generally the right
thing to do.

Our D-Bus services are separate from the main process, and thus
can be ported separately (except for the few imports that are
shared with the main process' code base).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2786>
2023-06-21 13:26:42 +02:00
Sam Hewitt
eacabbf443 panel: Stylesheet updates and minor improvements for panel buttons
- spin out all the panel button styling into a drawing mixin
- clean up the styles generally
- make special cases for the clock and non-flat buttons
- contrast fixes for non-flat buttons, fixes #6768
- new stop icon for the screen recording/cast indicators

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2804>
2023-06-21 10:28:13 +00:00
Florian Müllner
aa11d90693 workspace: Reapply border radius on background changes
The rounded corner effect is applied to the background actor, so
we have to reapply the correct values when the background changes
for the corners to persist.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2801>
2023-06-21 08:49:36 +00:00
Florian Müllner
593f659a73 parentalControlsManager: Don't log error when disabled
We currently special-case the DISABLED error when initializing
filtering, but not on app filter changes.

While it seems reasonable that Malcontent.Manager wouldn't emit
the signal while disabled, that's not actually true: It is emitted
when any user account information tracked by AccountsServices
changes.

Even if the signal were limited to changes of the ParentalControls
extension, it would still get emitted when app filtering *becomes*
disabled.

So regardless of potential improvements in libmalcontent itself,
we should filter out the DISABLED consistently, both when creating
the initial filter and when updating it.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2796>
2023-06-09 16:37:36 +02:00
Андрей Гриценко
ae24b0247e magnifier: Fix cursor offset
Commit c449058d44 changed the pointer clone to use a single
actor. However that broke applying the hotspot translation to the
position, so the magnified cursor is now displayed with a shift.

Undo the change to restore the old behavior.

This reverts commit c449058d44.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2780>
2023-06-07 22:52:27 +02:00
Evan Welsh
8fb8f7f827 init: Move Meta main loop into JavaScript after GJS context is initialized
gjs now has an internal mainloop that it can spin to resolve
module imports. That loop uses the thread default context,
so its possible that other sources, namely from mutter, get
dispatched when iterating the context. If that happens before
mutter is properly initialized, this will lead to a crash.

GjsContext needs to iterate its internal mainloop when initializing
to resolve internal modules, to avoid iterating Meta's mainloop and
triggering events before Meta is ready we will initialize the Shell
global and thus the GjsContext (js_context) before Meta.

Once GjsContext is initialized, we can call meta_context_setup().
Once Meta is setup and started, we'll run init.js which uses GJS'
internal promises API to set a "mainloop hook". The mainloop hook
is run immediately after the module returns so GJS will not attempt
to iterate the main loop again before exiting.

Also adjust the 'headlessStart' test to not wait for the
MetaContext::started signal, as that signal has now already
been emitted when the code is executed.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2781>
2023-06-07 19:23:27 +00:00
Evan Welsh
5d8e860a48 panel: Refactor quick settings loading for asynchronous imports
When the Shell ports to ESM, our inline imports of the network and
bluetooth indicators will no longer be possible, refactor quick settings
to load indicators asynchronously.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2563>
2023-06-07 18:59:43 +00:00
Evan Welsh
7116d91852 animation: Don't get size information until spinner has a parent
get_size() in _syncAnimationSize() can't be called until the actor
has a parent, otherwise we'll get an error for calling
st_get_theme_node() prior to the actor being on a stage.

_syncAnimationSize() is called asynchronously via
textureCache.load_sliced_image() and there is currently no guarantee
the actor will actually be "loaded" prior to calling it.

This becomes a more obvious error/issue when refactoring parts of the
Shell loading to also be asynchronous.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2563>
2023-06-07 18:59:43 +00:00
Florian Müllner
2416e4eec0 scripting: Make helper proxy initialization async
We are about to port the helper proxy to GApplication, which means
that it will establish a display connection before exporting its
D-Bus name. That means that the compositor must be able to respond
to a roundtrip request to avoid locking, so don't block on the proxy
becoming available.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2733>
2023-06-07 11:12:40 +00:00
Florian Müllner
dec26b7da2 backgroundApps: Allow activating apps
Now that we track apps instead of instances, we can make the menu
items activatable, because the corresponding action is no longer
app specific (like activating a particular tab): We can simply
activate the app, which hopefully will bring it to the foreground
again.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2790>
2023-06-06 17:16:32 +00:00
Florian Müllner
6cf0df5fb9 backgroundApps: Track apps instead of instances
The background apps menu currently tracks instances rather than
apps. That matches the behavior of `flatpak ps` and can be useful,
for example when one particular instance runs out of control.

But as we don't include any information that allows to actually
distinguish between instances, multiple instances appear simply
as duplicated app entries.

Given that a menu is too limited for detailed information, stop
representing individual instances, and track apps instead.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2790>
2023-06-06 17:16:32 +00:00
Andy Holmes
32b9109967 overview: Provide public access for search provider registration
Provide a reasonably public way to register and unregister search
providers, without adding too much API.

`Main.overview.searchController` provides access that may be generally
useful, while `SearchController.addProvider()` and
`SearchController.removeProvider()` provide a simple interface for
extensions.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2783>
2023-06-01 15:54:59 -07:00
robert.mader@collabora.com
e1145defa9 screencastService: Fix 'pipeline' option
When introducing the pipeline fallback mechanism, support for defining a
custom pipeline was unintentionally dropped, breaking extensions such as
EasyScreenCast.

Fixes 9cb40c4814

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2782>
2023-05-30 22:21:12 +00:00
Florian Müllner
ba43c61917 build: Remove Soup2 support
We started to support Soup3 in GNOME 41, and used it by default
since GNOME 43. This should be enough time for distros to adapt,
so GNOME 45 looks like a good moment to drop the old Soup2 support.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2776>
2023-05-26 19:05:22 +00:00
Florian Müllner
bce0788809 extensionSystem: Support stylesheet variants
Since we started to support the color-scheme preference, extensions
should be able to provide appropriate variants (if they deal with
colors).

So look for a variant with -dark/-light suffix before using the
plain stylesheet.css, and reload extension stylesheets on
color scheme changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2324>
2023-05-26 18:30:39 +02:00
Florian Müllner
878a0af00d main: Consider color-scheme setting for default stylesheet
Our own preference - equivalent to AdwStyleManager's color-scheme
property - is expressed via a new session mode property.

The default mode uses 'prefer-dark', gnome-classic is expected
to use 'force-light'.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2324>
2023-05-25 17:10:53 +02:00
Florian Müllner
d76f309dba theme: Include both dark and light variant in resource
This will allow us to switch between the variants according to
the color-scheme setting.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2324>
2023-05-25 17:10:53 +02:00
Daniel Drake
fa34d30d3e ibusManager: Close candidate popup upon engine change
The IBusCandidatePopup can get 'stuck' in an active, visible state if
it is on-screen at the point when the input method is changed to a method
that doesn't use such popup (e.g. regular English).

Force the candidate popup to close when the engine is changed.
It will reappear (via regular lookup table update signal) if/when it is
next required.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6717
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2774>
2023-05-24 10:39:35 +02:00
Zacharie DUBRULLE
d7542db38c dnd: Don't leak a signal connection
The handler is currently leaked when a drag monitor stops a
motion event.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2770>
2023-05-19 20:33:55 +02:00
Sam Hewitt
d6b0121006 style: Clean up calendar widget css
- use existing button styles for the calendar items
- change visual treatment of weekends; fixes #1767
- clean up class names

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2769>
2023-05-18 14:21:29 +00:00
maniacx
a0fde0eed5 popupMenu: Replace ornament unicode with icons
Ported from Sam Hewett's Merge-Request.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2308#8714a3530d73823716c0f8334aceaabeaccd01b7

The CHECK ornament used in powerprofile and volume control is not very
pleasant looking, specially if system font is changed.
Replace CHECK and DOT unicode ornament with revelant icons in popupMenu.

Solves issue: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6055

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2767>
2023-05-17 17:41:10 +00:00
Florian Müllner
27617ef0a3 mpris: Fall back to app icon first
When no cover art is available, the app icon at least allows
distinguishing between different players, so try falling back
to that before using the generic icon name.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2755>
2023-05-15 16:05:31 +00:00
Florian Müllner
35315a605b mpris: Expose player app
This will allow accessing it from the notification.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2755>
2023-05-15 16:05:31 +00:00
Joan Torres
c57f4a1c73 polkitAgent: Fix closing dialog properly
When pressing the close button on the dialog the polkit request isn't
completed leaving the polkit agent blocked unable to handle new
requests.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2761>
2023-05-09 19:27:54 +02:00
Jonas Dreßler
846bb84ff6 screencastService: Fixup pipeline fallback behavior
Calling _teardownPipeline() before _tryNextPipeline() was actually not a
good idea, it sets the pipelineState to STOPPED, which means we can't try
any of the following pipelines anymore.

Instead what we want to do is set the pipeline state of the old pipeline to
NULL when trying a new one, without calling _teardownPipeline() for that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2754>
2023-04-26 18:02:57 +00:00
Jonas Dreßler
6476e62bff screenshot: Remove leftover code in property getter
According to Ivan (author of that piece of code), this is most likely a
leftover from a refactor and has no purpose anymore, so remove it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2753>
2023-04-26 19:31:53 +02:00
Jonas Dreßler
d67077bdf1 Remove keyboard shortcut to open the app menu in the panel
Now that the app menu indicator is no longer shown, it shouldn't be possible
to toggle the popup menu via keyboard shortcut anymore, so remove the code
and gsettings definitions for that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2610>
2023-04-26 14:32:23 +02:00
Jonas Dreßler
3ea672efe6 panel: Remove the appMenu indicator
Over time the app menu has proved to be an issue and lately there has been
some movement to fix that (see also
https://gitlab.gnome.org/Teams/Design/os-mockups/-/issues/198).

As a first step, let's stop showing the indicator (not removing the code
yet) so that we can iterate on a more elegant solution.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2610>
2023-04-26 14:31:24 +02:00
robert.mader@collabora.com
b916ced2e6 screencastService: Add dmabuf/GL pipeline
This pipeline imports dmabufs and does format conversion using GL.
The `video/x-raw(memory:DMABuf)` filter ensures format negotiation
between `pipewiresrc` and Mutter will only succeed if Mutter advertises
dmabuf support as well, falling back to the next pipeline otherwise.

Using this pipeline frees Mutter from downloading buffer content on the
main thread which can have a big impact on compositor performance.
Doing format conversion on the GPU should further improve the overall
performance on most hardware.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2597>
2023-04-26 12:19:42 +00:00
Jonas Dreßler
fd730a4db7 screenshot: Also handle dbus service crashes
When the screencast dbus service crashes due to gstreamer, we should also
handle that and not pretend to continue recording.

Let's listen to g-name-owner changes for that and then also send a
notification about it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2752>
2023-04-26 13:36:31 +02:00
Jonas Dreßler
99923ac612 screenshot: Handle screencast errors properly
Send a notification and remove the screencast inidicator when we hear about
a screencast error from the dbus service.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2752>
2023-04-26 13:36:26 +02:00
Jonas Dreßler
c494597a91 screencastService: Signal errors via the internal dbus interface
Make sure gnome-shell gets notified of errors that happen during screen
recording using the screencastService, so that it can properly notify the
user about the error and tear down its state, too.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2752>
2023-04-26 13:35:57 +02:00
robert.mader@collabora.com
80d72cfd32 screencastService: Do not try multiple pipelines on old Pipewire versions
Pipewire versions < 0.3.67 may not fail immediatly on negotiation
errors, thus use the last/fallback pipeline directly.
Technically, a similar recent version of Wireplumber is required
as well, but we can't check that easily and the combination of old
Wireplumber and new Pipewire is quite unlikely.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2609>
2023-04-26 12:48:32 +02:00
Jonas Dreßler
9cb40c4814 screencastService: Add fallback mechanism for gstreamer pipelines
Introduce a fallback mechanism for gstreamer pipelines that allows to
define multiple pipelines and prefer them over each other.

The way this works is that we introduce a new STARTING PipelineState.
While the Recorder is in that state, it is allowed to tear down the
current pipeline and start another one whenever an error happens, this is
used to try multiple pipelines in a fixed order until a working one is
found.

Right now there's just a single pipeline using the existing vp8 encoder, the
actual new encoders and pipelines will be added in a separate commit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2609>
2023-04-26 11:39:16 +02:00
robert.mader@collabora.com
46517e02dd screencastService: Drop always-copy condition
The check for the Pipewire version was originally introduced in
d32c0348 which states:
> Since it is not clear yet when a proper solution will arrive,
> this makes use of `always-copy` as a workaround for now and
> should be reverted once it is no longer needed.

The check for a stable Gstreamer version with the mention proper fix was
introduced in d7b44319 and carried for the 43 cycle.

By the time Gnome 44 will be released all distros should have had enough
time to update their Gstreamer version - or backport the patches, in
case of not ustream-supported versions.

Thus lets drop it now.

Note: `always-copy` is not suitable for dmabuf buffers as it copies via
mmap.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2609>
2023-04-25 20:28:28 +02:00
Jonas Dreßler
cad01d154c screencastService: Set PipelineState to PLAYING on actual state-change
Right now when we tell gstreamer to move the pipeline to the state
PLAYING, we pretend that happens immediately and set our PipelineState
to PLAYING right afterwards.

In reality though it's more complicated than that: Gstreamer changes
states asynchronously and set_state() returns a Gst.StateChangeReturn.ASYNC.
In that case we should wait until the according STATE_CHANGED event happens
on the bus, and only then set our PipelineState to PLAYING.

Since the STATE_CHANGED event will also happen when set_state() returns
SUCCESS, we can use the same async logic for that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 18:57:51 +02:00
Jonas Dreßler
42af7e53a2 screencastService: Handle more gstreamer errors
Gstreamer can produce various errors, we shouldn't pretend those don't
exist and go on as usual when one happens. Instead, when an error
happens, tear down the pipeline, set our PipelineState to the new ERROR
state and bail out with a proper error message.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 18:57:47 +02:00
Jonas Dreßler
cbfbdc4be5 screencastService: Streamline teardown and error handling
We're tracking three different state-machines in the Recorder object:
The state of the gstreamer pipeline, the state of the screencast
session, and the sender of our dbus invocation that might vanish.

Properly handling errors that might appear in any of those three "black
boxes" is not easy, especially tearing down the other two when one of
them breaks.

So refactor the error handling here: Add a single error path for each of
those three states we're tracking, and make them all subsequently call
the _bailOutOnError() method. From there we tear down the other states and
call the error callbacks.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 17:17:41 +02:00
Jonas Dreßler
e6196b5b9f screencastService: Add an ERROR state for the pipeline state tracking
This will be useful when we start actually listening for ERROR events on
the gstreamer bus.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 17:17:41 +02:00