Commit Graph

8477 Commits

Author SHA1 Message Date
Ray Strode
d7b1264897 sessionMode: Drop allowExtensions property
Now that we allow extensions at the lock screens, extensions
are allowed for every session mode gnome-shell would typically
change to at runtime.

This means there's little advantage to having an allowExtensions
property in the session mode definition.

This commit simplifies the code a bit by dropping the property.

Third party session modes can still lock down extensions through
gsettings if they need to.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1967>
2021-10-14 18:40:53 +00:00
Ray Strode
2bf31dc49f sessionMode: Allow extensions at the login and unlock screens
Now extensions can specify which session modes they work in,
but specifying the login screen or unlock screen session modes in
an extensions metadata still won't work, because those session
modes disallow extensions.

This commit fixes that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1967>
2021-10-14 18:40:53 +00:00
Ray Strode
242cff7abf extensionSystem: Allow extensions to run on the login screen
At the moment it's not realy possible to extend the login screen to do
things it doesn't have built-in support for. This means in order
to support niche use cases, those cases have to change the main
code base. For instance, oVirt and Vmware deployments want to be able
to automaticaly log in guest VMs when a user pre-authenticates through a
console on a management host. To support those use cases, we added
code to the login screen directly, even though most machines will never
be associated with oVirt or Vmware management hosts.

We also get requests from e.g. government users that need certain features
at the login screen that wouldn't get used much outside of government
deployments. For instance, we've gotten requests that a machine contains
prominently displays that it has "Top Secret" information.

All of these use cases seem like they would better handled via
extensions that could be installed in the specific deployments. The
problem is extensions only run in the user session, and get
disabled at the login screen automatically.

This commit changes that. Now extensions can specify in their metadata
via a new sessionModes property, which modes that want to run in. For
backward compatibility, if an extension doesn't specify which session
modes it works in, its assumed the extension only works in the user
session.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1967>
2021-10-14 18:40:53 +00:00
Ray Strode
7e5ee2c282 extensionSystem: Get rid of _enabled boolean optimization
At the moment a session mode either allows extensions or it doesn't.
If it allows extensions, then the entire available list of
configured extensions get enabled as soon as the session mode is
entered.

Since enabling or disabling extensions is an all or nothing situation,
the code tracks whether extensions are already enabled when entering
the session mode, and if so, avoids iterating through the extension list
needlessly. It does this using a boolean named _enabled.

In the future, the extensions themselves will be given some say on
whether or not they should be enabled in a given session mode. This
means, the configured extension list may contain extensions that
shouldn't be enabled for a given session mode, and the _enabled boolean
will no longer be appropriated.

This commit drops the _enabled boolean optimization.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1967>
2021-10-14 18:40:53 +00:00
Ray Strode
ceee53aa0a unlockDialog: Properly reset auth prompt when showing it
If a user hits escape twice really fast when coming back to
their machine to unlock it, they made end up getting presented
with a non-functional unlock screen that doesn't show their
user icon and doesn't ask for a password.

This is because showPrompt assumes that if an auth prompt already
exists, it's ready to go. That may not be true, if it's in the
process of getting torn down at the time because it's in the middle
of a cancel animation.

This commit solves the problem by ensuring the auth prompt is always
in a fresh reset state before showing it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1999>
2021-10-08 11:56:23 -04:00
Ray Strode
5d5bfe492c unlockDialog: Don't create AuthDialog just to finish it
If the the unlock dialog gets finished before an auth dialog is
created, the code currently creates one just to tell it to finish.

This commit changes the code to skip creating the auth dialog in
that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1999>
2021-10-08 11:13:11 -04:00
Florian Müllner
4d1ce0de41 notificationDaemon: Fix sound-file support
When commit 25bfe99ed5 replaced the thin libcanberra wrapper
with the (then) new MetaSoundPlayer API, it missed that the latter
expects files as GFile instead of a file path.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1991>
2021-10-06 17:39:01 +00:00
Florian Müllner
a3dcdaae30 screenshot: Unrestrict PickColor
Commit dd2cd6286c restricted callers of the screenshot methods to
portal implementations, gnome-settings-daemon and gnome-screenshot.

That restriction does make sense for the actual screenshot methods,
but `PickColor` is actually used by GTK in its color picker (and
therefore may be called from arbitrary applications).

Fix this by unrestricting access to `PickColor` again. Considering that
the method is always interactive, it's not very privacy/security-sensitive
anyway.

