Commit Graph

387 Commits

Author SHA1 Message Date
Popax21
461bbcff15 modemManager: Add property getters
gjs improved its default property getter/setters, and as a result it
is no longer possible to set read-only properties.

Add proper getters (backed by private properties) to fix the resulting
errors.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3203
2020-11-03 16:35:43 +01:00
Florian Müllner
6b1e2df589 extensionUtils: Adjust version check
With the new versioning scheme, the previously-minor version gets
shifted up to major, and unstable releases are marked by non-numeric
"versions" rather than uneven numbers. Reflect that in the extension
version check.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1456
2020-10-06 15:06:09 +02:00
Florian Müllner
b2d6c11ec3 systemActions: Filter out empty (folded) terms
We split the search string into words using whitespace, while
GLib.tokenize_and_fold() splits on any non-alphanumeric characters.

That is, a valid search term like ',' will be tokenized as [], so
the original non-empty terms may get mapped to an empty array.

And as [].every() returns true for any condition[0], we end up
matching *all* system actions in that case. We want the exact
opposite and not return any results, so handle that case explicitly.

[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3169
2020-09-14 21:10:58 +00:00
Florian Müllner
59ade00b94 systemActions: Flatten folded search terms
GLib.str_tokenize_and_fold() returns an array rather than a string
(the "tokenize" bit), so flatten the folded search terms like we
do for keywords.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3169
2020-09-14 21:10:58 +00:00
Carlos Garnacho
497f10178c systemActions: Use PanelOrientationManaged to manage autorotation
Track this new org.gnome.Mutter.DisplayConfig property, so the
autorotation UI is shown/hidden according to both accelerometer
availability and touch-mode.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1311
2020-09-05 07:24:54 +00:00
Florian Müllner
0b56416d30 sytemActions: Add separate 'restart' action
In order to split restart and power-off in the system menu, we need
to separate the underlying actions as well.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2202
2020-08-10 15:36:26 +00:00
Florian Müllner
0c5716b018 systemActions: Reindent properties
... so we can add another property using the new coding style
without making surrounding code terribly inconsistent.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2202
2020-08-10 15:36:26 +00:00
Hans de Goede
2af7264cff LoginManager: Add canRebootToBootLoaderMenu and setRebootToBootLoaderMenu methods
Add wrappers for the new logind Manager CanRebootToBootLoaderMenu and
SetRebootToBootLoaderMenu dbus methods.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/199
2020-08-06 15:14:42 +02:00
Olivier Fourdan
3541a57570 cleanup: remove controversial naming
Replace "whitelist" and "blacklist" with "allow" and "deny" in variable
naming, which better represents the purpose of those variables.

There is no functional change.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1393
2020-08-04 13:24:50 +02: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 Ådahl
a9b803f075 introspect: Introspect screen size
To be used by the screen cast service.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1372
2020-07-31 10:51:12 +02:00
Jonas Dreßler
f0ee9cdcf8 util: Remove unused class CloseButton
This looks like it was used to create the close buttons in the overview
at some point, we're no longer using it nowadays though, so remove it.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1298
2020-06-11 20:49:31 +02:00
Amr Ibrahim
7d60f418e7 systemActions: Use 'system-log-out-symbolic' for logout
Changing the icon to 'system-log-out-symbolic' has no visual
change in a default GNOME setup since both 'system-log-out-symbolic'
and 'application-exit-symbolic' are the same in adwaita-icon-theme
(at the time of writing), however, other icon themes differentiate
between the two icons so pointing to the appropriate icon name
is the right thing to do.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2751
2020-05-07 19:19:32 +00:00
Ting-Wei Lan
e08a4acd06 ibusManager: Fix the panel after porting to Promises
Commit 764527c8c9 not only ports this file
to Promises but also changes the behavior of _initPanelService method.
Instead of always calling _updateReadiness when _panelService is ready,
it only calls it when get_global_engine_async succeeds.

The only callers of _updateReadiness are _initEngines and
_initPanelService. Assume that _initEngines completes first. Its
_updateReadiness call keeps _ready as false and it is expected for
_initPanelService to change it to true. However, since
get_global_engine_async fails because there is no active engine,
_initPanelService never calls _updateReadiness. Therefore, all setEngine
calls do nothing because _ready is false, and the input method panel
never shows. Users are unable to use any input method even if they can
see that ibus-daemon is already running.

Fix the issue by changing it back to the old behavior.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1235
2020-05-03 23:26:39 +08:00
Florian Müllner
153b7d525d cleanup: Don't linebreak before closing parentheses
Otherwise recent versions of eslint want "dangling" commas,
which is at least ugly considering that most functions don't
allow adding arguments at leasure.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1177
2020-04-28 09:04:49 +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
Will Thompson
3199620a83 systemActions: include ASCII alternatives in search index
With this change, "eteindre" matches "éteindre" (the French translation
for "power off"), consistent with search for applications where "e"
matches "é".

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2688
2020-04-25 13:55:20 +01: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
Florian Müllner
8030d9ad32 extensionUtils: Add openPrefs() convenience method
Opening their own preferences is a reasonable desire for extensions,
so make up for breaking it by adding a convenience method for that
action.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1163
2020-04-03 15:27:37 +02:00
Florian Müllner
764527c8c9 js: Promisify async operations
Promises make asynchronous operations easier to manage, in particular
when used through the async/await syntax that allows for asynchronous
code to closely resemble synchronous one.

gjs has included a Gio._promisify() helper for a while now, which
monkey-patches methods that follow GIO's async pattern to return a
Promise when called without a callback argument.

Use that to get rid of all those GAsyncReadyCallbacks!

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1126
2020-03-31 05:43:40 +00:00
Carlos Garnacho
8378c9c9e0 inputMethod: Protect for running with older mutter versions
The offset argument is changing from uint to int. Which means we
might would pass a negative offset and trigger an "out of bounds"
error. Make it work more or less alright with older mutters, by
clamping the offset to 0.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1146
2020-03-28 16:38:10 +00:00
Takao Fujiwara
6170bea283 inputMethod: Fix delete-surrounding-text signal
Forward the arguments at the 'delete-surrounding-text' signal
from IBusInputContext to clutter_input_method_delete_surrounding()
so that ibus-typing-booster use the deleting surrounding text function.

Input method engines can delete the output text in applications
with this function.

This change will require a change of mutter of mutter!517
because the first arguemnt of the 'delete-surrounding-text' is INT
to express the offset of the current cursor position but
the first one of clutter_input_method_delete_surrounding() is UINT
since the Wayland spec accepts UINT in delete_surrounding()

mutter will change the type of the first one to INT in
clutter_input_method_delete_surrounding() to work with this change.

https://gitlab.gnome.org/GNOME/mutter/issues/539
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/477
2020-03-27 19:42:07 +00:00
Florian Müllner
13f3f75303 ibusManager: Simplify code a bit
ibus_bus_request_name_async_finish() will throw an error on failure,
so we can move the error handling there instead of checking for the
return value, which saves one level of indentation.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1122
2020-03-24 08:27:27 +01:00
Reik Keutterling
9829d56bfa modemManager: fixed dbus path for GDBusProxy
Fix this runtime error:
JS ERROR: TypeError: this._proxy.SignalQuality is null
_reloadSignalQuality@resource:///org/gnome/shell/misc/modemManager.js:252:34
_init@resource:///org/gnome/shell/misc/modemManager.js:234:14
NMDeviceModem@resource:///org/gnome/shell/ui/status/network.js:517:34
_deviceAdded@resource:///org/gnome/shell/ui/status/network.js:1755:27

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1105
2020-03-19 12:23:26 +01:00
Florian Müllner
eb7533bbf1 networkAgent: Drop VPN plugin cache
libnm doesn't only search for plugins in the regular VPN plugin directory,
but also in the legacy location and the directory pointed to by the
NM_VPN_PLUGIN_DIR environment variable (if set).

We don't monitor the additional directories, so it's possible for our cache
to become outdated.

Instead of trying to play catch-up with libnm's internals, do what nm-applet
does and use the appropriate API to look up the plugin on each request.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2386
2020-03-17 14:07:15 +00:00
Cosimo Cecchi
d9a75412c3 modemManager: Look for property on correct object
The SignalQuality property is defined on the GDBusProxy, not the modem
JS object.
Fix this runtime warning:

JS WARNING: [resource:///org/gnome/shell/misc/modemManager.js 252]: reference to undefined property "SignalQuality"
JS ERROR: TypeError: this.SignalQuality is undefined
_reloadSignalQuality@resource:///org/gnome/shell/misc/modemManager.js:252:34
_init@resource:///org/gnome/shell/misc/modemManager.js:234:14
NMDeviceModem@resource:///org/gnome/shell/ui/status/network.js:517:34
_deviceAdded@resource:///org/gnome/shell/ui/status/network.js:1755:27

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1097
2020-03-14 22:59:59 +01:00
Alynx Zhou
94f6976ddd ibusManager: fix ibus launch error because of wrong method name
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1080
2020-03-11 09:30:15 +00:00
Florian Müllner
a5a6c699c3 fileUtils: Remove some compatibility code
The condition was added to keep working with the then-stable version
of gjs. We already require a more recent version now, so the compat
code is effectively dead.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1077
2020-03-09 13:18:48 +00:00
Carlos Garnacho
1a0ec782b5 ibusManager: Ensure to spawn --xim on non-wayland sessions
This (mistakenly) now only depends on signals triggered on Wayland
sessions. Hardcoding the XIM support on X11 sessions will make input
in some clients work again.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1690
2020-03-06 18:57:23 +00:00
Carlos Garnacho
3c4a5a67e2 ibusManager: Use setup X11 display for ibus-x11
(re)spawning ibus to get ibus-x11 will be part atm of Xwayland
initialization process. For it to be set up before the client
it needs using the GNOME_SETUP_DISPLAY.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/836
2020-02-29 18:58:47 +01:00
Florian Müllner
4759197200 util: Don't wiggle when animations are disabled
repeatCount and autoReverse don't play well with animations disabled:
They cause password entries to wiggle themselves off-screen (by ending
up with some off-scale translation-x value).

While we should handle this more gracefully in the transition helpers,
it also makes sense to handle the case directly in wiggle(): As it
uses a chain of three transitions, we would still end up with a crude
one-frame-per-transition wiggle "animation".

Instead, do no animation at all as you would expect when animations are
disabled.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2236
2020-02-22 16:38:43 +00:00
Jonas Ådahl
9ab0071aa5 introspect: Add AnimationsEnabled property
While the gsetting is available for all who needs it, the Shell might
override it given various hueristics. Expose the decision made by the
Shell via a new property.

Intended to be used by gsd-xsettings as well as xdg-desktop-portal-gtk.

This also add a version property to the API, so that semi external
services (xdg-desktop-portal-gtk) can detect what API is expected to be
present.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
2020-02-20 11:14:55 +00:00
Jonas Ådahl
cf39b2db87 introspect: Rename variable
It was too generic, and would conflict with a StSettings variable.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
2020-02-20 11:14:55 +00:00
Jonas Ådahl
059fb5c7cb introspect: Add helper to check method call permission
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
Jonas Dreßler
2b184a10d6 util: Move wiggle parameters to a common place
Since the wiggle effect will be used by the redesigned prompt-dialogs
and we always want to use the same parameters, move those as defaults
for the wiggle function to the util.js file.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/942
2020-02-01 08:06:31 +01:00
Florian Müllner
375d1892bf extensionSystem: Add hasUpdate state
The current support for extension updates is half-baked at best.
We are about to change that, and implement offline updates similar
to gnome-software.

As a first step, add a hasUpdate property to the extension state
which will communicate available updates.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/945
2020-01-30 13:37:47 +00:00
Jonas Dreßler
3f21c21532 status/system: Update text of orientation lock menu entry
Since the orientation lock menu entry is a proper menu entry instead of
a icon-only button now, we also show a description-text for that entry,
so update this text depending on whether orientation is locked or not to
better reflect what clicking the menu entry will do.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/964
2020-01-28 15:49:01 +00:00
Florian Müllner
b0753f78cc systemActions: Alias power-off to halt and stop
Those are words users may reasonably use when trying to shut down their
computer, so add them to the list of keywords.

https://bugzilla.gnome.org/show_bug.cgi?id=791659
2020-01-08 15:32:28 +00:00
Benjamin Berg
4a6c2f1fe6 util: Place spawned processes into a systemd scope
This improves the separation from the shell for applications launched
with Alt+F2 and in a few other cases.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/863
2019-12-11 09:34:36 +01:00
Florian Müllner
154655838d weather: Only require auto-location authorization if sandboxed
Since commit 87e60ed97843, geoclue no longer pretends that authorization
is useful for system-installed apps (as they can easily lie about their
ID). Unfortunately this broke our auto-location support in case Weather
is installed non-sandboxed, as we are waiting for an authorization that
will never happen.

Unbreak it by only requiring authorization when installed as Flatpak.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1823
2019-12-09 11:10:54 +00:00
Florian Müllner
0a9e1b4173 fileUtils: Delete deleteGFile hack
It is true that delete is a javascript keyword, but that doesn't
prevent it from being used as method name - there are event built-in
types like Map or Set with delete() methods!

So if that hack was ever needed, this hasn't been the case for years
now; just removed the hack now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/862
2019-11-26 22:17:28 +00:00
Florian Müllner
eee1ab4890 introspect: Fix whitelist check
The whitelist is a list of well-known D-Bus names, which we then search
for the unique name we get from the method invocation - unsuccesfully.

Fix this by watching the bus for any name in the whitelist in order
to maintain a map from wel-known to unique name that we can use for
matching.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1916
2019-11-25 20:00:10 +01:00
Florian Müllner
2842670082 cleanup: Remove another pair of unneeded parentheses
Eslint didn't spot this before version 6.5, so this fell through
the cracks.
2019-11-23 01:29:20 +01:00
Philip Chimento
83f224e08b dateMenu: Format weather forecast times without AM/PM
If the clock is set to 12h, the AM/PM in the weather forecast times
should be clear from the context, because they are the immediately
following hours. This makes it less likely that the times will be
ellipsized (in which case the AM/PM wouldn't be shown anyway.)

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/835
2019-11-20 13:08:06 -08:00
Florian Müllner
a32c4f30d1 style: Allow lonely ifs where appropriate
We now have a lint rule to disallow lonely ifs, however there are
cases where the "lonely" part mirrors code from the preceding if
clause. Opt out of the lint rule in those cases.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/818
2019-11-11 23:51:17 +00: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
07cc84f632 cleanup: Only omit braces for single-line blocks
Braces can be avoided when a block consists of a single statement,
but readability suffers when the statement spans more than a single
line.

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