Commit Graph

9403 Commits

Author SHA1 Message Date
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
Florian Müllner
1354d2cf56 extensions: Unify how manager is injected into shared module
We unified most code paths earlier, but the common code will still
import Main locally if no extension manager was injected before.

Now that the old extensionUtils was split between extension and
preferences, each of those modules can simply import the manager
from its corresponding environment, and then inject it into the
shared module.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
2023-07-15 13:16:42 +02:00
Florian Müllner
3006c05ea5 extensions: Simplify openPrefs()
The module is now only used inside the gnome-shell process, so
we don't have to handle the case where it is used from prefs,
and we can use regular imports for shell modules.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
2023-07-15 13:16:42 +02:00
Florian Müllner
6a46d338e7 extensions: Provide separate implementations
For the time being this mostly means re-exporting functions
from the shared module. However openPrefs() is now only
available to extensions, and we stop exporting both
getCurrentExtension() and setExtensionManager() to either
extensions or prefs.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
2023-07-15 13:16:42 +02:00
Florian Müllner
55cf8cf4bb extensions/internals: Port to ESM
We got rid of all uses of extension utils code in the gnome-shell
process itself, and everything that is now using it - including
extensions - is already loaded as module.

We can therefore quickly move the file to ESM, which will help
a bit with upcoming changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
2023-07-15 13:16:42 +02:00
Florian Müllner
d3f662fbf2 extensionUtils: Split out extension convenience functions
ExtensionUtils was originally used for shared functions between
the extension system and the (old) prefs-tool, but then gained
useful API meant for extensions themselves.

It's a bit weird to mix the two, so split out the extension convenience
API into a separate module.

We will soon split up the module further, and add specific "flavors"
for extensions and preferences, with the current code providing a
shared base for both.

That should explain both the new location and the odd module name. :-)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
2023-07-15 13:16:42 +02:00
Florian Müllner
23f525785c extensionUtils: Use non-legacy style
The file already largely conforms to the new style. Quickly fix
up the remaining issues before making any major changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
2023-07-15 13:16:42 +02:00
Florian Müllner
4a0b0e26c7 extensionUtils: Move isOutOfDate() into manager
It hasn't been used anywhere else since the old prefs-tool stopped
implementing its own extension loading.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
2023-07-15 13:16:42 +02:00
Florian Müllner
df350cab0a extensionUtils: Always use manager to find current extension
Now that we always have an extension manager object, we can use
the same code path for use from extensions and prefs.

For that, inject the D-Bus service's extensionManager instead
of the current extension.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2832>
2023-07-15 11:07:12 +00:00
Florian Müllner
10672597c2 dbusServices/extensions: Add basic extension manager
ExtensionUtils' getCurrentExtension() method currently either
returns the extension that was injected with setCurrentExtension(),
or imports Main locally to access the extensionManager.

But local imports won't work anymore when we convert to ESM,
and setCurrentExtension() is only an option for prefs.

Instead of diverging the code paths even further, we'll unify
the two cases as much as possible.

As a first step, add a basic extension manager in the Extensions
D-Bus service that exposes the same lookup() API as the "real"
extension manager.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2832>
2023-07-15 11:07:12 +00:00
Florian Müllner
cdd19a7773 dbusServices/extensions: Save stateObj on extension
We don't need it for anything for the time being, but reducing the
differences between extension object in the gnome-shell process and
in preferences still seems a good idea.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2832>
2023-07-15 11:07:12 +00:00
Florian Müllner
9e4de6a005 dbusServices/extensions: Don't use getCurrentExtension()
The prefs dialog is created on behalf of a particular extension.
It's a bit silly to rely on getCurrentExtension() to access it,
instead of just keeping track of it ourselves.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2832>
2023-07-15 11:07:12 +00:00
Florian Müllner
b4c2901e47 dbusServices/extensions: Check earlier for existing dialog
There is no point in making a D-Bus call if we are going to bail
out anyway.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2832>
2023-07-15 11:07:12 +00:00
Florian Müllner
3451c5a182 extensionUtils: Slightly optimize current extension lookup
When looking for a directory name that matches the extension UUID,
we can just as well use GLib's dirname()/basename() functions
instead of wrapping the path in a GFile.