https://gitlab.gnome.org/GNOME/gtk/-/issues/4283

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1990>
2021-10-06 17:34:18 +00:00
Florian Müllner
7f77b6f054 welcomeDialog: Fix title translation
Translators translate the format string ('... GNOME %s'), not the
substituted one ('... GNOME 41').

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1998>
2021-10-05 15:05:18 +02:00
Christian Hergert
380d2db1d9 inputMethod: Clear preeditStr before reset
Previously, these were performed in a different order before GNOME 41.
During some other changes they were swapped.

However, this causes both GTK 3 and GTK 4 applications to scroll to
incorrect positions from the preedit change.

Fixes #4647
Fixes GNOME/gtk#4289
Fixes GNOME/gnome-builder#1536
Fixes GNOME/gnome-builder#1531

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1993>
2021-09-30 17:12:02 +00:00
Jonas Ådahl
563437de91 Always assume GLSL is supported
The support for GLSL has been advertised as unconditionally supported by
mutter for a while, and has now lost the 'GLSL' feature completely. Lets
remove the checks.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1985>
2021-09-21 16:37:01 +02:00
Robert Mader
36a1fb78cd windowManager: Use MetaWindowActor.paint_to_content() for window effects
Previously we used `get_image()`, which returned `cairo_surface`,
in order to create a `ClutterContent` with a screenshot of the
`MetaWindowActor`. This added a roundtrip from GPU to CPU memory.

Instead, use the new `paint_to_content()` API which lets us use a
`CoglTexture` directly as source of our `ClutterContent`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1879>
2021-09-04 10:08:10 +00:00
Carlos Garnacho
46f2c29acc inputMethod: Use update-preedit-with-mode signal
This signal announces the preferred commit mode of the preedit text when
the input context is reset. Keep this mode around, and ensure to honor this
mode (e.g. maybe commit the preedit string) whenever the input method would
be reset.

This is delegated to the internal layers, so propagate this mode via
clutter_input_method_set_preedit_text().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1929>
2021-09-03 22:32:36 +00:00
Florian Müllner
dd2cd6286c screenshot: Restrict callers
The shell D-Bus API was always meant as a private API for core
components, so enforce that by limiting caller to a list of
allowed well-known names.

Applications that want to request a screenshot can use the corresponding
desktop portal.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
2021-09-03 21:34:58 +00:00
Florian Müllner
a628bbc485 shellDBus: Restrict callers
The org.gnome.Shell interface provides a private API to other core
components to implement desktop functionalities like Settings or
global keybindings. It is not meant as a public API, so limit it
to a set of expected callers.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
2021-09-03 21:34:58 +00:00
Florian Müllner
3adad0da81 shellDBus: Implement all methods asynchronously
In order to restrict callers, we will need access to the invocation,
not just the unpacked method parameters.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
2021-09-03 21:34:58 +00:00
Florian Müllner
2a3e297218 introspect: Split out DBusSenderChecker
Restricting callers to a list of allowed senders is useful for
other D-Bus services as well, so split out the existing code
into a reusable class.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
2021-09-03 21:34:58 +00:00
Florian Müllner
317f0f5fe0 introspect: Use MetaContext:unsafe-mode instead of setting
The property was added precisely for this purpose, except that its
name isn't tied to the introspect API.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
2021-09-03 21:34:58 +00:00
Florian Müllner
3b9e672a09 introspect: Make invocation check error-based
If we throw an error when the invocation isn't allowed instead of
returning false, we can simply return that error instead of duplicating
the error handling.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
2021-09-03 21:34:58 +00:00
Florian Müllner
7298ee23e9 shellDBus: Use MetaContext:unsafe-mode to restrict Eval()
The Eval() method is unarguably the most sensitive D-Bus method
we expose, since it allows running arbitrary code in the compositor.

It is currently tied to the `development-tools` settings that is
enabled by default. As users have become accustomed to the built-in
commands that are enabled by the same setting (restart, lg, ...),
that default cannot easily be changed.

In order to restrict the method without affecting the rather harmless
commands, guard it by the new MetaContext:unsafe-mode property instead
of the setting.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
2021-09-03 21:34:58 +00:00
Florian Müllner
3bee7c7f4b panel: Show warning indicator when unsafe-mode is on
MetaContext added an unsafe-mode property, which we will use to restrict
a number of privileged operations unless it is enabled. It is meant to
only be enabled temporarily for development/debugging purposes, so add
a scary icon to the top bar as a reminder to turn it off again.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>
2021-09-03 21:34:58 +00:00
Florian Müllner
0fd205ce54 boxpointer: Fix positioning with non-widget sources
Commit 16d371873 lifted the requirement for source actors to be
widgets, then got it wrong :rolling_eyes:

