Commit Graph

8400 Commits

Author SHA1 Message Date
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