Commit Graph

430 Commits

Author SHA1 Message Date
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
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
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
sunflowerskater
2d00320a4b general: Rename "application" to "app"
Several places in Shell use the word "application". However,"app"
is a more common term nowadays, so update strings accordingly.

https://gitlab.gnome.org/Teams/Design/initiatives/-/issues/123
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6202

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2614>
2023-02-07 14:46:28 +00:00
Jonas Ådahl
d116256e83 main: Call init() in perf modules if it exists
This is meant to let perf tests initialize themselves earlier than they
would otherwise run.

This allows them to setup the necessary dependencies, e.g. create
test monitors or similar actions.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2623>
2023-02-06 18:10:01 +00:00
Jonas Ådahl
8d68bdaaa1 js: Queue 'later' via MetaLaters
This replaces the meta_later_add() API which used now removed global
singletons under the hood.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2557>
2022-12-16 22:12:59 +01:00
Jonas Ådahl
33d3a65646 ui/main: Allow not inhibiting animations sometimes
When we're running in e.g. CI, or in a virtual machine without hardware
acceleration, and we actually want to enable animations despite the
potential performance implications, change the AnimationsSettings to
only inhibit if we're a XVNC instance or not hardware accelerated if
--force-animations wasn't passed.

Still inhibit animations if there is a remote desktop session that
explicitly disables animations.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2560>
2022-11-29 17:52:56 +01:00
Jonas Ådahl
5bb9843217 ui/main: Don't show welcome screen or root warning with perf tests
If we want to run with the welcome screen showing, it should be done so
explicitly. Hide it if there is a perf test running for now, so that
what we test is what is expected to be tested.

We also don't want to show the root user warning, since we'll be running
as root in the CI containers.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2560>
2022-11-29 17:48:20 +01:00
Evan Welsh
4257fc9522 environment: Remove inline import of extensionUtils
The logging function cannot be asynchronous, so move the override
into main.js where ExtensionUtils can be imported at the top level.
Importing ExtensionUtils in environment.js at the top level is not
possible because it would import Main prematurely.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2363>
2022-07-06 13:40:44 -04:00
Marco Trevisan (Treviño)
71765a1056 js/main: Use warning log level for notifyError
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/697>
2022-07-06 17:14:56 +00:00
Florian Müllner
1cb01ec5b1 main: Add help function for moving window to monitor/workspace
MetaWindow.move_to_monitor() can no longer be assumed to have updated
the monitor on return, as under wayland, if the move involves a size
change, the monitor state will only be updated after the new size has
been synced with the client.

If that happens, trying to change the workspace of the moved window
fails, as it is still considered on-all-workspaces until it leaves
the secondary monitor.

It's possible to work around this by waiting for the window to actually
enter the requested monitor. That's finicky enough to warrant a helper
funtion, so add one.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2259>
2022-03-31 17:56:41 +02:00
Florian Müllner
2b45a01517 cleanup: Use new indentation style for object literals
We have made good progress on object literals as well, although there
are still a lot that use the old style, given how ubiquitous object
literals are.

But the needed reindentation isn't overly intrusive, as changes are
limited to the object literals themselves (i.e. they don't affect
surrounding code).

And given that object literals account for quite a bit of the remaining
differences between regular and legacy rules, doing the transition now
is still worthwhile.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2200>
2022-02-23 12:23:52 +00:00
Ivan Molodetskikh
33cf163f95 main: Move screenshotUI initialization earlier
A new screen recording panel indicator will connect to its signal, so it
needs to be initialized before the panel.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2163>
2022-02-12 14:36:54 +00:00
Florian Müllner
a1dd1b25d8 js: Use templates for non-translatable strings
This reverts commit 9d941f8202 and replaces all additional
instances of .format() that have been added since.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2160>
2022-02-12 12:29:52 +00:00
Florian Müllner
5442266f28 js: Simplify promisify() calls
If the finish function isn't specified, promisify will now try
to use the async name without '_async'/'_begin' suffix (if any)
and '_finish' appended.

Everything except IBus uses a variation of that pattern, so there's
quite a bit of boilerplate we get to remove…

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2174>
2022-02-11 16:24:01 +00:00
Florian Müllner
928f3288e9 js: Stop using Gio._LocalFilePrototype
gjs now supports overriding interface methods, so promisify()
works on Gio.File itself, not just the LocalFilePrototype cludge.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2174>
2022-02-11 16:24:01 +00:00
Sam Hewitt
0e3ddb1f02 theme: Remove icon resources from theme
- move all icons to the icons directory
- rename some icons to be more meaningful
- put all icons on a resource sheet
- update references to icon name changes
- deprecate icons for those in standard set

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2141>
2022-02-04 13:59:20 +00:00
Alexander Mikhaylenko
f67418c682 st/settings: Use the new high-contrast gsettings key
We now have a dedicated "high-contrast" setting that we can
use instead of a "magic" theme name.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2069>
2022-02-01 14:11:07 +00:00
Carlos Garnacho
1dcc6d1b6b js/main: Add docs to private function
Oh, well...

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>
2022-01-29 01:32:42 +01:00
Carlos Garnacho
7419674bd3 js: Change main.pushModal to return the Clutter.Grab handle
All callers have been updated to keep this handle to identify their
own grab.