The content box is expected to be in actor coordinates, so the
allocation must be translated to (0, 0).

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1969>
2021-09-01 20:22:58 +00:00
José Expósito
757e766a11 windowManager: Discard workspace scroll smooth events
Since touchpad smooth scroll events with source finger are handled by
the swipeTracker, the workspace scroll handler can focus on discrete
events.

Thanks to Mutter emulating discrete scroll events, see
meta_seat_impl_notify_scroll_continuous_in_impl in meta-seat-impl.c,
it is safe to ignore smooth scroll in the workspace scroll handler
and handle exclusively discrete events.

In addition, once high-resolution scroll events land in Mutter [1], a
mouse will be able generate non emulated smooth scroll events that
should be ignored in favour of the discrete scroll events.
Otherwise, a single mouse wheel click will scroll through multiple
workspaces at once.

[1] https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1959>
2021-09-01 17:25:01 +00:00
Florian Müllner
cd1102ff30 layout: Exclude hidden actors from struts
Currently we only exclude hidden actors from the input region,
but not from struts. This is an oversight that went unnoticed
until now, probably because we didn't consider the work area
in the overview until recently.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1963>
2021-09-01 17:15:40 +00:00
Sebastian Keller
2ee323e37e keyboard: Ensure chrome input region is updated after slide animation
The keyboard is placed outside of the screen when shown and then slides
in via a transition that changes the translate-y property. This
translation does not affect the allocation of the Keyboard actor and as
such does not trigger any of the signals LayoutManager is connected to
to update the input region. This means the input region remains at the
original position of the actor outside of the screen and as a result on
X11 clicks will go through to the underlying window.

There was a workaround for this by queuing a relayout at the end of the
transition, but this stopped working due to optimizations avoiding
unnecessary allocation changes.

This updates that workaround to toggle the visibility of the actor
instead, which is the other signal that LayoutManager reacts to. Once
ClutterActor provides better ways to react to transforms this can
hopefully be removed entirely.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4556
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1955>
2021-09-01 18:37:56 +02:00
Raghuveer Kasaraneni
07579f05f6 dash: Fixes wrong separator position
Sometimes when an icon is dragged and dropped in Dash, one Favourite app icon
can appear to the right of Dash separator. This can happen when available system
resources are low and the PlaceHolder destroy animation is delayed and the
corresponding container child is still present. With this commit the separator
position is calculated correctly, even when the animation is pending.

Fixes #3966, #3799

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1804>
2021-09-01 15:10:14 +00:00
Sebastian Keller
b90a6d6b14 workspace: Move fading minimized windows out of allocation
eee2ccac fixed window opacity being changed outside of transitions but
resulted in the final step of the transition, that would set the window
to fully opaque, being missed.

This change now moves the opacity change entirely out of allocation and
instead follows the adjustment changes directly, which still fixes the
original bug and ensures the opacity is also applied for the last step
in the transition.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4561
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1957>
2021-09-01 15:02:47 +00:00
Evan Welsh
0d8e0025d6 init: Set console log domain
GJS added a console module that extensions may start using. To ensure that
extensions using console.log() and similar functions don't show up as
'Gjs-Console' in users' system logs, we should call setConsoleLogdomain()
with 'GNOME Shell'.

This GJS API addition is only accessible using ECMAScript Modules (ESM),
this commit moves shell startup to a small init.js module and adapts
CI jobs to either handle or ignore it.

We can drop the .jscheckignore file when future versions of SpiderMonkey
allow for compile checks without validating module specifiers.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1958>
2021-09-01 14:55:47 +00:00
Florian Müllner
ef70364e81 cleanup: Replace non-standard ByteArray module
gjs landed support for TextDecoder/TextEncoder. Use those instead
of gjs' own ByteArray module.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1946>
2021-09-01 14:49:30 +00:00
Ivan Molodetskikh
b21b43e318 workspace: Update bg border radius in constructor
Otherwise non-zero initial value of stateAdjustment will produce
incorrect radius.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1964>
2021-09-01 11:01:04 +00:00
Florian Müllner
1d607cf18f build: Add soup2 option
!1940 added support for soup 3, including a fallback to soup 2.4
where the newer version isn't available.

Unfortunately it missed that libgweather has a hidden soup dependency,
and now gnome-shell fails to start if a weather location has been set
up and soup 3 is available.