We also know that the original path corresponds to a regular file
and not a directory, so rearrange the loop to avoid a lookup that
is guaranteed to fail.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2832>
2023-07-15 11:07:12 +00:00
Florian Müllner
3289b79433 extensionUtils: Stop using RegExp for stack parsing
We currently use a regular expression to extract the exact file path
from a stack line. That RE is no longer accurate:

 - we assume a line number at the end, but at one point the column
   number was added as well
 - stacks from ES modules use file:// URIs instead of plain paths

Luckily that doesn't matter: We don't want to access any actual
files, so all we need is a path that can be traversed and that
contains the UUID.

We can get that with simple string manipulation, so avoid the regex
overhead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2832>
2023-07-15 11:07:12 +00:00
Evan Welsh
c2c4d84fc1 dependencies: Migrate to ES module and organize dependencies
gi modules are always loaded (there is no API for "set version without
loading"), so
we need to break dependencies.js into three sections:

- Required
- Compile-time optional
- Runtime optional

Required dependencies are always imported, compile-time optional
dependencies
are loaded if gnome-shell is compiled with support for them, and for
runtime optional dependencies we catch any errors when attempting to
load them.
If runtime optional dependencies fail to load we log a debug-level
message.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
2023-07-15 02:35:56 +00:00
Evan Welsh
7a5f1e5c9e layout: Add catch when asynchronously setting up the startup animation
This ensures any errors that occur in this stage of startup are clearly
logged.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
2023-07-15 02:35:56 +00:00
Evan Welsh
3f12f3a87c scripting: Convert to ES module and migrate tests
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
2023-07-15 02:35:56 +00:00
Evan Welsh
9a2c3da868 environment: Port environment.js to be an ES module
Removes the init() function in favor of executing all environment
changes when the file is imported.

Additionally ports all unit tests using imports.gi.environment.init() to
use the updated module.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
2023-07-15 02:35:56 +00:00
Florian Müllner
011ac6f83c dependencies: Specify versions of Shell/St
We started to version them last cycle, so docs can be differentiated
between versions. It is not *expected* that two versions show up
on the same system, but then it also doesn't hurt handling it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
2023-07-15 02:35:56 +00:00
Evan Welsh
e2e3694cbd environment: Split dependencies loading into a new file
Once environment.js is an ES module we need to ensure we can dynamically
specify the version for required GI dependencies such as Clutter.

Moving dependency version setup to dependencies.js ensures gi.require
calls are done before environment.js imports any utilities.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
2023-07-15 02:35:56 +00:00
Evan Welsh
87d1248dc1 animationUtils: Group together various animation helpers
The environment module is used to initialize the environment, yet it
currently also defines the adjustAnimationTime() function.

Ideally it should not export any utility functions, in particular
once converted to ESM.

The function cannot be moved to the existing Utils module, as that
depends on an initialized environment, and can therefore not be
imported from environment.js, so use that opportunity to group
together several animation helpers in a new animationUtils module.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
2023-07-15 02:35:56 +00:00
Florian Müllner
7eafc248cd lookingGlass: Evaluate command asynchronously
This allows using await in the command (or the header we
add to it), for example when handling Promises or importing
a module dynamically.

The latter will be crucial when porting to ESM.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2842>
2023-07-14 12:36:53 +00:00
Florian Müllner
85a8a6f46c lookingGlass: Reformat command header
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2842>
2023-07-14 12:36:53 +00:00
Florian Müllner
c0fbd74d07 jsParse: Make getCompletions() asynchronous
Part of the possible completions involves evaluating the part
of the passed in text that looks like an object, so that we
can query it for properties.

Using a Function or eval() for that means that we can only
complete text that does not use `await`. To get over that
limitation, evaluate the text in an AsyncFunction instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2842>
2023-07-14 12:36:53 +00:00
Florian Müllner
13e20e47bf jsParse: Replace eval()
The evil() function is considered eval, replace it like we
already did in looking glass.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2842>
2023-07-14 12:36:53 +00:00
Evan Welsh
a66ffcfc74 jsParse: Use JSDoc to document functions
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2842>
2023-07-14 12:36:53 +00:00
Florian Müllner
561d0d3758 lookingGlass: Handle completions asynchronously
They will actually become asynchronous in a following commit,
prepare for that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2842>
2023-07-14 12:36:53 +00:00
Florian Müllner
03025d7cff lookingGlass: Handle unprintable object
We currently throw an error when encountering a result that cannot
be represented as string, with the prompt appearing somewhat stuck
(the input cannot be committed).

Showing a lame fallback instead at least avoids that issue. When
the object has a typeof 'object' but is not an instanceof Object,
we are likely dealing with an ES module, and can show a slightly
less lame fallback.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2842>
2023-07-14 12:36:53 +00:00
Lukáš Tyrychtr
a5cf08ac55 a11y: Don't create a parent loop for quick settings sliders
Rather than returning the parent container of the slider, which presents
itself as the slider, return the parent of the slider container.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2762>
2023-07-13 18:15:16 +02:00
Carlos Garnacho
04aaa4b67b keyboard: Spawn "tecla" to show keyboard map
This is a modern replacement for gkbd-keyboard-display, stuck in gtk3
and X11 (libxklavier).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2834>
2023-07-11 15:06:19 +02:00
Florian Müllner
d52b1576ac main: Replace custom log function with console
console.log() is implemented with structured logging, and as we
set an appropriate log domain, it's identical to the custom function
bar the custom fields with extension data.

Few people know about those custom fields, and adding them comes
at a cost, as we end up producing and parsing a stacktrace on
every log() call.

It therefore seems appropriate to drop the custom function, and
turn the global log() symbol into a simple convenience alias for
console.log().

If it turns out that people do miss the custom fields, we can add
an alternative to ExtensionUtils.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2830>
2023-07-10 09:59:58 +00:00
Florian Müllner
f07bf7b1b6 main: Remove log compatibility
global.log() hasn't been used since 3.6. It seems extremely unlikely
that any extensions are still using it, not least because `log()` is
more convenient.

Time to move on.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2830>
2023-07-10 09:59:58 +00:00
Florian Müllner
b854c1bdbb extensionSystem: Fix signal disconnection
The ::shutdown signal is on Shell.Global, not Meta.Context 🤦️

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2831>
2023-07-09 22:45:03 +02:00
Evan Welsh
812378a00d dateUtils: Refactor so all utilities use cached local timezone
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2827>
2023-07-07 18:58:35 -07:00
Evan Welsh
8d48dc8c6f environment: Remove toLocaleFormat and add dateUtils for date formatting
`toLocaleFormat` is now `formatDateWithCFormatString` and formatTime and
formatTimeSpan are moved into dateUtils.

Instead of overriding system.clearDateCaches, add a helper in dateUtils.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2827>
2023-07-07 18:58:34 -07:00
Evan Welsh
88eb04a42c dateMenu: Fix lint errors prior to refactor
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2827>
2023-07-07 18:32:50 -07:00
Florian Müllner
e7d290bbfb tests: Stop bundling "perf" tests with gnome-shell
Now that scripts are loaded as external modules, there's no reason
anymore for bundling them with the gnome-shell executable. Just
move the scripts into a dedicated folder in tests/ and run them
from there.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2812>
2023-07-07 19:43:28 +02:00
Florian Müllner
bf9b9838c2 main: Pass script on CLI instead of via environment
Environment variables aren't the best option to pass parameters
to a process (wouldn't it be "fun" if SHELL_PERF_MODULE appeared
in a regular user session?).

Instead, use a (hidden) --automation-script command line flag to
specify a script file that should be used to drive an automated
session.

As a side effect, the script no longer has to be relative to the
main module itself, so it will be possible to run scripts that
aren't bundled with the shell sources.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2812>
2023-07-07 19:43:28 +02:00
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
Jonas Dreßler
98cfce0ebe screencastService: Use strings for states
Using strings instead of numbers allows for easier debugging, it means
we can just log the state itself.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 17:17:41 +02:00
Jonas Dreßler
9eea48536a screencastService: Promisify Recorder start/stopRecording functions
This will allow for cleaner error handling in the following commits.

A benefit we get from it right now is having one less callback when
calling startRecording/stopRecording().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 17:17:41 +02:00
Florian Müllner
9711a918e7 status/bluetooth: Use 'Alias' for item labels
Unlike 'Name', the 'Alias' property can be changed by the user,
so it's more suitable for user-visible labels.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2751>
2023-04-25 14:16:42 +00:00
Florian Müllner
94345825a7 portalHelper: Use libadwaita instead of plain Gtk4
This gives us the proper platform stylesheet, as well as support
for dark style and other platform features.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2690>
2023-04-25 10:45:19 +00:00
Florian Müllner
7a4055ec92 portalHelper: Stop using a subtitle
The pattern has become a lot less common, not least indicated
by the removal of the HeaderBar:subtitle property. And in this
case we are including an icon in the subtitle, which looks
completely out of place.

Address this by moving the URL/security information into a
popover menu, inspired by the similar drop-down in GNOME Web.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2690>
2023-04-25 10:45:19 +00:00
Florian Müllner
d796244fb1 portalHelper: Port to Gtk4/WebKit6
WebKit was blocking the portal helper from being ported to Gtk4
together with other external tools. Now that WebKit6 is about to
become stable, the port can go ahead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2690>
2023-04-25 10:45:19 +00:00
Florian Müllner
8cbf620639 portalHelper: Don't use deprecated API during policy decision
NavigationPolicyDecision.get_request() is deprecated, and the
method from the corresponding NavigationAction should be used
instead.

Rearrange the code to do that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2690>
2023-04-25 10:45:19 +00:00
Florian Müllner
f7c8ff7a0c portalHelper: Adjust coding style
Most of the file already complies with the new style. Quickly change
the last remaining bits of legacy style before making further changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2690>
2023-04-25 10:45:19 +00:00
Florian Müllner
6c6e3a8e76 portalHelper: Stop monkey-patching String.format()
It's not used, so no need to set it up.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2690>
2023-04-25 10:45:19 +00:00
Florian Müllner
a1f8f2efa1 portalHelper: Remove pointless destroyWindow() method
Years ago, the function used to clean up the cache when the
window was closed. But now that an ephemeral data manager is
used, nothing is cached anymore and the function is left as
a mere wrapper around this.destroy().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2690>
2023-04-25 10:45:19 +00:00
Automeris naranja
65ec7b3fa8 screenshot: Use independent tooltips for the Screenshot/Screencast buttons
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6189

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2683>
2023-04-25 10:33:58 +00:00
Florian Müllner
9168e2fc63 environment: Remove old compatibility code
St.set_slow_down_factor() has been deprecated for over 3 years
(since 3.34). That's plenty of time for extensions to switch to
St.Settings.get().slow_down_factor.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2743>
2023-04-25 09:52:22 +00:00
Florian Müllner
2815f33458 status/backgroundApps: Show spinner when closing
It can take a little while for an app to quit after the user
clicked the close button, and another for the portal to pick
up the change.

In order to provide feedback to the user that the request is
being handled, replace the close button with a spinner.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2732>
2023-04-25 09:39:52 +00:00
Florian Müllner
d6d6bf727f workspaceThumbnail: Use click action
Now that we have a convenient way of combining a draggable with
a click action, we can port the code without making it more
complicated.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2742>
2023-04-25 09:01:16 +00:00
Florian Müllner
3f9ee9cd5e dnd: Add addClickAction() method
The events that the draggable uses to initiate a drag operation
are the same as the ones a click action consumes for clicks.

It is still possible to combine the two, but it's finicky and far
from being straight-forward. To make this easier, add a dedicated
addClickAction() method to draggables that takes care of the
setup before adding the action to the draggable actor.

In the longer term, we'll want to turn DND into an action, and
have something like GTK's gesture group to allow combining actions
that would otherwise step on each other's toes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2742>
2023-04-25 09:01:16 +00:00
Florian Müllner
a9ba9b7a47 popupMenu: Replace event handlers with click action
Actions provide a higher-level API than event handlers, not unlike
GTK's event controllers (albeit less complete). Allowing them to
take care of the low-level bits where possible is generally a good
idea.

Menu items are a very straight-forward case, with a good amount
of code saving, so port them over.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2742>
2023-04-25 09:01:16 +00:00
Florian Müllner
cd862aa53e panel: Drop unnecessary captured-event handler
The handler dates back to commit 50f248ec5b in 2011, and is
part of the original hack of making the activities button a
PanelMenu.Button while suppressing its menu.

By now, panel buttons without a menu have been properly supported
for years, but somehow that bit of the hack stuck around, even though
it is no longer actually needed (probably since the introduction of
DummyMenu.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2741>
2023-04-25 08:09:02 +00:00
Florian Müllner
b8dcf85cc8 status/volume: Ignore capitalization for headphone detection
When we can't detect a headphone by form factor, we do a string
match on the port name. A match on 'Headphone' isn't less likely
to be valid than a match on 'headphone', so make sure we ignore
capitalization.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2691>
2023-04-21 18:53:00 +00:00
Balló György
1ee070a14b autorunManager: Add missing await keyword
This fixes a regression introduced in commit c6861c0a3d

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2745>
2023-04-21 12:59:55 +00:00
Sebastian Keller
f6a8b63276 search: Expand search results view
Otherwise the search results can end up only as large as their content.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5924
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2744>
2023-04-21 01:08:23 +02:00
Jonas Ådahl
8d1fe3b4cb scripting: Return promise in helper window wait functions
Otherwise they won't wait when doing e.g. `await waitTestWindows();`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:52:01 +02:00
Jonas Ådahl
c2412dbe59 tests/closeWithActiveWindows: Also test input method tear down
From a test case perspective, it's simple - make the test window have a
text entry, and make sure we have a virtual keyboard making GTK3 enable
the text entry. This would without a fix trigger
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6535.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:52:01 +02:00
Jonas Ådahl
8ab344929d js/main: Unset input method on shutdown
After shutdown, the Javascript context will be disposed, so we must make
sure we remain the active input method after this point.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6535
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:52:01 +02:00
Jonas Ådahl
1da8df81c5 perf-helper: Allow creating window with text input
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:52:01 +02:00
Jonas Ådahl
d272b16e50 tests/perf: Add test for shutdown with open window
This would without the applied fix trigger
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6536.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:49:38 +02:00
Jonas Ådahl
2325022d2f scripting: Allow avoiding exiting perf helper
This will help creating test cases where windows are open during
shutdown.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:49:38 +02:00
Florian Müllner
728a94dead popupMenu: Only activate items that still have the pointer
After the introduction of implicit grabs in Clutter, a release
event will now always be delivered to the actor that received
the corresponding press event.

This results in surprising behavior when moving the pointer
while pressed, as a button release will always activate the
original item, even when the pointer moved to a different item
or outside the menu altogether.

Address this by checking the hover state (that is, whether
the item contains the pointer actor) before activating it.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2740>
2023-04-20 12:15:45 +00:00
Sebastian Keller
4bbf6d497d windowPreview: Ignore leave events after being destroyed
When a WindowPreview is being destroyed, the class default handler for
the `destroy` signal is responsible for destroying its child actors.
This happens after the emission of the `destroy` signal, i.e. after
`WindowPreview::_onDestroy()` has been run.

The destruction of the WindowPreview's child actors now triggers a
re-pick, but due to WindowPreview having already being marked as
`CLUTTER_IN_DESTRUCTION`, it will not be picked, resulting in a `leave`
event if the cursor was on top of the WindowPreview at the time
`destroy()` was called on it.

So this leads to `WindowPreview::vfunc_leave_event()` being run after
`WindowPreview::_onDestroy()`, which means the idle started by the leave
event handler will not be removed and ends up accessing actors after
they have already been destroyed.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5512
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6065
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2738>
2023-04-18 19:44:20 +00:00
Marco Trevisan (Treviño)
8bf06bfc9f dash: Do not destroy a dash label twice
Dash labels are children of the main uiGroup and so could be destroyed
before their logical-owner DashItemContainer during shutdown.

This implies that we could destroy them twice. To avoid this, unset them
when destroyed.

This is mostly visible when using dash-to-dock, but it's still
technically possible with upstream code:

** Message: 19:57:49.847: Shutting down GNOME Shell

(gnome-shell:2788214): Gjs-CRITICAL **: 19:57:49.933: Object St.Label
 (0x55b33668eab0), has been already disposed — impossible to access it.
 This might be caused by the object having been destroyed from C code using
something such as destroy(), dispose(), or remove() vfuncs.
  == Stack trace for context 0x55b3345fd3d0 ==
  #0   7ffeabd810d0 b   /data/GNOME/gnome-shell/js/ui/dash.js:86
  #1   55b335b62f88 i   /data/GNOME/JHBUILD_HOME/.local/share/gnome-shell/extensions/dash-to-dock@micxgx.gmail.com/docking.js:487
  #2   7ffeabd838f0 b   self-hosted:1121
  #3   55b335b62ec8 i   /data/GNOME/gnome-shell/js/ui/layout.js:240

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2739>
2023-04-17 20:22:12 +00:00
Florian Müllner
ecb274cee0 panelMenu: Fix keynav of menu-less buttons
The left/right navigation between top bar buttons is usually
handled by a key-press handler on the button's menu.

However when a DummyMenu is used, the button itself serves as
fake menu actor and will get grabbed when "opening" the menu.
Due to that grab, the event is not propagated to the stage,
and regular keynav does not work.

To avoid the focus getting stuck in that case, add an explicit
key-press handler that bypasses the grab.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2734>
2023-04-17 20:09:56 +00:00
msizanoen1
cde7d44a28 messageTray: Don't set _notificationRemoved if destroyed notification is queued
When the user clears all notifications from the notification menu UI, it's
possible for a queued notification to be destroyed after the currently displayed
notification. The removal of the currently displayed notification is not
processed until the notification menu is closed (due to `this._bannerBlocked`).
By then, it's possible that `_notificationRemoved` has already been overwritten
when `_onNotificationDestroy` is invoked with another (queued) notification.

This eventually results in a notification banner that cannot be removed by the
user as the notification object needed to do so has already been destroyed.

Fix this by only assigning to `_notificationRemoved` if `this._notification ==
notification`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2736>
2023-04-17 19:40:45 +00:00
Jonas Dreßler
8431e7ae51 misc/objectManager: Fix emission of object-removed signal
Emitting this signal is broken right now: We check for a length of 0 on
this._objects[objectPath], but the
`this._objects[objectPath][interfaceName] = null` we do before the
check doesn't actually remove the key, it only sets the value to null,
leaving the key around and thus the amount of entries in the object doesn't
change.

Fix that by using the delete statement instead, "delete" properly removes
the key and thus affects the amount of entries in the object, making our
length === 0 check effective.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2730>
2023-04-05 18:43:51 +00:00
Automeris naranja
63d18f3ee9 powerProfiles: Rename "Power Profiles" to "Power Mode"
This changes renames the power profiles submenu title to "Power Mode",
making it consistent with the toggle title.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2697>
2023-04-04 22:09:13 +00:00
Lukáš Tyrychtr
de900af7d5 status/network: Improve a11y of wireless network items
This MR does the following:
* Allows a screen reader user to determine the currently connected network
* Allwos a screen reader to read the security status and signal strength

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2724>
2023-04-04 17:19:55 +00:00
Jordan Petridis
2844f6db17 appFavorite: Add missing .desktop extension for simplescan
Followup to cbecc1dbfd

One line changes are hard.. Was too focused on copy pasting the id
that I omitted the .desktop part.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2728>
2023-03-29 21:51:04 +00:00
Andy Holmes
3cc3a79b7a extensionDownloader: Check schemadir existence and type
When checking for an extension schemadir, an error will be thrown if
`query_info()` is used and the directory is missing.

Catch the case of a missing directory, but throw an error if the
path exists as a non-directory type.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2727>
2023-03-27 21:12:59 +00:00
Lukáš Tyrychtr
95c0a88fe7 status/network: Fix a11y names for VPN connection menu items
Because of an omission, the VPN menu items never got its a11y name,
so a screen reader was reporting that item only as a plain item without
any label.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2720>
2023-03-27 17:01:40 +00:00
Florian Müllner
9a814798d7 quickSettings: Fix icon-name construct property in menu toggles
Both :icon-name and :gicon are propagated to the internal QuickToggle
with property bindings. However the bindings are set up in the wrong
order:

:icon-name is a convenience property to set :gicon to a ThemedIcon
of the given name. That means binding :icon-name first will correctly
set the underlying StIcon's :gicon, but then the :gicon binding will
set it again to null.

Fix this by swapping the order in which the bindings are set up,
so that it works for both properties.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2726>
2023-03-27 14:52:50 +00:00
Adam Williamson
a093a721fa screenshot: Fix broken GLib.Error.matches call
You have to pass a domain and an error code, not just an error
code.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6540

Signed-off-by: Adam Williamson <awilliam@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2725>
2023-03-25 11:57:07 -07:00
Jordan Petridis
cbecc1dbfd appFavorite: Rename simple-scan.desktop
simple-scan app-id will soon be renamed to org.gnome.SimpleScan
and thus we need to add the .desktop file to `RENAMED_DESKTOP_IDS`

https://gitlab.gnome.org/GNOME/simple-scan/-/merge_requests/11

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2723>
2023-03-24 09:48:47 +00:00
Georges Basile Stavracas Neto
9e19f27e45 status/network: Generalize code to hide subtitle
Commit 9d75d777c7 introduced code to hide the subtitle of the
quick setting toggle when it matches the title of the toggle.
That's because NetworkManager tries to make the network names
more palatable on its own, and reports that the name of single
wired networks is "Wired" even if it may have another name.

What that commit failed to account for, however, is that there are
other circumstances where we end up with a subtitle is exactly the
same of the title. For example, when turning off Wi-Fi or mobile
broadband connections.

The behaviour of commit 9d75d777c7 is safe enough to be applied
on other device-backed connections, so do it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2682>
2023-03-21 20:52:31 +00:00
Ivan Molodetskikh
237c3e958d screenshot: Get cursor texture from window
When a window is in the background and should not have the cursor on top
of it, its _cursor will be null. By getting the texture through it, we
add this extra check, which was missing before, leading to a cursor
drawn at 0, 0 on windows where it should not have been drawn.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2702>
2023-03-21 09:46:52 -07:00
Florian Müllner
95386a1423 workspacesView: Update visibility after updating workspaces
When the number of workspaces changes, it is possible that one
of the visible (non-active) workspaces is removed, and another
invisible workspace moves in its place.

Make sure that workspaces are shown as necessary in this case.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2699>
2023-03-21 12:02:52 +00:00
Ivan Molodetskikh
4daea0ccae screenshot: Use meta_window_has_pointer () for pointer check
909616b208 seems to have wrapped window actors in a container, so the actor.has_pointer check started failing. Instead, switch to meta_window_has_pointer () which doesn't rely on window actor implementation details.

We check for existence of has_pointer first just in case someone attempts to run gnome-shell 44.1 with mutter 44.0 which does not have the function exported publicly yet.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2710>
2023-03-21 00:05:39 +00:00
Florian Müllner
5766d4111a modalDialog: Fix fading out dialog
The dialog's state property has been read-only since
commit 2f6323afc, but the callback at the end of the
fade transition still tries to set the value directly.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2696>
2023-03-19 19:54:45 +00:00
Florian Müllner
34712449da endSessionDialog: Catch async errors
Otherwise the actual error is masked by an "unhandled promise
rejection" error, making it harder to track down the underlying
cause.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2696>
2023-03-19 19:54:45 +00:00
Florian Müllner
2f196f4b0b main: Fix syncing animations-enabled
Whether or not animations should be enabled depends on various
factors, some of which may change at runtime. We therefore
track changes, and sync the setting by calling inhibit/uninhibit
as necessary.

Except that we never actually record the new state, so when animations
are disabled, we end up inhibiting them every time
the setting is synced, whoops.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2698>
2023-03-19 13:39:41 +00:00
Florian Müllner
0b8114ba52 extensionSystem: Fix extension reloading
Unloading an extension has become an async operation, but we aren't
awaiting the result. That means that we recreate the extension
object *before* we remove the "old" extension object from the map,
with the effect that the reloaded extension is removed completely.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2694>
2023-03-19 13:26:30 +00:00
Daniel van Vugt
b8013704cf appDisplay: Avoid using an undefined _swipeTracker
It might have been deleted already during shutdown by `_onDestroy()`.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6512
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2693>
2023-03-19 13:12:22 +00:00
Carlos Garnacho
58af42caea screenshot: Fix code typo
Even though commit b89d90eb8 talked about the GLib.BookmarkFile
type, this didn't stop the code from sneaking a silly typo and
refer to this GLib.BookmarksFile (i.e. extra 's').

Fix the code to refer to the right type name and constructor.

Fixes: b89d90eb8 ("screenshot: Use GLib.BookmarkFile to save recent screenshots")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2692>
2023-03-19 13:00:49 +00:00
Will Thompson
ab0c795e81 status/location: Handle geoclue not being activatable
In GNOME OS, due to a misconfiguration, geoclue was configured without
systemd support. In that configuration, geoclue does not install its
systemd .service file (geoclue.service) but it (incorrectly) includes
the following line in its D-Bus service file:

    SystemdService=geoclue.service

As a result, when dbus-daemon tried to activate it at gnome-shell's
request, it would fail with:

    Unit geoclue.service not found

Then, GeoclueAgent._onGeoclueVanished() would be called, as the
name_vanished_handler passed to Gio.bus_watch_name(). This is consistent
with Gio.bus_watch_name()'s documentation:

> You are guaranteed that one of the handlers will be invoked after
> calling this function.

But that function assumed that this._managerProxy is defined, leading
to:

    JS ERROR: TypeError: this._managerProxy is undefined
    _onGeoclueVanished@resource:///org/gnome/shell/ui/status/location.js:163:9

Fix this by checking for nullishness of this._managerProxy. (Strictly
speaking, it's undefined rather than being null, but other code in this
file already uses the vaguer '!= null' test, which considers undefined
to be null.)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2689>
2023-03-19 12:46:50 +00:00
Sebastian Keller
e258cff264 status/bluetooth: Fix bluetooth placeholder text alignment
The padding specified for .bt-menu-placeholder was overridden by the
more specific.popup-menu-item:ltr/rtl padding. Also the ornament, was
still taking up space, as well as the spacing between the ornament and
the text.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6434
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2687>
2023-03-19 12:32:55 +00:00
Florian Müllner
83e7f94513 status/backgroundApps: Add section title
At least for the time being, the background portal's app monitor
only supports flatpak apps, which are the only apps where we can
reliably match processes to .desktop files and assume that they
belong to graphical apps.

To indicate that there may well be apps that don't appear in the
list despite running in the background, add a clarifying section
title.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2681>
2023-03-19 12:06:06 +00:00
Florian Müllner
7fdf9b8a06 Revert "status/backgroundApps: Add section title"
Unfortunately we did not get approval for the string freeze
request, so we have to bail out of the change again.

This reverts commit d6c4039f75.
2023-03-06 18:36:53 +01:00
Florian Müllner
7a1b8f82e0 environment: Disallow all GDK backends
There is only a very limited subset of GTK that is usable from
within the compositor, and by now we should have replacements
for all of them in place.

On the other hands there is plenty that can go catastrophically
wrong in the rest. In particular on wayland, GTK must never open
a wayland display connection.

Make sure that extensions don't do anything silly, by disallowing
all GDK backends.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2680>
2023-03-06 16:31:53 +01:00
Florian Müllner
e702641f41 inhibitShortcutsDialog: Stop using GTK to display shortcut
Instead, switch to the corresponding mutter API.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2676>
2023-03-06 15:08:56 +00:00
Ray Strode
07dfcf4eff endSessionDialog: Don't emit 'closed' until handler is connected
Prior to commit 7bd98f3f5f animation
onComplete handlers always occured at least after one main loop
iteration.

Now, if animations are disabled, they can get invoked immediately.

That breaks the endSessionDialog button handler, which calls
close before setting up the "closed" signal handler.

This commit fixes the handler to get set up first.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2677>
2023-03-05 20:24:02 -05:00
Florian Müllner
7ada79f6d9 iconGrid: Delay updating adjustment value on page switch
When switching to a newly created page, the adjustment's limits
haven't been adjusted yet. As a result, setting the new value
only works when the transition is animated.

To fix the non-animated case, use a MetaLater to set the adjustment
value.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2670>
2023-03-04 16:34:47 +01:00
Florian Müllner
d6c4039f75 status/backgroundApps: Add section title
At least for the time being, the background portal's app monitor
only supports flatpak apps, which are the only apps where we can
reliably match processes to .desktop files and assume that they
belong to graphical apps.

To indicate that there may well be apps that don't appear in the
list despite running in the background, add a clarifying section
title.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2660>
2023-03-03 23:06:42 +00:00
Carlos Garnacho
656efd33af Update to drop GTK3 dependency
There's a few things going on here, that unfortunately must
happen in lockstep:

- The gnome-desktop-3.0 dependency gets replaced by gnome-desktop-4
  and gnome-bg-4. The code in ui/background.js required minor updates.
- The libnma dependency gets replaced by a libnma4 dependency. The
  code in misc/modemManager.js required minor updates.
- The gtk3 dependency is torn down everywhere but tests. Some
  missing GdkPixbuf dependencies had to be added to compensate for
  its lack.
- gtk_init_check() is no longer called

As a result, we replace a hard gtk3 dependency with a soft gtk4
run-time linking one, only added indirectly through gnome-bg-4
and libnma4.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2655>
2023-03-03 20:38:03 +00:00