Also, optionally use the windowing state to determine whether
the grab is suitable for the specific uses. This removes the need
to trying to grab twice in the places where we settle for a keyboard
grab.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>
2022-01-29 01:16:30 +01:00
Carlos Garnacho
f4cae72d17 main: Use Clutter.grab() underneath Main.push/popModal
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>
2022-01-29 01:16:29 +01:00
Ivan Molodetskikh
8ebc478f0f Add scaffolding for the new screenshot UI
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>
2022-01-27 22:25:42 +00:00
Joan Torres
f3eb01642f main: Don't terminate remote session in headless mode
Now gnome-shell can know if it is on headless mode
(depends on https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2130) and not terminate
a headless remote session when the session is locked.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2057>
2022-01-08 18:18:55 +00:00
Florian Müllner
aba0d0bb1b main: Warn when unsafe mode is toggled
MetaContext:unsafe-mode was added as a debugging tool to temporarily
remove restrictions on privileged APIs. But as it turns out, there
are now extensions that toggle the property permanently. Right now
none of them are malicious (as far as I can see), but it's still a
bad idea and should be discouraged.

Do this with a notification that warns the user when unsafe mode is
enabled non-interactively (i.e. via looking glass), and hopefully
also clarifies what the weird lock icon in the top bar is about.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2050>
2021-11-26 16:14:39 +00: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
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
Florian Müllner
e6be180df1 main: Use session mode property for welcome dialog
We only want to show the welcome dialog in the user session, not
on the login screen or during initial setup. We currently achieve
that by explicitly checking for those mode names, but there are
other modes like gnome-classic where the dialog is equally un-
helpful. Support those cases by adding a session mode property
that determines whether the welcome dialog should be enabled,
so that modes can opt in or out of the feature themselves.

(Both the 'gdm' and 'initial-setup' modes are based on the
'restricted' mode, so this change does not affect them)

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1793>
2021-04-06 18:57:39 +00:00
Florian Müllner
1ad45a8232 overviewControls: Handle overlay key
It's where all the fun state is handled now, so move the super-key
handling there as well, in preparation of making it a bit more
sophisticated.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1736>
2021-03-02 15:36:26 +01:00
Bastien Nocera
512016dcb5 main: Show welcome dialogue on first start
This hooks the recently added welcome dialogue to be shown the first
time a new session is started, and disabled after that.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3632
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1619>
2021-02-05 13:41:26 +00:00
Bastien Nocera
af4e54bfc9 welcomeDialog: Add “welcome” dialog
As designed at:
https://gitlab.gnome.org/Teams/Design/os-mockups/-/blob/master/greeter/welcome-dialog.png

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3632
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1619>
2021-02-05 13:41:26 +00:00
Jonas Ådahl
2b0731ab81 Move screencasting into a separate service process
Move the screencasting into a separate D-Bus service process, using
PipeWire instead of Clutter API. The service is implemented in
Javascript using the dbusService.js helper, and implements the same API
as was done by screencast.js and the corresponding C code.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1372
2020-07-31 10:51:12 +02:00
Jonas Dreßler
d3880c0bff main: Unset the right prevFocus actor after the focus stack got shifted
When a modal that's not on top of the modalActorFocusStack gets popped,
we shift the focus stack as described in popModal() to ensure the chain
remains correct. That however destroys the association of a modal actor
and its prevFocus actor on the focus stack, because the prevFocus actors
are now moved to different entries of the stack.

Now when a prevFocus actor gets destroyed, we don't handle that case
correctly and search for the modal actor that was associated with the
prevFocus actor before the stack was shifted, which means we end up
unsetting the wrong prevFocus actor.

So fix that and search the stack for the prevFocus actor which is being
destroyed instead to unset the correct entry.

Thanks to Florian Müllner for figuring out the actual issue and
proposing this fix.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2446
2020-04-29 12:40:13 +02:00
Jonas Ådahl
c3646a7642 js/main: Inhibit remote access when depending on session mode
The session mode determines whether the screen casting should work or
not, but until now only dealt with the built in screen cast, not the
ones using PipeWire. Add the newly added API for inhibiting remote
access when the session mode says screencasts are not allowed.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1210
2020-04-27 15:18:18 +00:00
Jonas Ådahl
772df91762 shell/global: Add 'backend' property
Replace all Meta.get_backend() with global.backend. Maybe sooner or
later we can further decrease the amount of singletons handled by
libmutter.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1210
2020-04-27 15:18:18 +00:00
Andy Holmes
3dc4f01113
JS: migrate from the global window to globalThis
As of mozjs68 (gjs-1.64) `globalThis` is recommended over `window` and
it makes more sense in this context anyways. Migrate the few instances
of `window` we use and adjust the eslint configuration.

`window` will continue to resolve to `globalThis`, so this won't affect
extensions or other downstream users.

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