We don't have a good way to detect that case, so hide the soup 3 support
behind a build option. Distributors are expected to switch it at the
same time as libgweather.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1966>
2021-09-01 12:26:15 +02:00
Florian Müllner
b158e9676d main: Stop handling old 'panel-main-menu' shortcut
It's a shortcut from the GNOME 2 days that few users will remember.
And if anyone really wants to keep it, they can use Settings to
assign <Alt>F1 to 'toggle-overview'.

https://discourse.gnome.org/t/difference-between-show-the-overview-and-show-the-activities-overview-keyboard-shortcuts/6572

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1871>
2021-08-31 19:01:25 +00:00
Ivan Molodetskikh
c6bcc74649 notificationDaemon: Remove rewriteRules
It's not really Shell's business to fix bad app notification contents.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1962>
2021-08-26 14:45:19 +03:00
Ivan Molodetskikh
6c4089025f networkAgent: Fix order of _() and format()
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1961>
2021-08-26 08:19:59 +00:00
Florian Müllner
d562c70f4e environment: Fallback to Soup 2.4
We cannot assume yet that Soup3 is available everywhere. Until that
is the case, allow falling back to Soup 2.4 by imitating the bits
of the Soup3 API we use with monkey-patching.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1940>
2021-08-25 01:54:07 +02:00
Florian Müllner
ae90b50dc7 extensionDownloader: Port to Soup3
After 13 years, Soup will release a new, API-incompatible
version[0]. This is a good thing, make sure we support it.

[0] https://blog.tingping.se/2021/02/23/future-of-libsoup.html

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1940>
2021-08-25 01:54:07 +02:00
Florian Müllner
3ad569f426 extensionDownloader: Use plain Soup.Session
Unlike for the old Soup.SessionSync/SessionAsync classes,
Soup.Session:ssl-use-system-ca-file already defaults to true.

In Soup3, the behavior was made unconditional and the property
removed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1940>
2021-08-25 01:54:07 +02:00
Florian Müllner
f14960ff03 extensionDownloader: Stop setting proxy resolver explicitly
Quoting the documentation:

  In libsoup 2.44 and later, you can set the session's “proxy-resolver”
  property to the resolver returned by g_proxy_resolver_get_default() to
  get the same effect. Note that for "plain" SoupSessions (ie, not
  SoupSessionAsync or SoupSessionSync), this is done for you automatically.

libsoup 2.44 was released in 2013, so we can safely assume that Soup is
new enough to handle this for us.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1940>
2021-08-25 01:54:07 +02:00
Florian Müllner
50a14caf1b portalHelper: Replace Soup.URI with GLib.Uri
GLib.Uri was added a while ago, and can replace our usage of Soup.URI.
In fact, the upcoming Soup3 drops its own URI type in favor of GLib.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1940>
2021-08-25 01:54:07 +02:00
Florian Müllner
6bf20837c0 extensionDownloader: Use async code for extracting archive
The code that handles extracting extension archives currently uses
an awkward double-callback system. We can do significantly better
by using an async function and exceptions.

Partially based on code from Marco Trevisan.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1940>
2021-08-25 01:54:07 +02:00
Florian Müllner
f16fda5ea1 extensionDownloader: Stop returning distinct errors
Nothing looks at our made-up errors, so we can just as well return
a generic "ExtensionError".

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1940>
2021-08-24 15:48:04 +00:00
Florian Müllner
b3bdcbcf3f extensionDownloader: Fix up style
Move all remaining bits to the new coding style before making
further changes.

The let → const changes are selectively done to the bits that'll
still be around at the end of the patch series.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1940>
2021-08-24 15:48:04 +00:00
Florian Müllner
0b8514dc7d messageTray: Do not show low priority notifications
Low priority notifications are meant for information that doesn't require
immediate attention, so it makes sense to not show a banner for them;
they'll still appear in the notification list in the calendar.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1893>
2021-08-22 19:20:37 +00:00
Daniel van Vugt
88b2c9a046 windowManager: Animate the appearance of new windows after overview closes
So that the animation doesn't get skipped if the overview is visible but
in the process of closing.

In this case the overview being visible also means that it is closing,
because if it's visible and not already closing then `_shouldAnimateActor`
would have returned false and exited `_mapWindow` earlier.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1814,
       https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3242

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1440>
2021-08-19 15:53:57 +08:00
Daniel van Vugt
956db078c3 overview: Emit 'hidden' after it's *really* hidden
Previously we would emit 'hidden' before the overview was fully hidden,
so any attempts to animate windows on that signal could still fail.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1440>
2021-08-19 15:44:34 +08:00
Daniel van Vugt
ea9c4e589d windowManager: Allow animations to start if the overview is closing
So the `WindowManager._mapWindow` animation doesn't get skipped if the
overview is visible but closing.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1440>
2021-08-19 15:44:34 +08:00
Daniel van Vugt
7c1b30b272 workspace: Ignore new windows that appear while the overview is closing
This can easily happen if an app launches and maps a window faster than
the overview closes. We don't want the window clone appearing and then
suddenly disappearing in that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1440>
2021-08-19 15:44:34 +08:00
Daniel van Vugt
74d0b066e9 overview: Add a 'closing' getter
Which better communicates what we are checking for, and is a little more
elegant than repeatedly writing:
```
Main.overview.animationInProgress && Main.overview.visibleTarget == false
```

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1440>
2021-08-19 15:44:34 +08:00
Daniel van Vugt
af03314f20 magnifier: Avoid painting a desktop that's fully occluded by its clone
This significantly reduces the render time for fullscreen zoom mode.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3305
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1899>
2021-08-18 14:12:34 +00:00
nitinosiris
a4d2f5d8b4 windowMenu: Use consistent terminology
Because we don't have a dock or panel to minimize to, the `minimize`
shortcut was renamed to `hide` a long time ago.

Likewise, `unmaximize` appears as `restore` in keyboard shortcuts.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1834>
2021-08-18 00:43:12 +02:00
Florian Müllner
b496c9f956 appDisplay: Replace AppIconMenu
We are finally ready to share the app menu between the top bar and
context menus in the dash/app grid. Notably that means that it is
now possible to quit an app from its context menu.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
414ed9128f appMenu: Support launching on the non-default GPU
Changing the GPU to launch an app on is the last feature from the
app context menu that is still missing. Add support for it now,
and we are ready for some unifying cleanup!

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
bba799a70c appMenu: Remove separator between "new window" and actions
We hide our own "New Window" item if the app itself includes a
"new-window" action. That means that the separator between the
built-in item and desktop actions introduces a small inconsistency
depending on whether a "New Window" item is provided by the desktop
action or ourselves. There's no good reason for that from a user's
perspective, so remove the separator.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
0cde447891 appMenu: Optionally include favorites section
The context menu in the overview includes actions for managing
favorites. Add those to the AppMenu class, but make it another
option as the actions would be slightly weird in the top bar menu.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
e3c06e3c77 appMenu: Update "new-window" item on state changes
Stopped apps can *always* open a new window, so before we start
using the menu for non-running apps, make sure to hide the menu
item as necessary.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
321e07c3c6 appMenu: Only show 'Quit' for running apps
The top bar menu always corresponds to a running app, so it made
sense to include the 'Quit' item unconditionally. That won't be
the case for the overview context menus, so handle app state changes
and show/hide the item as necessary.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
991d9597e0 appMenu: Allow showing the window section for all windows
Since commit fd0da9606f, we only show the "Open Windows" section
if there are at least two windows. That's another subtle difference
with the overview context menus, but while limiting the section to
a minimum of two windows makes sense where the menu always represents
a running app, it is useful to show the section even for single windows
in the dash/app grid.

Account for both uses cases by adding a corresponding option to the
constructor.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
8b1e1834f0 appMenu: Only include non-skip-taskbar windows
There's a subtle difference between the top bar menu and the app
icon context menus in the overview regarding the "Open Window"
section.

The former includes skip-taskbar windows, the latter doesn't. It
clearly doesn't make sense for the context menu to include windows
that aren't shown in the overview, but skip-taskbar windows are
likely also less useful in the top bar menu.

Just settle on the behavior of the context menus and move on.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
c809a87412 appMenu: Do launch animation if supported by source
Likewise any launch actions should animate the corresponding launcher
(if the menu is associated with a launcher).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
b3861ca693 appMenu: Hide overview when activating apps
This is the expected behavior when activating a window or app. Until
now we could rely on the menu being hidden in the overview, but as
that is about to change, make sure the menu behaves as expected.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
958fb6fddc appsMenu: Add side parameter
In order to re-use the menu in the overview, we must be able to
change the side of the arrow, so expose the parent class parameter.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
0f5881788c appMenu: Delay window sections update when selecting window
App windows are ordered by recency, so a focus change (correctly)
triggers the ::window-changed signal. If we rebuild the section
immediately in response, the activating item will be destroyed
before the menu's ::activate handler, with the result that the
menu remains open.