closes #2322
2020-04-26 19:07:02 -07:00
Philip Withnall
3e5b90dbba js: Add support for parental controls filtering to the desktop
Filter the apps shown on the desktop and in search results according to
whether they are blacklisted by the user’s parental controls.

This supports dynamically updating the filter during the user’s session.

This adds an optional dependency on libmalcontent. If that’s unavailable, no
parental controls filtering will occur.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/465
2020-04-07 17:47:29 +02:00
Marco Trevisan (Treviño)
a0def23940 main: Don't override DesktopAppInfo desktop if already GNOME
During the shell initialization we call the (deprecated) function to
override the Desktop environment in Gio DesktopAppInfo to make sure that
applications are correctly shown (as per commit b2fbf5a2), however this
might break the cases in which $XDG_CURRENT_DESKTOP is already set and
contains GNOME (given that is now a list).

In Ubuntu this is in fact set to: ubuntu:GNOME.
Now, if an application contains NotShowIn=ubuntu, the key will be ignored by
the shell, and the application is still listed everywhere.

So, override the DesktopAppInfo desktop environment only in the case that
the current desktop is not already GNOME.

At the current date I think we could just safely get rid of this override at
all, but there could be still cases where it still might be useful, like when
running as nested in some other environment, so keeping it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1156
2020-03-31 20:27:12 +02:00
Florian Müllner
ff844a2a81 main: Do not warn about missing GDM on each login
We now warn on startup if screen locking isn't available, however for
users who choose not to use GDM or logind, repeating the warning on
each login is more annoying than helpful.

Instead, limit the warning to the first login on which the screen lock
became unavailable. That way the notification will still serve the
intended purpose of informing the user, but without being perceived
as nagging.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2432
2020-03-25 20:03:01 +00:00
Florian Müllner
002160e524 main: Unwatch notification proxy name after auto-start
We only "watch" the 'org.gnome.Shell.Notifications' name to start the
service, not to actually monitor name owner changes; so unwatch the
name once that's done.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2381
2020-03-12 23:29:40 +01:00
Florian Müllner
f2df347ddb main: Activate notification proxy on start
At least for the time being, this looks like the easiest option to
launch the service:

 - we could add a systemd unit, but then we'd need to update the
   RequiredComponents in the fallback session definition as well,
   making it necessary for gnome-shell, gnome-shell-extensions and
   gnome-session to be updated to 3.36.1 in lockstep

 - autostart is problematic as it would make gnome-shell conflict
   with other notification daemons; also autostart is most useful
   with automatic shutdown, which would require tracking signal
   subscriber to determine when the service is unused

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/547
2020-03-12 16:09:27 +00:00
Marco Trevisan (Treviño)
7345a6f276 main: Get the theme resource name from sessionMode
Along the lines of `styleSheetName`, a session mode may want to provide its
own gresource file, so make this possible via a `themeResourceName` session
mode parameter, defaulted to gnome-shell-theme.gresource

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1063
2020-03-06 19:09:25 +00:00
Jonas Ådahl
8a1c0f3a42 main: Inhibit animations when there is a remote desktop session
If a remote desktop session asks for animations to be disabled, inhibit
animations while the session is active.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
2020-02-20 11:14:55 +00:00
Jonas Ådahl
4b42879a2c main: Inhibit animations if X server advertises VNC-EXTENSION
This was previously done by gsd-xsettings to disable animations when
running in Xvnc.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
2020-02-20 11:14:55 +00:00
Jonas Ådahl
394121f77d main: Inhibit animations when software rendered
This was previously decided by gsd-xsettings.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
2020-02-20 11:14:55 +00:00
Florian Müllner
9d941f8202 js: Don't use templates in files with translations
xgettext gained some support for template strings, and no longer
fails when encountering '/' somewhere between backticks.

Unfortunately its support is still buggy as hell, and it is now
silently dropping translatable strings, yay. I hate making the
code worse, but until xgettext really gets its shit together,
the only viable way forward seems to be to not use template
strings in any files listed in POTFILES.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1014
2020-02-17 23:20:40 +01:00
Florian Müllner
61210fdae1 cleanup: Use JSDoc for documentation comments
It's a better fit than gtk-doc, and eslint can validate that they
are complete and use correct syntax.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
e44adb92cf cleanup: Avoid unnecessary parentheses
Extra parentheses usually add noise rather than clarity, so avoid
them.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
ebf77748a8 cleanup: Require "dangling" commas
Since ES5, trailing commas in arrays and object literals are valid.
We generally haven't used them so far, but they are actually a good
idea, as they make additions and removals in diffs much cleaner.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
c860409da5 cleanup: Use object shorthand where possible
ES6 allows to omit property names where they match the name of the
assigned variable, which makes code less redunant and thus cleaner.
We will soon enforce that in our eslint rules, so make sure we use
the shorthand wherever possible.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
9eaa0089d0 cleanup: Fix missing/stray spaces
Those are wrong according to our style guidelines, but the previous
eslint ruleset didn't catch them.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00