Defer the section update in that case to allow the menu to process
the ::activate signal first.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
07daa95393 appMenu: Clean up on destroy
For now the menu is only used in the top bar, where we can assume
that it exists "forever". This won't be the case when we start
reusing it elsewhere, so make sure we clean up after ourselves.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
1550976c51 appMenu: Split out from panel
There is a big overlap between the app menu in the top bar and the
context menu of app icons. It makes sense to unify the two both
from a design- and from a code perspective, so split out the more
modern one into a separate module as basis for a shared class.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Florian Müllner
5e90e8d385 appDisplay: Remove unnecessary unmapped handler
Since commit 35494f5d08, all menus are closed when their source
gets unmapped.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
2021-08-16 21:28:22 +00:00
Sebastian Keller
5791e257e7 screenShield: Asyncify _syncInhibitor()
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4553
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1952>
2021-08-16 02:44:36 +02:00
Sebastian Keller
85075192f3 screenShield: Close inhibitors that finished creation after uninhibition
There was a potential issue when suspend was inhibited and immediately
uninhibited again before the creation of the inhibitor has finished.
Then the new inhibitor would be kept active.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1927>
2021-08-16 00:28:52 +00:00
Sebastian Keller
fb313033ea screenShield: Don't unnecessarily close or recreate inhibitors
ScreenShield::_syncInhibitor() was closing (and recreating) the
inhibitor everytime it was called, even if no change was needed.
This gets called in various places, including on property changes in
the login1 dbus object. These happen by the time logind already started
suspending at which point new inhibitors can no longer be created. It is
only waiting for existing inhibitors to be closed, so closing the
inhibitor without a new inhibitor will cause the suspending to proceed
immediately if no other inhibitors are present. This can also happen
before the lock screen is shown, which will then complete after resume.

Fix this by keeping track of the expected inhibition state and only
create or close inhibitors if there was a change to that.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1927>
2021-08-16 00:28:52 +00:00
Florian Müllner
1deb13e1aa extensionUtils: Add gettext convenience helpers
We have initTranslations() for binding an extension's
gettext domain, but nothing to help with using gettext
from an extension.

Such help would be useful though, as an extension that
calls textdomain() like a normal application would
inadvertently changes the default domain for the whole
gnome-shell process.

Instead, extensions have to use domain-specific versions
of the gettext functions:

```js
const Gettext = imports.gettext.domain('my-extension');
const _ = Gettext.gettext;
```

Make this a bit easier by adding those functions directly
to the extensions object when initTranslations() is called,
then expose helper functions for calling them.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1941>
2021-08-14 18:45:25 +00:00
Mohammed Sadiq
3495873c90 status/network: Use wwan settings panel for GSM/LTE Modems
GSM/UMTS/LTE modems now have better support with wwan panel in GNOME
Settings.  So, if the modem supports, open wwan panel, otherwise
fallback to opening network panel when "Mobile Broadband Settings"
item is clicked.

See https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/583

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1942>
2021-08-14 10:39:56 +00:00
Florian Müllner
4b4d422c1e iconGrid: Bail out when not on a monitor
There shouldn't be any code that calls zoomOutActor() without
a monitor, but throwing in an early return doesn't hurt.

CID 351285.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1950>
2021-08-13 15:16:54 +02:00
Florian Müllner
46b0d3f6cc workspacesView: Handle null return value
We are not going to process key events while updating views,
but coverity complains (CID 351269)...

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1950>
2021-08-13 15:16:54 +02:00
Florian Müllner
5b3036a6bf appDisplay: Handle null value
The value can not actually be null at that point, but it's too
hard to spot for tools like coverity:
 - before setting view, we chain up to the parent's acceptDrop()
 - that calls _canAccept(), which we override and check for the view

Still, and extra ? doesn't hurt, and hopefully will make the tooling
happy.

CID 351269

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1950>
2021-08-13 15:16:54 +02:00
Florian Müllner
941419e165 appDisplay: Fix dead error handling
gjs includes an override to turn GSettings' asserts into exceptions,
but we'll have to catch that instead of checking for a null return
value.

Spotted by coverity in CID 351268.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1950>
2021-08-13 15:16:54 +02:00
Florian Müllner
6f7df32b0e boxpointer: Fix coordinate
Eeeks. Spotted by coverity in CID 351259.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1950>
2021-08-13 15:16:54 +02:00
Florian Müllner
474fd47fc0 telepathyClient: Fix a typo
Whoops, that notifiction was never shown.

Spotted by coverity in CID 351223.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1950>
2021-08-13 15:16:54 +02:00
Florian Müllner
c6b72ccd15 status/location: Change permission table
There is now a location portal that provides a similar role
as our agent. Settings supports that portal in its application
panel, which allows users to revisit their choice later.

Unfortunately it uses a different permission store table, so
any permissions granted (or denied) through our agent won't
show up there.

To change that, switch to the same table as the portal/Settings.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1945>
2021-08-12 22:39:45 +00:00
Daniel van Vugt
cc2af75fb4 workspace: Remove skip-taskbar windows while the overview is shown
On startup desktop-icons-ng Wayland windows have skip-taskbar==FALSE so
initially pass `_isOverviewWindow` and they get added to the overview,
which is confusing to users. However almost immediately after that they
get `meta_wayland_client_hide_from_window_list` and are removed from
future overviews. So now we respond to `notify::skip-taskbar` immediately
and prevent desktop-icons-ng appearing in the startup overview too.

This is messy and ideally we'd like to know the window type immediately
on creation, but that option only exists in X11 and not Wayland.

https://gitlab.com/rastersoft/desktop-icons-ng/-/issues/137
https://bugs.launchpad.net/bugs/1936643

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1925>
2021-08-11 15:15:03 +00:00
Florian Müllner
26dc0fcd32 appDisplay: Avoid a warning
At least the last stable release of gjs has an issue with async
handlers for custom (i.e. defined in JS) GObject signals.

The handler still works, but evoking it prints the following warning:

  JS ERROR: Error: Could not guess unspecified GValue type

We can avoid the warning by using the addAction() convenience
method, which makes for a small nice cleanup anyway.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1938>
2021-08-09 14:08:09 +00:00
Florian Müllner
19fc6ef5dd powerProfiles: Tweak profile names
After some more discussion, we settled on slightly different
profile names.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1939>
2021-08-09 13:50:13 +00:00
Florian Müllner
f1320bd250 status/powerProfiles: Add power mode selection
Settings' power panel gained support for switchable power profiles
in GNOME 40. It's useful to have that functionality more readily
available, so expose it in the system status menu as well.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1907>
2021-08-02 16:41:06 +02:00
Florian Müllner
8f42053b5f magnifier: Small cleanup
Use an early return instead of a big if() block to cut down on
indentation.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1932>
2021-07-31 17:18:08 +00:00
Florian Müllner
77b175e763 magnifier: Remove unused return value
Before the introduction of PointerWatcher, the method was used as
a timeout handler. That hasn't been the case since 2012, so drop
the return value.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1932>
2021-07-31 17:18:08 +00:00
Florian Müllner
1ea4d72fe5 magnifier: Don't query pointer unless necessary
The PointerWatcher passes the current pointer position to every watch,
so we don't have to query the pointer again scrollToMousePos() is used
as watch callback.

While that should be the only use, be conservative and still query the
pointer when called without arguments.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1932>
2021-07-31 17:18:08 +00:00
Ray Strode
a4123887c1 shellEntry: Don't show "Show Password" menu if entry icon is disabled
Right now the Show Password menu is shown unconditionally for password
entries, ignoring the org.gnome.desktop.lockdown disable-show-password
key.

StShellEntry now honors that key for its peek icon, and there's little
reason for the peek icon and the menu to ever be out of sync.

This commit forces the menu and the icon to always be in sync, and
so makes the menu lock down work automatically, too.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/687>
2021-07-30 14:17:07 +00:00
Jonas Dreßler
67596e7c83 Revert "workspaceAnimation: Allow long swipes in session"
The behavior when switching workspaces now with the touchpad gesture is
very very weird, it almost always swipes to the last workspace instead
of the next one.

So revert this change again and only swipe a single page per gesture. We
can enable long swipes again when we've figured out a proper way to
detect what the user wants (which is going to be quite challenging), see
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4355.

This reverts commit dfae3281b9.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1933>
2021-07-30 13:46:35 +00:00
Sebastian Keller
bb8daaeb2f keyboard: Use microseconds for notify_keyval()
ClutterVirtualInputDevice::notify_keyval() expects time to be in
microseconds but Clutter::get_current_event_time() returns the time in
milliseconds. On Wayland the generated event triggers all the warnings
in MetaDisplay::sanity_check_timestamps() due to the event time
seemingly being in the past.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1926>
2021-07-29 20:18:51 +00:00
Sebastian Keller
eee2ccac7a workspace: Only change opacity of minimized windows during transitions
Dragging a window preview in the overview is supposed to change the
opacity of the dragged actor. This however fails for minimized windows,
because Workspace::allocate() also changes the opacity of those. The
allocation gets triggered by removing the window actor from the
workspace when starting the drag. Avoid this by only changing the
opacity during the overview transitions.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1847>
2021-07-23 12:38:12 +02:00
Ray Strode
118d556991 unlockDialog: Honor switch user lockdown settings
At the moment user switching functionality is controlled by two
settings:

org.gnome.desktop.lockdown disable-user-switching

for the panel when the session is unlocked, and

org.gnome.desktop.screensaver user-switch-enabled

for the unlock dialog when the session is locked.

Having the lockdown setting not apply when the screen is
locked is counterintuitive.

This commit makes the unlock dialog honor both settings.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1833>
2021-07-22 16:17:29 -04:00
vanadiae
25ece58538 theme: Add focus indication for dnd switch in message list controls
It currently is difficult to see what's being focused in the messages list
currently because of that.

Fixes #2447

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1920>
2021-07-20 20:58:59 +02:00
vanadiae
7dd7714fd2 popupMenu: Remove can_focus=True from Switch
Since this is a bin and not a button, and it doesn't have any click/keyboard
handling on its own (as in that case it needs a parent button wired like in
the messages list controls), it is confusing that it has can_focus set to
True. To avoid any confusion, this commit removes it without breaking anything
since it had no real use.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1920>
2021-07-20 14:11:28 +02:00
Florian Müllner
df76c3fd11 Update links to use HEAD instead of master
That way the link will keep working when projects change their
default branch name.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1914>
2021-07-18 21:45:46 +00:00
Florian Müllner
56da0f6561 js: Replace removed Meta.quit()
This one was moved to Meta.Context as well.

I don't know why the `debugexit` command quit with an error code
(it dates back all the way to commit 98bd590a5d). Terminating on
request by the user doesn't sound like an error, so don't replicate
that particular behavior.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1917>
2021-07-18 23:11:43 +02:00
Florian Müllner
d8be637dca main: Replace Meta.register_with_session()
The functionality moved into the new Meta.Context.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1917>
2021-07-18 23:11:43 +02:00
Ian Douglas Scott
e3a1d84992 location: Split Location.Indicator into a seperate GeoclueAgent
Before this, creating a separate instance of `Location.Indicator` failed
because it tries to create export the same DBus path.

This is useful for extensions adding panels on multiple monitors. But
it also seems like a cleaner design to separate the indicator widget
from the logically separate role as a Geoclue agent.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1919>
2021-07-16 17:51:17 -07:00
Ian Douglas Scott
51a8bbddd5 location: Add GObject properties to Location.Indicator
Makes `enabled`, `in-use`, and `max-accuracy-level` GObject properties
that can be used for property binding, etc.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1919>
2021-07-16 16:07:30 -07:00
Marco Trevisan (Treviño)
81a1e294f8 ControlsManagerLayout: Allocate respecting the work area
We build controls layout using the whole monitor vertical space as
available, however extensions or external apps in X11 may reduce the
workarea size horizontally and the shell should always take care of it.

Given that we're already assuming that the allocation is monitor-based
and that we're adjusting it to the workarea, we can just make it more
explicit by using a workarea box that is used as the allocation area.

As per this, we also apply the same logic of applied to the vertical
dimension to the horizontal one.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1892>
2021-07-17 00:25:50 +02:00
Marco Trevisan (Treviño)
2b074882f4 ControlsManagerLayout: Consider workarea height for the available space
We always consider the whole workarea space to be available when
computing the controls manager layout, however this may not be the truth
when using extensions such as Window List which are reducing the work
area size.

So take care of it, reducing the box height.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4330
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1892>
2021-07-17 00:25:50 +02:00
Marco Trevisan (Treviño)
f164e08688 ControlsManagerLayout: Use the workarea size to compute the available height
To compute the available height for the layout we're currently using the
panel position, while this works for the current and default setup, the
shell may be configured to use a different workarea, so we should rely on
it to compute the available space, instead of a specific widget.

So get the current monitor index for the current view and use its coordinates
instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1892>
2021-07-17 00:25:50 +02:00
Marco Trevisan (Treviño)
f30fa1adc7 WorkspaceBackground: Fully take care of workarea geometry on allocation
The background group is currently allocated taking care of the workarea
x, y offset but not of its width/height and this may lead to building a
wrongly sized workspace view when the workarea size is not matching the
monitor size (like when there are struts set).

So, take care of the difference between the workarea and monitor
absolute end coordinates to allocate the background scaled content box.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1892>
2021-07-17 00:25:50 +02:00