Commit Graph

8331 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
113130552f appDisplay: Set 3x3 grid mode for folders
Folders have a fixed 3x3 grid, given that folders themselves
have a fixed size. Make the code correspond to this invariant.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
083a691a74 appDisplay: Mostly remove adaptToSize
Back in the day, adaptToSize() contained mad maths to figure out
icon sizes. Over time, its scope was reduced, to the point where
we are today where it mostly just redoes some quick maths to
predict the grid size based on the CSS box model.

Remove adaptToSize() from BaseAppView and child classes. It still
is an internal detail of the IconGrid class, but it's not exposed
as a "public" method anymore.

This removal is not perfect, as it doesn't move or compensate for
any of page indicators and arrows code. This will be done in follow
up commits introducing a new layout manager for that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
5ba699e095 appDisplay: Stop updating fade effect
Don't update the fade effect, since we have "infinite" borders now.
Also remove _availWidth and _availHeight, since these variables are
now unused.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
5cb94c526c appDisplay: Give all available size to grid
Another step in dismantling AppDisplay before reintroducing some
of the elements there. Instead of adding a certain amount of
padding, capped at 200px, always give the grid all available size.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
1fb570b415 appDisplay: Remove stack from AppDisplay
The stack widget once was a ShellStack and had a prominent role
in layouting AppDisplay, but after a series of reworks it's now
effectively unused, and can be safely removed.

Remove the '_stack' widget from AppDisplay.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
29601b84d4 appDisplay: Don't update fade effect
We'll have to dismantle parts of AppDisplay and BaseAppView in
order to introduce navigation arrows in a way that won't drive
people insane.

Start this dismantling by removing the fade effect. It looks odd
for now, since we still set padding to the app grid, but that
will change soon too.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Florian Müllner
b4ff426a93 status/network: Stop summarizing device sections
Now that the number of displayed items is capped, there's no need
for a summary anymore.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
1a0dbd00e4 status/network: Limit the number of items that are shown per section
Space will be less of a concern when each sections becomes its own
menu, but it's still not infinite. To address this, enable MRU
tracking and limit the list to the eight most recently used items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
cb4d96072e status/network: Add timestamp to device items
Devices do not have an associated timestamp, but as we can now
track the MRU order of their connections, it makes sense to consider
the time of the most recent succesful connection the timestamp
of the device item.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
911762ea54 status/network: Add ItemSorter option to track MRU
We always display items sorted by name, but there are cases where a
second order by recency is interesting. Add an option to ItemSorter
to keep such a list and allow accessing it with another generator
function.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
a3dbb3e71f status/network: Add timestamp property to items
Connections have a timestamp property, which records the last time
it was succesfully activated. This is useful information to us, as
more recently used connections are likely more relevant than ones
that haven't been used for a long time (or not at all).

To make use of it in the future, expose that timestamp as a property.

Only connections support it, but we will soon provide a reasonable
value for devices as well, so add the property to the base class.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
c84d63854f status/network: Move settings item into toplevel section
Eventually each section will turn into its own menu, which should
include a single settings item.

This also removes the odd duplication of items, now that we avoid
using submenus where possible.

In general this is straight-forward, except for modems: Some
models are now supported by a dedicated wwan panel, while others
still use the generic network one.

Address this by adding items for either panel, but only show one
at a time. The new panel is used if *any* modem is supported,
only when all modems require it, the legacy panel is used.

Hopefully that shouldn't be an issue for many users, as using many
different modems with different capabilities should be fairly rare
(except for Aleksander Morgado, but I think he can handle it)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
c2139b27da status/network: Use submenus when necessary
We currently stopped using submenus altogether, but that only works

 - if there is a single connection that represents
   the device as a whole

 - if there is just one device, so it is unambiguous
   what device items belong to

To implement that behavior, add a 'single-device-mode' property that
NMDeviceSection can set on its items, and have items update their
'use-submenu' property based on that.

For wireless devices it's a straight mapping, as its items represent
wireless networks that can appear and disappear by just walking around
(multiple wifi adapters also sounds rather fringey).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
03ded1dcf0 status/network: Introduce NMSection parent type
Now that device sections manage a list of items, and the VPN section
manages a list of items, it's time to split out a shared base.

The class will get more involved over time, and eventually become
the base of all network quick items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
78154d9d20 status/network: Simplify section setup
With the latest changes, device- and VPN sections now require
exactly the same setup.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
392f72bf1c status/network: Store sections by device type
Now that the indicator no longer needs to map connections
to device wrappers, we can drop the custom 'category' type
and just use the device type.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
acda87dd26 status/network: Track devices in NMDeviceSection
We got the indicator out of the business of tracking connections,
now it's time to do the same for devices.

Let sections track device additions and removals, and create device
items for them as it sees fit.

It also allows the sections to handle the ::activation-failed signal
by themselves, instead of passing it on from device items.

With this, the indicator is now solely responsible for global state:
Manage the top bar indicators, notify on connection failures, and run
the portal helper when NetworkManager detects a captive portal.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
9bb9a847ba status/network: Let device items handle their own connections
As mentioned when doing the same for VPN connections, it is currently
the indicator itself that keeps track of added and removed connections.

It then has to figure out the correct section, and iterate through all
its device items so each item can check whether the connection
corresponds to its device.

Stop that mess, and let each device item keep its connections updated
by itself. That is actually way easier, as NM.Device already exposes
available connections through a property, so we can get rid of all
the checkConnection() shenanigans.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
59a3963647 status/network: Create indicator sections in constructor
We currently wait until we got a connection to NetworkManager.

That's possible because the old PanelMenu indicator API takes
a menu, so it is possible to add or remove items dynamically
later.

That won't be the case with quick settings, where `quickSettingsItems`
is a plain array that is only read once when adding the indicator.

Prepare for that by moving section initialization into the constructor.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
50671a78ec status/network: Replace wi-fi selection dialog
Now that wi-fi devices will be handled by a separate menu toggle
instead of as part of a combined system menu, there is no longer
a need of delegating network selection to a separate dialog.

To keep the menu from growing too much, the (sorted) list of
displayed networks is kept at a limit of eight. There is always
Settings for a complete list…

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
9809d717f5 status/network: Use SectionItem for device items
In terms of UI, this means that in the common case where we have
a single (or no) connection, the device can be represented as a
single menu item rather than a submenu.

But more importantly, all our menu items inherit from the same
GObject class now, so we can use bindings where appropriate.

This will later extend to quick toggles as well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
ad1a32749e status/network: Add NMSectionItem subclass
The class implements a menu item that contains a section which
can be collapsed into a submenu.

It is very common for network devices to only have one associated
connection, so hiding away a single item in a submenu is fairly
inconvenient.

This class will address this, by only using a submenu when it is
actually needed.

Although the main issue it addresses is that menus (including
sections) aren't GObjects. This gives us a GObject that can
be added to a menu, and that can itself contain other menu
items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
b4da69d474 network/status: Split out NMMenuItem base class
The class only provides the GObject properties that are currently
defined by NMConnectionItem, plus a way to set the active connection
that should be used for the item's :is-active state.

Its sole purpose is to provide a shared base for both device- and
connection items, and to have that base be a GObject so we can
start linking properties via bindings rather than manual fiddling.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
9002344ec6 status/network: Always use toggles in VPN section
Let's keep things simple and use the same appearance regardless
of the number of configured VPNs. Also unlike for device items,
every connection item in the VPN section is a toplevel item, so
there isn't a real need for different presentations.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
7357a80d2b status/network: Merge NMConnectionSection and NMConnectionDevice
Now that the VPN section isn't using NMConnectionSection anymore,
NMConnectionDevice is the only subclass.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
0d259d62b2 status/network: Decouple NMVpnSection from NMConnectionSection
The NMConnectionSection class is used - surprise - to manage a
list of related connections. And while the presentation of VPN
items is slightly different from connections associated with
devices (switches vs. ornaments), it makes perfect sense for
the VPN section to share the nitty-gritty with the base class.

But…

Right now it is perfectly fine for NMConnectionSection to be
used both as a child element in a device section, and as toplevel
item of the VPN section. Any nesting of sections is entirely
transparent to the user, and all connection sections appear as
submenu items in the toplevel menu.

That won't work for quick settings.

There's no PopoverMenuSection that allows invisible grouping, so
adding items dynamically would either need to happen at the end,
or require some tricky cross-component code to impose a particular
order.

And last but not least, quick toggles are very much unsuited for
a potentially large number of items. The whole point is to provide
quick direct access to system features, not to compete with menus
over the number of items they can hold.

That is, we need to get from the current state where each device
appears as a toplevel item, to a state where we have one quick
toggle for each device type plus one for VPN.

The decoupled VPN section still behaves largely as it did as a
subclass, with the notable difference that it no longer uses
a submenu item, so all VPN connections now appear at the toplevel.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
df354fc0d4 status/network: Handle VPN connections in VPN section
Right now the indicator itself tracks all devices and connections,
creates and destroys the corresponding menu items, matches them
to a section and updates the connection/device arrays that are
attached to the section.

Sounds messy?

It is slightly less effective to connect multiple handlers to the
same NMClient, but let's assume that devices and connections aren't
added/removed at 60 frames/s, and we can add some readabilty by
moving the code into different classes that only have to care about
the bits that are relevant to them.

The VPN section is a good starting point, because its handling is
already quite different from device sections.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
e84ab815d2 status/network: Factor out ItemSorter class
At its core, it's the sort order tracking from NMConnectionItem
with a bit of sugar on top to provide access to the ordered items
and the ability to provide a custom sort function.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
be950d5c4a status/network: Sort items, not connections
You could argue that the item name is closer to what is displayed
to the user, but it doesn't really matter: Connection items will
always use the connection ID when there is more than one, which
is the only case where sorting matters.

However sorting by items will allow us to generalize the code, and
use it for items that do not represent a connection.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
a62ac495a3 status/network: Split out NMDeviceConnectionItem
When not in radio-mode - that is, when the connection is the only
connection for its device - we want the item to represent the
device as a whole.

Achieve this with a small ConnectionItem subclass that adds a
:device-name property for that purpose.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
64ae6ae7b3 status/network: Update appearance of connection items
When not in radio-mode - that is, in the single-connection
case - the item currently uses a plain 'Connect' label.

That is OK while the item is inside a submenu that describes
the device, but we will soon stop using a submenu when a single
item can describe the device as a whole.

Prepare for that by adding an icon that is shown when in non-radio
mode, and include the device name in the label in that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
9e3cb0b797 status/network: Make NMConnectionItem a menu item
Instead of the current radioItem/labelItem shenanigans, implement
a custom menu item with a :radio-mode property to switch between
the different presentations.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Alessandro Bono
b63c6ac0ef cleanup: Use deepUnpack() intead of deep_unpack()
deep_unpack() is just a backwards compability alias for deepUnpack()[1].
The new name makes it more clear that this is not a C function, start to
use it.

[1] 13e662a29d

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2416>
2022-08-10 10:29:24 +00:00
Alessandro Bono
ade4b23796 cleanup: Minimize deep_unpack() usage
deep_unpack()[1] will unpack a variant and its children, but only up to one level.
lookup_value()[2] will directly search for a value with a linear scan.

Performing a deep_unpack() + lookup can be a more expensive operation when we are
looking for just a single value compared to just perform the lookup_value() directly
in C. Avoid the deep_unpack() usage when we perform a single check presence.

[1] https://gjs.guide/guides/glib/gvariant.html#deepunpack
[2] https://docs.gtk.org/glib/method.Variant.lookup_value.html

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2416>
2022-08-10 10:29:24 +00:00
Carlos Garnacho
23bfd08b3c misc: Toggle IBus OSK capability on OSK visibility
Newer versions of IBus (> 1.5.26) have the IBUS_CAP_OSK capability
which can be used to hint the active IM about an OSK driving input as
opposed to a physical keyboard. This may be used by IMs to tweak their
behavior to suit OSKs better.

Add the GNOME Shell side handling for this capability, and toggle it
on whenever the OSK is visible.

Since this is a far too new enum value and we don't want such new
IBus dependency, this change plays fast and loose with JS guarantees,
since a logical OR with an undefined value results in the other operand
unmodified it will work for older versions where the capability does not
exist and thus we want nothing extra enabled.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2415>
2022-08-10 10:14:40 +00:00
Florian Müllner
f6e889626b status/network: Always notify icon-name on strength change
We do want to update the best AP on strength change, in case we
can switch to a better one.

But even if we can't and the AP is unchanged, the icon should
be updated to reflect the change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2414>
2022-08-09 12:55:48 +00:00
Florian Müllner
c050002021 status/network: Add section classes for each device type
Those will eventually become quick toggles, and as there'll be small
differences like menu headers or which settings panel to launch, it
makes sense to give each its own class.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
cad3ec1ecd status/network: Rename DeviceCategory and base on device type
Right now DeviceCategory is a small section wrapper that shows
a summary instead of its content if it contains too many items.

It will eventually eventually turn into the base class for
network device quick toggles. Who would have thought that
when it was added for the "there's a computer with 32 ethernet
cards" fringe case?!

For now, give it a more appropriate name and use device types
instead of our made-up categories, now that the two map neatly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
73f4bb13d0 status/network: Give bluetooth its own category
In the quick settings future, each device type will use a separate
toggle. We still have a long way to go, but start with giving
bluetooth its own section/category. Baby steps …

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
714c0eaea5 status/network: Remove WireguardItem
Wireguard connections are now covered by the VPN item.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
79f6ee25bd status/network: Use ActiveConnection:state in VPN item
The separate :vpn-state property is more fine-grained, but as
we aren't using anything beyond what :state provides, we can
just as well use that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
9bca544dd6 status/network: Remove status from VPN item
It's odd to swap out a switch with a status label, and the
information isn't that helpful to begin with: It's either
transient (connecting, deactivating, ...), or too little to
be meaningful (unknown, failed, ...).

We're also perfectly happy to not show it in "label mode"
(i.e. when there's just one VPN).

Just get rid of it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
b5fabedd4f status/network: Simplify device item labels
Stop providing detailed state descriptions, instead use a name
that best represents the device at the moment (like a wifi SSID,
the carrier name, or the device name as determined by network manager).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
58d29f95a7 status/network: Track device sections as device sections
The _devices property is another case of overloading the
"device" term.

Fun fact:

  this._devices[device._delegate.category].devices

uses three different meanings of "device" (section, NM.Device, item).

The devices array in sections won't be around for much longer,
but the property that tracks the sections is worth renaming.

While at it, use a map instead of a plain object, which has a
guaranteed order when iterating (which will come in handy later).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
586bb29b9c status/network: Rename setDeviceDescription()
It is used to pass the disambiguated device name to device items,
so call it "name" rather than "description".

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
02bbc830fb status/network: Rename device menu items
NMDeviceWireless sounds an awful lot like NM.DeviceWifi.

Rename all device menu items to make it clear that they are indeed
menu items, not the device they represent.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
4622a68100 status/network: Split out WirelessNetwork class
Different access points can belong to the same wireless network. As
NetworkManager doesn't handle this for us, we need to track networks
ourselves, and we currently do this using ad-hoc object literals and
monkey-patching.

Clean this up by factoring out a proper WirelessNetwork class, and
associate them to items with a map.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
1aa01fc8ca status/network: Use NM utility function for classifying security
Interpreting the different flags is better left to the domain
experts at NetworkManager. It is also much more likely that
NM's own functions will handle newly added flags than our own
code.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
54a1c34f6e status/network: Use property bindings for global visibility
There is a straight mapping between running/enabled and visibility,
so bind them instead of using a signal handler.

_syncConnectivity() is called both from _syncMainConnection() and
on connectivity changes, which should cover any running/enabled
changes.

That just leaves updating the icon on state changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
f411228fa0 status/network: Use connectObject() to connect client signals
We would want the signals to be disconnected if we ever happened to
destroy the indicator. Even if we don't, connectObject() is simply
nicer when connecting half a dozen handlers at once.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
c33b5de174 status/network: Simplify notification code
There is only one case where we show a notification: When activating
a connection failed.

There is therefore no reason for a generic wrapper around the
notification API. Likewise, tracking the source is a bit pointless,
given that the notification is transient. In fact, as we destroy
an existing notification *before* checking for the source, any
previous source will be gone by that point.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
3113e6ee21 status/network: Fix error notification for wireguard
The function is a handler for the `notify::state` handler, so
the state and reason parameters used in the checks are always
undefined.

In addition, `DEACTIVATED` is not (just) a failure state. We
clearly don't want to complain about a failed connection when
the change happened on request of the user.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
44f0a9560c status/network: Remove reason param from ::activation-failed
We never used it, so after more than ten years, it seems safe to
assume that we never will.

Plus different items pass different types, which makes it pretty
much impossible to use, even if we wanted to (which apparently
we don't 🤷️)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
de175dfca4 status/network: Make connectivity queue a Set
It's better suited than an array.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
ca2d39f6fb status/network: Emit 'icon-changed' on primary connection changes
When deciding on whether to show the 'no-route' icon, we check
for the client's connectivity *and* whether the devices's active
connection is used as primary connection.

This is currently masked by the indicator updating the icon on
connection changes anyway, but items should still notify the
change themselves.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
5e533e5f77 status/network: Notify icon change after access-point update
We call sync() which updates our own label and icon, but does
not notify the indicator about the icon change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
7bfd4fe148 status/network: Sync active access point from constructor
The wireless device item tracks the active access point in order
to update its icon on signal strength changes.

However we currently don't synchronize the initial state, so we
miss strength changes until the first access-point change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
af132dd884 status/network: Catch errors when fetching client
Otherwise any unrelated errors in that function are hidden,
because exceptions in async functions are turned into promise
rejections (and JS cannot know that we won't handle it at a later
point).

It wouldn't happen to me of course 😉

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
d9d70c162d status/network: Some minor style fixes
I wasn't genuiously going to touch those lines, but I ran into
a limitation of the run-eslint script:

It currently bases changed lines on a diff between HEAD and main
instead of the commit-by-commit log.

The two can vary quite a bit when shuffling code around, and those
are the lines the tool kept complaining about.

I'll look into improving the script, but for now it's quicker to
just shut it up by fixing up the complaints.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
2022-08-07 22:41:09 +02:00
Florian Müllner
0fdca0d21a quickSettings: Bind menu arrow's reactivity to parent
When a QuickMenuToggle is made insensitive, then it is unexpected
that its menu can still be opened despite the appearance.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2405>
2022-08-06 21:27:15 +00:00
Florian Müllner
ce19849c09 status/power: Merge with system indicator
Now that the old system menu has been ported over, we can move
the power toggle to its intended place. The main difference to
the stand-alone toggle is that the button now uses its natural
size rather than the fixed size of regular quick items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Florian Müllner
ea00da7fd7 status/system: Port to quick settings
This port is a bit messier than the previous ones, because the
existing menu section translates less directly to the new UI,
which uses a row of individual toggles for settings, lock and
shutdown.

In order to not complicate the grid layout further by supporting
rows with a different number of columns than the overall grid and
children at their natural size, create a custom, non-reactive
SystemItem item that spans an entire row, and contains the individual
toggles.

This works quite well, even with the shutdown item that uses a menu
for the various actions.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Florian Müllner
62c62eced0 status/volume: Port to quick settings
Thanks to the preparations and QuickSlider, this is again
straight-forward.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Florian Müllner
7bbd59838a status/brightness: Port to quick settings
Using QuickSlider, this is another easy port.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Florian Müllner
1f178e83d3 status/powerProfiles: Port to quick settings
With menu support in place, this is now a straight-forward port:
Just add the existing profiles section to a QuickToggleMenu instead
of a submenu item.

The toggle itself now switches between 'balanced' and the last used
non-default profile.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Florian Müllner
c2e8f41bdf quickSettings: Add QuickSlider
Between input/output volume and brightness, we have enough use
cases for a common slider QuickSettingsItem, in particular as
the items can have a menu.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Florian Müllner
4b9dcb3f89 quickSettings: Add QuickMenuToggle
This is a convenience subclass for a quick toggle with a menu.

The menu can be disabled dynamically and if enabled, an arrow
is displayed that allows opening the menu.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Florian Müllner
3ce3034fdd quickSettings: Color header icon if checked
... as requested by the design team.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Florian Müllner
a0436d4b48 quickSettings: Add header to QuickToggleMenu
All menus in the mockups spot a header, and as we are using a
custom menu type anyway, just add some API there.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Florian Müllner
e0c61f53f1 quickSettings: Add menu support to items
Now that the QuickSettingsMenu supports child menus, it is time
to add menu support to quick toggles.

Do that by introducing a QuickSettingsItem parent class with a
construct-only :has-menu property, as that will allow including
menus in items that aren't following the standard icon+label
pattern of QuickToggle (yes, we'll have some of those).

A common parent class also allows us to control the type of
menu that is created. That's important, as we need another
custom menu type to

- constrain the menu's y position to place it underneath
  the source actor

- use open/close animations taylored for this use case

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Florian Müllner
24e842c52e quickSettings: Support child menus in QuickSettingsMenu
This is where it gets hairy.

Some quick settings items will have an associated menu. When
opened, the main menu should grow to make room for the child
menu, as it would do if it contained the child.

At the same time, the child menu will attach to its parent, and
block all input there while it is open.

Menu-modal menus so to speak.

Implement this as follows:

 - change the QuickSettingsMenu actor to a stack that holds
   - the boxpointer (a.k.a. the actual menu)
   - an overlay actor to hold child menus

 - use constraints to bind the overlay's position and width
   to the boxpointer; the y position is offset to align the
   overlay with the grid inside the actual menu

 - add a placeholder actor to the main grid, whose height is
   bound to the overlay height; using a "clone" instead of
   the actual overlay means that layout changes are not triggered
   from outside the grid hierarchy, which would be prone to
   allocation warnings

 - update the layout manager to not allocate the placeholder as
   a regular grid child, but instead include its height in the
   space underneath the row with an open menu

 - apply a dim effect to the boxpointer when a child menu is
   open, to indicate that input is blocked

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Ivan Molodetskikh
83564e59b3 workspace: Port WorkspaceBackground allocate to C
WorkspaceBackground's allocate is a hot function called every frame
during overview animations. Port it to C.

While we're at it, cache the work area and the monitor geometry, which
do not need to be re-fetched on every allocation.

This reduces the average WorkspaceBackground allocation time from
0.134 ms to 0.017 ms. With four workspaces, scrolling the overview sees
an average WorkspacesView allocation time improvement from
1.104 ms to 0.678 ms.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2394>
2022-08-03 12:30:31 +00:00
Milan Crha
5c935af7d3 build: Port to gcr4
The gcr4 is going to replace gcr3. As only base functions are used,
the port to gcr4 is trivial.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2386>
2022-08-02 16:13:54 +00:00
Florian Müllner
a3a886f185 status/darkMode: Add dark mode toggle
The aggregate menu with its submenus isn't well-suited for simple
on-off actions, so we didn't expose the global color-scheme support
that was introduced last cycle.

Quick settings on the other hand are a natural fit for actions like
this, so add a corresponding toggle.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
4d931c2c41 status/autoRotate: Port to quick settings
On devices where auto-rotation is supported, (un)locking the
orientation is a common enough action to not bury it in a menu.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
80d1f68c77 status/power: Port to quick settings
The power indicator should not be a regular quick toggle, but
instead be part of a "system area" row at the top of the menu.

But as in the end it is still a simple button, we can do the
port to quick settings now, and move it later when the system
row is implemented.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
2ebdb6e318 status/bluetooth: Port to quick settings
For now, this is another simple toggle. The icon, state and
visibility reflect what the old menu did, and the top bar
icon is still only shown when devices are currently connected.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
49eaa29f22 status/rfkill: Port to quick settings
Another simple toggle. Unlike the old menu, it is always shown
if airplane mode is supported, not just while airplane mode is
active.

We still only show the top bar icon while airplane mode is on.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
1459173bc9 status/nightLight: Port to quick settings
Night-light is now a simple, always visible toggle that directly
controls the underlying setting. No change to the top bar icon,
which is still only shown while night-light is active (read: at night).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
0f1f5bb174 status/remoteAccess: Move to quick settings
And there goes the last icon-only indicator. From now on, some
actual work will be involved 😱️

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
b8cb5c6acd status/thunderbolt: Move to quick settings
... and another icon-only indicator that can be just moved.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
c9a9e1ef52 status/location: Move to quick settings
Another icon-only indicator, so another plain move.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
a8142d1dc2 panel: Move unsafe-mode indicator to quick settings
As the inicator doesn't have any UI besides the top bar icon,
the move is trivial.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
de989b1fe8 popupMenu: Close quick settings when activating settings action
Like the overview, the quick settings menu should be closed when
a launcher action is activated.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
7834372acb panel: Add closeQuickSettings() method
Like the aggregate menu currently, the quick settings menu will
eventually contain some items that should dismiss the menu. And
as those items may appear in child menus or otherwise be nested,
a public method on a global object is more convenient than handing
the main menu down the hierarchy.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
84a62cc868 panel: Add quick settings indicator
The new indicator will eventually expose all the system status
items that are currently provided by the aggregate menu, but in
a more accessible form than the current submenu-heavy menu.

Right now this just adds the new empty indicator to the top bar,
alongside the existing aggregate menu.

We can then move items over one-by-one.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
f18d103f83 quickSettings: Add SystemIndicator
This serves the exact same purpose as the existing SystemIndicator
class from PanelMenu, except that it exposes a quickSettingsItems
array instead of a menu.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
e5d4984c1b quickSettings: Add QuickToggle
Most quick settings items are just buttons with icon, label, and
a particular style. While that's easy enough, a dedicated class
with corresponding properties is more convenient.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
47cb354e6c quickSettings: Introduce QuickSettingsMenu
The quick settings menu is a popover that arranges items in a
reflowing, homogeneous grid. Grid children may span multiple
columns, but not rows.

For now the QuickSettingsMenu that contains the grid is just a
convenience wrapper around the layout manager that does the heavy
lifting. The two will become more intertwined when we add support
for menu toggles though, so the custom menu type is unfortunately
needed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
2022-08-02 16:05:28 +00:00
Florian Müllner
0c68c33826 loginManager: Return objects instead of multiple booleans
Multiple booleans - both in arguments and return values - are almost
always problematic API, because people have to memorize (or more likely
look up) the meaning of each position.

Instead, return a JS object so each value has a name attached to it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2370>
2022-08-01 20:58:37 +02:00
Florian Müllner
637ee7386e js: Use async D-Bus wrappers
After porting the more complex cases - in particular those that
affect a module's API - we are left with straight-forward D-Bus
method calls that can be moved to promise-based wrappers in one
go.

For consistency, this also switches from Remote to Async where
the call result is ignored.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2344>
2022-08-01 18:51:14 +00:00
Florian Müllner
a3db909383 loginManager: Make API promise-based
The LoginManager abstraction is still mostly callback-based, not
least because the methods are thin wrappers around logind D-Bus
calls.

However as gjs' dbus wrapper now generates promised-based wrappers
as well, we can implement a proper async API just as naturally.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2344>
2022-08-01 18:51:14 +00:00
Florian Müllner
db3916434e status/location: Make AppAuthorizer async
Instead of passing a callback through a series of methods and
callbacks, change authorize() to return its result asynchronously.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2344>
2022-08-01 18:51:14 +00:00
Florian Müllner
c6861c0a3d autorunManager: Promisify ContentTypeDiscoverer
Thanks to recent gjs changes - namely the ability to promisify
interface prototypes and promise-based D-Bus wrappers - we can
modernize the ContentTypeDiscoverer API to use an async function
instead of a callback.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2344>
2022-08-01 18:51:14 +00:00
Florian Müllner
119581a4cb search: Use async functions instead of callbacks
Our search provider API has to be asynchronous to support remote
providers. It doesn't have to be based on callbacks though, now
that async functions provide a nicer alternative.

That is particularly true after gjs's D-Bus wrapper started to
generate promise-based method variants.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2344>
2022-08-01 18:51:14 +00:00
Florian Müllner
1cce999c30 remoteSearch: Stop using callback to return loaded providers
Provider loading has been synchronous since 2013, so we can
just as well return the results directly instead of passing
them to a callback.

Even if we returned to asynchronous loading in the future,
we wouldn't want to use a callback, but make the function
itself async.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2344>
2022-08-01 18:51:14 +00:00
Florian Müllner
7ab7df739a status/remote-access: Split out screen sharing indicator
The latest mockups move the screen sharing indicator into a
separate control, similar to the existing indicator for built-in
screen recordings.

As this removes the submenu and only keeps the top bar icon (for
external screen recordings), this will smooth the transition to
quick settings.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>
2022-08-01 12:33:36 +00:00
Florian Müllner
4f155d3757 status/powerProfiles: Remember last selected non-default profile
When we move to quick settings, this will allow us to toggle
between two profiles even where more profiles are available.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>
2022-08-01 12:33:36 +00:00
Florian Müllner
dc4ed1d7d2 status/location: Remove submenu
Location services aren't expected to change frequently: They are
either disabled globally, or permissions are granted on a per-app
basis.

This is less of a concern while the setting is exposed in a small
submenu, but as we moving to quick settings, it does not deserve
the prominence of a quick toggle. Just the top bar icon and Settings'
privacy panel should be enough.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>
2022-08-01 12:33:36 +00:00
Florian Müllner
3bc9f00a15 status/volume: Merge VolumeMenu into indicator
Other than connecting stream when necessary, the volume menu
only forwards slider events to the indicator, and method calls
from the indicator to the appropriate slider.

Just cut our the middle-man and let the indicator handle the
slider items directly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>
2022-08-01 12:33:36 +00:00
Florian Müllner
ed2ae06f35 status/brightness: Improve proxy error handling
On error, we currently print a warning and bail out early. That
means we don't hide the slider, despite it being non-functional
without the proxy.

Fix this by making sure _sync() is called in any case. While at
it, use an appropriate log level for the warning message.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>
2022-08-01 12:33:36 +00:00
Florian Müllner
87e4eda46d status/brightness: Hide when proxy has no owner
Properties are null while a proxy has no owner. Javascript helpfully
coerces that into `Number(null)` (a.k.a. 0), so we end up with a
broken slider.

Explicitly check that the value is an integer before doing the
comparison to catch that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>
2022-08-01 12:33:36 +00:00
Florian Müllner
fcd08fae94 status/bluetooth: Split out BtClient object
The new class abstracts away the nitty-gritty of bluetooth- and
airplane-mode handling, and exposes just what the UI needs.

This will become more important with quick settings, where there's
a stronger separation between top bar icon and quick toggle.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>
2022-08-01 12:33:36 +00:00
Florian Müllner
463757569a status/bluetooth: Use promise to initialize proxy
There's no good reason for waiting for the proxy to be initialized
to connect signals. In fact, connecting the signal beforehand
ensures that the handler is in place when the proxy fetches the
properties, so we don't have to call the handler explicitly.

That in turn allows us to rely on the signal parameters to only process
changed properties.

To achieve that, construct the proxy manually, and then initialize
it asynchronously in a Promise.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>
2022-08-01 12:33:35 +00:00
Florian Müllner
80e4ae7d7f status/nightLight: Use promise to initialize proxy
There's no good reason for waiting for the proxy to be initialized
to connect signals. In fact, connecting the signal beforehand
ensures that the handler is in place when the proxy fetches the
properties, so we don't have to call the handler explicitly.

That in turn will allow us in a follow-up to rely on the signal
parameters to only process changed properties.

To achieve that, construct the proxy manually, and then initialize
it asynchronously in a Promise.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>
2022-08-01 12:33:35 +00:00
Ivan Molodetskikh
841599d475 overviewControls: Minor style fix
Since I'm forced to fix the spaces for the workAreaBox change, might as
well fix them in the nearby lines.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2395>
2022-08-01 00:48:07 +00:00
Ivan Molodetskikh
8562606ad1 ControlsManagerLayout: Cache workAreaBox
Allocation runs every frame during the overview animations, so we want
to do as little work there as possible. Cache the work area box
computation.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2395>
2022-08-01 00:48:07 +00:00
Ivan Molodetskikh
c3284eb8ac ControlsManagerLayout: Use primaryMonitor
ControlsManager already hardcodes primaryMonitor, so do it here too to
skip an expensive search.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2395>
2022-08-01 00:48:07 +00:00
Alessandro Bono
d01d38e1e9 extensionSystem: Check if mode is supported when loading
Don't try to initialize and then enable an extension if it is not supported
in the current mode. Otherwise the extension will not be initialized, and the
initial ERROR state is not cleared. Once it is in ERROR state we can't enable
it anymore when we switch mode. Instead, leave the extension in INITIALIZED
state, so that it will be initialized when appropriate. This happens for
extensions that support the unlock-dialog mode but not the user mode.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2378>
2022-07-27 14:01:30 +00:00
Florian Müllner
6aa3a2f4e2 status/powerProfiles: Use CHECK ornament
The design team prefers them over dots in this context now.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2389>
2022-07-27 13:39:02 +00:00
Florian Müllner
d555be0a64 status/powerProfiles: Add image to menu items
We want the icons when we move to quick settings:

https://gitlab.gnome.org/Teams/Design/os-mockups/-/raw/master/system-status/quick-settings/quick-toggles-mvp.png

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2389>
2022-07-27 13:39:02 +00:00
Florian Müllner
7647e5590a popupMenu: Append ornament in image menu items
Having both image and ornament in front of the label looks odd.

Keep the image where it is, and move the ornament to the end.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2389>
2022-07-27 13:39:02 +00:00
Florian Müllner
d03a94dab1 status/powerProfiles: Split updating profiles from sync
Calling the split out code where necessary seems cleaner than
calling it conditionally as part of the general sync().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2389>
2022-07-27 13:39:02 +00:00
Florian Müllner
e062e96ae6 rfkill: Consider HasAirplaneMode
`ShouldShowAirplaneMode` only considers whether airplane mode
should be shown for the form factor, not whether there are
any actual kill switches available.

That's tracked in a separate property, `HasAirplaneMode`.

Take that into account for our `:show-airplane-mode` property,
so that it reflects when airplane mode should and *can* be shown.

Right now we only show airplane mode when it is enabled (and
therefore available), but this will change in the future.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2385>
2022-07-19 13:27:39 +00:00
Florian Müllner
98cbc31e86 rfkill: Turn manager into a GObject
That will allow us to use it in property bindings.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2385>
2022-07-19 13:27:39 +00:00
Florian Müllner
bb043bb761 rfkill: Use promise to initialize proxy
There's no good reason for waiting for the proxy to be initialized
to connect signals. In fact, connecting the signal beforehand
ensures that the handler is in place when the proxy fetches the
properties, so we don't have to call the handler explicitly.

That in turn will allow us in a follow-up to rely on the signal
parameters to only process changed properties.

To achieve that by constructing the proxy manually, and then
initialize it asynchronously in a Promise.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2385>
2022-07-19 13:27:39 +00:00
Florian Müllner
762b4c2066 status/volume: Add device submenus
In case where there are multiple in- or output devices, pulseaudio
or pipewire can pick the "wrong" one by default.

Allow users to change devices without opening sound settings by
adding a submenu to the sliders when there is more than one device.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2380>
2022-07-19 14:56:46 +02:00
Florian Müllner
cf404f76c0 status/volume: Use (dis)connectObject
It makes sense to use this for all MixerControl handlers, not just
some of them.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2380>
2022-07-19 14:56:46 +02:00
Florian Müllner
af5bc30dff status/volume: Reindent before making code changes
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2380>
2022-07-19 14:56:46 +02:00
Florian Müllner
a768efad06 status/volume: Small cleanup
There is no point in splitting out a function that has one caller
and sets a single property.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2380>
2022-07-19 14:56:46 +02:00
Florian Müllner
d80a7224cd status/volume: Document public function
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2380>
2022-07-19 14:56:46 +02:00
Georges Basile Stavracas Neto
19f11ae328 accessDialog: Allow body label to wrap lines
Allow the body label of the access dialog to wrap, and avoid
ellipsizing it.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2377>
2022-07-14 16:51:52 +00:00
Florian Müllner
12a203a1db notificationDaemon: Stop auto-dismissing on focus changes
This behavior dates back all the way to the original gnome-shell
release, and it did make sense at the time:

 - we were first to make notifications persistent instead of
   closing them after a timeout; apps were therefore used to
   treat notifications as fire-and-forget instead of closing
   them when no longer relevant

 - neither web notifications not portals did exist yet, so the
   D-Bus API was only used directly, instead of as a backend
   for other APIs; as a result, focusing the app was more likely
   than not to put the source of the event that the user was
   notified about into view

Nowadays both persistent notifications and web notifications
are wide-spread, so the original reasons no longer apply.

This change helps web notifications in particular, as it reduces
the differences between XDG and portal-based implementations.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2332>
2022-07-14 11:39:55 +00:00
Matthew Jakeman
789e1b288a extensions: Allow updating with only extension-manager installed
GNOME Shell will only update extensions if the org.gnome.Extensions
app is present. This commit adds alternative support for
com.mattjakeman.ExtensionManager to the extension updating mechanism.

It enables updates to occur when extension-manager is the sole installed
tool on the system. When both applications are installed,
org.gnome.Extensions is preferred at all times.

Fixes #5564

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2358>
2022-07-11 17:43:11 +00:00
Florian Müllner
97b2079257 endSessionDialog: Small cleanup
Array.prototype.push() returns the new number of elements, so
no need to track the number separately.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2369>
2022-07-11 14:14:37 +00:00
Maksym Hazevych
2a3d409114 dateMenu: Remove custom aligning of time strings in the World Clocks
Since now Glib uses tabular space for aligning numbers (merged in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2698), there is no
more need for custom aligning.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2340>
2022-07-07 12:40:30 +00: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
Evan Welsh
a88e59c1a8 Adopt EventEmitter class instead of injecting Signal methods
Introduce a new class, EventEmitter, which implements signal
handling for pure JavaScript classes. EventEmitter still
utilizes GJS' addSignalMethods internally.

EventEmitter allows static typechecking to understand the
structure of event-emitting JS classes and makes creating
child classes simpler.

The name 'EventEmitter' mirrors a common name for this pattern
in Node and in JS libraries.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2043>
2022-07-04 18:30:49 -04:00
Alynx Zhou
d14bb7b536 screenshot: Always raise UI to top when opening
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2331>
2022-07-04 13:38:15 +00:00
Alynx Zhou
67a1d3b262 ibusCandidatePopup: Prevent it from covering screenshot UI
If we only raise screenshot UI to top, ibusCandidatePopup can still
cover screenshot UI because each time ibusCandidatePopup updates it's
visibility it will raise it to top and this also happens if we open
screenshot UI via keybinding. This commit fixes it by only raising it
above keyboardBox, because keyboardBox is above all entries in modal
dialogs.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2331>
2022-07-04 13:38:15 +00:00
Alynx Zhou
07d9408420 ibusCandidatePopup: Init it as a top chrome
ibusCandidatePopup actually works as a top chrome because it always
raises itself above top_window_group when updating visibility, so just
initing it as a top chrome instead of initing it below top_window_group.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2331>
2022-07-04 13:38:15 +00:00
Florian Müllner
eff23a87c3 keyboard: Fix updating suggestions visibility
Commit 237ba24dbe added corresponding API to the keyboard actor,
but ended up calling it on the KeyboardManager.

Add the expected method to KeyboardManager that forwards the request
to the keyboard.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2359>
2022-07-03 16:47:12 +02:00
Florian Müllner
2defa96198 layout: Force size of overviewGroup
The overviewGroup's size is currently determined by the coverPane
actor. That actor is only shown during transitions, so we rely on
ClutterFixedLayout including hidden children in its size request.

That odd behavior is about to change, so we need to make sure the
overview still requests the correct size.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2351>
2022-07-02 22:18:19 +00:00
Florian Müllner
abe9ba4b0f layout: Use constraint to resize screenShieldGroup
We want the actor to always fill the entire uiGroup. It seems
better and simpler to express that with a contraint than resizing
it explicitly on every monitor change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2351>
2022-07-02 22:18:19 +00:00
Jonas Dreßler
4fd2719dc5 windowManager: Handle window dimming animation getting cancelled
When a window with a modal dialog gets minimized and at the same time
the dialog is closed, the WindowDimmer undim animation starts and gets
cancelled when the minimize animation is done, because that unmaps the
window actor.

In this case we want ensure the dimming effect still goes into a
proper state instead of being stuck mid-animation, so listen to
onStopped instead of onComplete for syncing state of the window dimmer.

While at it, clean things up a little and move the check for the
attach-modal-dialogs pref inside the _syncEnabled() function.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2349>
2022-07-02 00:39:49 +00:00
Jonas Dreßler
31acf30bfa Revert "windowManager: Undim parent when minimizing attached modal"
This reverts commit 78a7cc1836.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2349>
2022-07-02 00:39:49 +00:00
Carlos Garnacho
237ba24dbe ibusCandidatePopup: Set OSK candidates list visibility correctly
Right now, we don't pay much attention to visibility hints from IBus
about the candidates list for the OSK suggestions bar. Since some
IMs rely on this visibility being honored, do that.

To fix this, the visibility hints for the lookup table are now
propagated to the keyboard, so the Suggestions actor hides its
internal candidate buttons. Since the Suggestions actor gets its
minimum height from CSS, this does not result in OSK size jumps.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5601
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2347>
2022-06-29 13:44:36 +00:00
Carlos Garnacho
35ff4bfe3c keyboard: Set ornament on selected item in OSK languages popup menu
There is no hint about the currently selected language, but this exists
in the mockups. Add a dot ornament on the language that is currently
selected at the time of showing the OSK languages popup.

Since this popup is created from scratch every time it is shown, and
the popup is torn down with the OSK during replacement. This also
works for further times the languages popup is shown.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5598
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2346>
2022-06-27 16:50:51 +02:00
Florian Müllner
78a7cc1836 windowManager: Undim parent when minimizing attached modal
Minimizing modal dialogs is highly unconventional - and in fact
disabled in our own code - but apps can still do it programmatically.

The parent window shouldn't remain dimmed in that case, so make
sure to re-check dimming when minimizing an attached modal.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2337>
2022-06-21 22:06:01 +00:00
Sam Hewitt
68653d5e61 nm-dialog: Fix icon spacing issue
- fixes #4928

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2309>
2022-06-20 07:43:31 +00:00
Olivier Fourdan
ed910a7216 kbdA11yDialog: Use MetaKeyboardA11yFlags
The change in mutter to move keyboard accessibility into backends needs
to be applied in gnome-shell as well, otherwise the keyboard
accessibility dialog cannot work.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2306
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2334>
2022-06-16 09:38:20 +00:00
PhilProg
9eef6ec44c appMenu: Hide overview when pressing on 'Show Details'
If the 'Show Details' in the app menu is pressed, the overview
will hide now, making it consistent with other launch actions.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2329>
2022-06-09 17:51:46 +02:00
Sam Uong
ea60bf4bc7 screenshot: Fall back to home if Pictures directory is not available
GLib.get_user_special_dir() returns null if user directories are
disabled. Instead of failing silently, fall back to saving screenshots
in $HOME/Screenshots in that case

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2327>
2022-06-06 20:54:19 +02:00
PhilProg
795723fe85 messageList: Only close messages via delete key if they can be closed
If the delete key is pressed while a message/MPRIS indicator is focused
GNOME now asks whether the message/MPRIS indicator is closable.
If yes it will be closed but if not it won't be closed.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2323>
2022-06-04 15:23:45 +02:00
Sebastian Keller
1952549788 magnifier: Include SSD when calculating screen coordinates for events
When calculating the on screen coordinates of events from the window
relative coordinates, using the frame rect will include the decorations
added by the WM for SSD windows. This was causing the calculated
coordinates to be slightly off. Fix this by using the client rect for
SSD windows.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2319>
2022-05-31 18:55:18 +00:00
Jonas Ådahl
4592337ce5 runDialog: Use single quotes for Wayland restart warning
The API was changed to take a pointer to a MetaContext, in order to have
a better way to fetch the MetaDisplay instance it needs.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2316>
2022-05-31 18:35:41 +00:00
Jonas Ådahl
a6995a3892 runDialog: Pass context to Meta.restart()
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2316>
2022-05-31 18:35:41 +00:00
Sebastian Keller
8b5d027724 magnifier: Request window-relative coordinates for focus/caret events
Absolute screen coordinates are impossible for Wayland clients to
provide, because the clients don't know where the window is positioned.
Some clients, such as the ones using GTK 3 were providing window
relative coordinates even when screen coordinates were requested,
while others, such as GTK 4 clients, were just returning an error for
caret events or also window-relative coordinates for focus events.

So for this to work on Wayland we have to request window-relative
coordinates and translate them to the current focus window.

To ensure the correct coordinates, we have to only consider events
coming from the current focus window. All other events are filtered out
now. As a side effect this also fixes the magnifier always jumping
to a terminal cursor whenever there was some output, even if the window
was not focused.

This also needs some special handling for events coming from the shell
itself, which should not be translated to the focus window either. As
another side effect this fixes another bug that was caused by these
events already including scaling and getting scaled again.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5509
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2301>
2022-05-28 10:47:01 +00:00
Carlos Garnacho
9a0935305d keyboard: Set up OSK edge drag gesture on capture phase
This makes the gesture able to get the events that would otherwise
be meant for the background actor or client window.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5335
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2304>
2022-05-27 09:29:26 +00:00
Carlos Garnacho
1fa5c63307 edgeDragAction: Change edge trigger threshold to AFTER
For all instances of this gesture, we want this gesture to
activate after some distance, not to eat button presses/releases
right away.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2304>
2022-05-27 09:29:26 +00:00
Carlos Garnacho
da3d4e82e3 keyboard: Set up emoji panel pan gesture in capture phase
We need this to catch events before they reach to the emoji
keys, and the gesture can begin/end properly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2304>
2022-05-27 09:29:26 +00:00
Jonas Dreßler
a3bfe0ab56 keyboard: Reset height before requesting preferred height
If we don't set the height property to -1 before requesting the
preferred height, get_preferred_height() will just return us the fixed
height that has been set before. We don't want this behavior here, so
set the height to -1 before calling get_preferred_height().

This fixes a resizing issue where the keyboard is sized incorrectly
after switching the monitor into portrait mode and back.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2306>
2022-05-26 18:16:03 +02:00
Christian Glombek
b5ace213a1 status/network: Show WireGuard connections in VPN list
With this change, WireGuard connections, and an on/off toggle button
or a status description for each are shown in the VPN section of the
Gnome Shell network status UI.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1995>
2022-05-23 18:11:16 +02:00
Florian Müllner
3e7ce18dcf lockScreen: Extend modal grab to entire uiGroup
Main.pushModal() used to ensure a compositor grab, but didn't
take an input grab. That changed when porting to ClutterGrab,
so by limiting the grab to the shield/dialog, it is no longer
possible to access top bar menus when the screen is locked.

To fix that, take the grab on the whole uiGroup so that the top
bar is included.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2298>
2022-05-18 20:16:10 +02:00
Maksym Hazevych
3290ef4eb6 dateMenu: Align time strings in the World Clocks section
The problem is that " 9:59 AM" (notice the space at the beginning) and
"12:59 AM" strings, when centred, look misaligned —
strings padded with a space look off to the right by nearly
half a character. This happens because the font feature "tnum",
used to make numbers monospace, doesn't work on spaces.

The commit overcomes this by aligning time labels to the end.
However, this won't work for locales with AM/PM strings of different
lengths, so they are aligned to the start instead to minimise offset.

It's too complex to know whether the used locale has different
AM/PM string lengths. Instead, every time the time changes, it
determines whether all the time labels have the same amount of characters.

Fixes #5438

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2294>
2022-05-18 14:59:02 +00:00
Florian Müllner
9400759f25 status/volume: Hide sliders initially
We update the visibility on state or stream changes, but those
changes may never happen if pipewire-pulse/pulseaudio isn't
available (for example when running as root).

Hiding the sliders is preferable in that case to showing non-working
controls.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2295>
2022-05-11 02:40:33 +02:00
Florian Müllner
65831f783e Js: Use new :icon-name property
Now that we have the new convenience property, apply it to all
icon-only buttons.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2254>
2022-05-06 13:39:40 +00:00
Sebastian Keller
8e664a8cbe iconGrid: Add more possible icon sizes
When selecting the largest possible icon size for restricted vertical or
horizontal space the options for low resolution icons were rather coarse
grained. This could often result in seemingly too small icons being
chosen in the app grid on systems with low vertical resolution, because
the next larger size would exceed the limit by a few pixels.

This adds two more commonly used sizes for application icons to have
some more options with restricted space.

Helps: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2173
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2289>
2022-05-04 20:49:15 +00:00
Sebastian Keller
23b4eb459e Require both mouse and keyboard grabs for some grabs to be successful
Commit 7419674b changed some grabs from requiring both mouse and
keyboard grabs to be considered successful to only requiring either of
them.

Due to this it was possible for example to open the overview or the
screenshot UI with a client (such as Chrome when opening a menu) holding
the mouse grab. This then made it impossible to interact with the UI
using the mouse (or keyboard) and if attempted could result in an
unresponsive UI.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5414
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2287>
2022-05-04 17:28:08 +00:00
Sebastian Keller
3e8164cc36 screenshot: Close screenshot UI if we failed to acquire a grab
Otherwise the actors will remain invisible yet reactive covering up the
screen.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5414
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2287>
2022-05-04 17:28:08 +00:00
Florian Müllner
b365eb9936 screenshot: Hide screencast button when recorder is disabled
The screencast D-Bus service that is used for the recordings
is only installed if the necessary gstreamer and pipewire
dependencies are found at build time.

The screencast button cannot work when the service is missing,
so don't show it in the first place.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2285>
2022-04-29 20:22:32 +00:00
Jonas Dreßler
682629e603 status/network: Also show disabled icon when wwan is not connected
Commit ca4f6e0123 was supposed to show the
"cellular-disabled" icon when wwan is disabled. For wwan, just like for
bluetooth wwan networks, we probably want this to include the "not
connected" state, because disconnecting from cellular service de-facto
means disabling it.

So switch the check to show the "cellular-disabled" icon to also use the
icon whether there's no active connection, not only when the wwan device
is turned off.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2283>
2022-04-29 20:02:16 +00:00
Carlos Garnacho
378406e1f0 overview: Avoid entering in overview mode during display grab op
ClutterGrab and display grab operations are pretty much mutually
exclusive, but there's no mechanism to ensure a ClutterGrab does
not step on top of an existing grab operation.

This looks the only place that could trigger that (e.g. start
dragging window, then move pointer to top/left corner), so skip
over the situation here explicitly.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5397
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5181
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2281>
2022-04-26 13:32:31 +02:00
Carlos Garnacho
9ee7af233c padOsd: Set menu manager on pad chooser popup
Likewise to action menus, this does now need a menu manager
that lets the popup stack a grab on top of the pad OSD's.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2279>
2022-04-24 18:44:51 +00:00
Carlos Garnacho
1c95283913 padOsd: Set menu manager on actions popup menu
Menus do need a menu manager to handle grabs for them, this
is more necessary now that the padOsd do also push a
Clutter.Grab.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2279>
2022-04-24 18:44:51 +00:00
Sam Hewitt
cb2ee0cf1f osd: Restyle OSD display popup
- remove class from label box
- new style for label itself

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2277>
2022-04-24 18:19:16 +02:00
Jonas Dreßler
851a1e30fa appDisplay: Use icon grid size as distance passed to SwipeTracker
The swipeTracker wants the distance between two pages passed to it in
confirmSwipe(). In case of the app grid, the correct distance is not the
size of the scrollView (which has the width of the whole screen), but
instead the allocation size of the iconGrid (which is the actual size
of a page in the grid).

So pass the allocation size of the iconGrid to the swipeTracker, this
makes sure the pages move perfectly in sync with the pointer when
dragging using the mouse or touchscreen.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2275>
2022-04-24 12:53:50 +00:00
Jonas Dreßler
66331e1244 Pass events to the OSK in dialogs which grab events
With commit c29e0cf6e6 the grabHelper
already started using a similar mechanism to funnel events to the osk
while a ClutterGrab is in effect. ModalDialog, the unlockDialog and
lookingGlass don't make use of the grabHelper though, they use
Main.pushModal() themselves, so those need to funnel the events to the
OSK themselves.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2263>
2022-04-23 09:42:18 +00:00
Jonas Dreßler
61713c7366 keyboard: Capture and bubble event in maybeHandleEvent
Right now the clutter_actor_event() call here errors out because the
second argument is missing, make it capture and bubble the event
properly to fix that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2263>
2022-04-23 09:42:18 +00:00
Florian Müllner
5a4c19a8cb lookingGlass: Handle Esc in object inspector
Currently the main looking glass dialog handles Esc for both itself
and the object inspector. However as the latter now takes its own
Clutter.Grab, key events never reach the main dialog while the
inspector is open.

Fix this by handling the Esc key in the object inspector itself.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2271>
2022-04-21 08:21:45 +00:00
Florian Müllner
56d0b6d831 extensionSystem: Check metadata types
We currently check that an extension provides required metadata
properties, but then assume that all properties have the expected
type.

It turns out that this is putting too much trust in extensions,
so add an appropriate check.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2272>
2022-04-21 08:16:30 +00:00
Florian Müllner
ef74f922d6 background: Do not queue idle when cancelled
A cancelled cancellable means that the background was destroyed,
so we shouldn't queue an idle or emit the 'loaded' signal anymore.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2268>
2022-04-13 21:12:27 +00:00
Florian Müllner
dd28832dcd background: Pass cancellable when querying file info
Otherwise it is possible that the operation completes successfully
after the background has been destroyed, which will throw a warning
(caused by accessing the this._fileWatches object after it has been
nulled).

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2268>
2022-04-13 21:12:27 +00:00
Florian Müllner
e69da36095 layout: Make sure startup animation completes
We currently complete the animation using an onComplete handler,
which only runs if the corresponding transition was stopped when
finished.

While it is unexpected that the transition is interrupted, it can
apparently happen under some circumstances (like VMs with qlx).
The consequences of that are pretty bad, mainly due to the cover
pane that prevents input during the animation not getting removed.

Address this by always completing the animation when the transition
is stopped, regardless of whether it completed or not.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2269>
2022-04-13 21:08:53 +02:00
Simon McVittie
7f4f328a7f Specify API versions for all public GIR APIs, except GLib
If one of these libraries breaks its GIR API in future, then upgrading
packages unrelated to gnome-shell might pull in the newer version,
causing gnome-shell to crash when it gets a newer GIR API that is
incompatible with its expectations. For example, this seems to be
happening in Debian testing at the moment, when GNOME Shell 41.4
imports GWeather and can get version 4.0 instead of the version 3.0 that
it expected.

Adding explicit API versions at the time the newer version is released
is too late, because that will still let the newer version of the GIR API
break pre-existing GNOME Shell packages. Prevent similar crashes in
future by making the desired versions explicit.

This is done for all third-party libraries except GLib, similar to the
common practice in Python code; if GLib breaks API, then that will be
a disruptive change to the whole GLib/GObject ecosystem, regardless.

Gvc, Meta, Shell, Shew, St are not included because they're private
(only exist in a non-default search path entry).

Clutter and Cogl *are* included, because we need to import the fork of
them that comes with Meta, as opposed to their deprecated standalone
versions.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug-Debian: https://bugs.debian.org/1008926
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2261>
2022-04-04 17:55:25 +01:00
Florian Müllner
ff29159df2 workspaceThumbnail: Use new helper function when accepting drops
Moving a window from a secondary monitor to a non-active workspace
currently fails for the aforementioned reasons.

Use the newly added helper function to address this.

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:49 +02:00
Florian Müllner
88244222fd workspace: Use new helper function when accepting drops
Moving a window from a secondary monitor to a non-active workspace
currently fails for the aforementioned reasons.

Use the newly added helper function to address this.

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:49 +02: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
Yosef Or Boczko
44d819149f calendar: Fix alignment of world clocks header in RTL
Signed-off-by: Yosef Or Boczko <yoseforb@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2240>
2022-03-28 18:39:13 +02:00
Florian Müllner
421591359f messageList: Center-align close button vertically
Otherwise it may end up stretched when using larger text.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2257>
2022-03-28 14:50:18 +00:00
Marco Trevisan (Treviño)
8ba7f0f4a9 shellDBus: Actually make ScreenTransitionAsync async
We called such function async but we didn't awaited for the
checkInvocation result in the proper way.

So on failure the shell would report an unhandled promise rejection.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2258>
2022-03-28 15:36:18 +02:00
Raghuveer Kasaraneni
0e45273330 dateMenu: Limit timezone offset hours to integers
If the timezone offset calculation in the World Clocks contains non-zero
minutes, then a decimal Hours value is being displayed. Limit the Hours value
to integers by using Math.floor().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2255>
2022-03-21 19:29:11 +00:00
13r0ck
85b51b9974 layout: Check again for primary monitor after startup animation idle
On some hardware combinations the display can be known, then unknown again. Meaining that
when the update monitors function is called it will have a value, then be called again
setting this.primaryMonitor to null. If the timing is just right gnome shell will
loadBackground, then by the time the animation is ready the monitor will be gone,
thus methods will be called on a null value. This adds more checks for a valid
primary monitor, and wont play the animation until the system is idle AND has a valid
priamry monitor.

Fixes: #5003
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2144>
2022-03-20 22:48:51 +00:00
Anupam Kumar
db68749335 appDisplay: Home and End keys for app grid navigation
Include Home and End keys for consistent behaviour with respect to
overview navigation.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2241>
2022-03-20 22:19:25 +00:00
Florian Müllner
034e59af2d dateMenu: Mark string for translation
T_() is a convenience shortcut for looking up a string from the
locale defined by LC_TIME, but it isn't recognized as a gettext
keyword. To do that, we also have to wrap the string in N_() or
NC_().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2246>
2022-03-20 22:12:32 +00:00
Florian Müllner
6c44162c17 switchMonitor: Fix switching configuration
Since commit 37271ffe70, we pass an explicit `switchType` instead
of the selected item's index to select a configuration. Alas, the item
use `switchMode` as property name, so we always end up passing `undefined`.

Change both to `configType` which matches the API on the other end.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2245>
2022-03-20 22:04:55 +00:00
Daniel van Vugt
2127222b39 overview: Remove desktop fade logic
It existed to fade out/in `nautilus-desktop` for the overview, but it only
ever worked for X11 sessions (`Meta.WindowType.DESKTOP`) and
`nautilus-desktop` no longer exists anyway.

While I had suggested extending it in the past (!1395), that work was
never finished and since then the DING extension has implemented its
own visibility toggling. There seems little value in keeping the old
fade logic around in gnome-shell. Removing it actually fixes a bug with
DING (https://launchpad.net/bugs/1965072).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2244>
2022-03-20 21:57:51 +00:00
Adam Williamson
c5f6482705 appDisplay: Avoid double slash when creating default folders
Creating these default folders still doesn't work. After some
investigation I found that's because the template we use for
the path when creating the `child` `Gio.Settings` instance
results in a double slash - it comes out as e.g.
/org/gnome/desktop/app-folders//folders/Utilities/ . dconf does
not gracefully handle this as many other things that handle
paths do, it considers it a programmer error. It results in
error messages like:

dconf_changeset_set: assertion 'dconf_is_path (path, NULL)' failed

which is slightly confusing. Anyway, we fix it by removing a
slash from the template.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2242>
2022-03-20 21:50:25 +00:00
Jonas Dreßler
95f4a1ecd6 windowPreview: Avoid LEAVE events triggered by grab of our own StButton
Since the ClutterGrab rework, grabbing properly emits crossing events.

StButtons take a ClutterGrab as soon as they are pressed, so pressing
the close StButton of the WindowPreview takes a grab and causes a
LEAVE+key-focus-out event getting sent to the WindowPreview. This in
turn makes us hide our overlay (which the StButton is part of). We
automatically ungrab ClutterGrabs when hiding actors, so the StButtons
grab now gets released again, key-focus and hover state are updated
again and we emit an ENTER event to the WindowPreview. The preview now
tries show its overlay again and things explode because we re-enter the
mapping machinery.

For the LEAVE event we can break this cycle by detecting the GRAB_NOTIFY
crossing event of our own StButton and not reacting to that.

We should do the same for the key-focus-out event, but these don't pass
context information like a GRAB_NOTIFY flag yet, so just check the
current grab actor here.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2231>
2022-03-20 21:42:16 +00:00
Jonas Dreßler
64e4d5df48 popupMenu: Fix usage of GRAB_NOTIFY ClutterEventFlag
Actually the flag gjs gives us here is called
Clutter.EventFlags.FLAG_GRAB_NOTIFY, so fix that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2231>
2022-03-20 21:42:16 +00:00
Jonas Dreßler
b17f00cfb1 workspace: Force creating new layout when there's no allocation yet
Commit ba23279f1f was aimed at fixing a
bug where the layout is frozen so early that we don't have an existing
one to re-use, because no allocation cycle happened yet. It tried to fix
that by forcing the creation of a layout when needsLayout === true,
this turned out to be a bit too much, as it also forced creating a new
layout when the layout was frozen after closing a window (which would
set needsLayout to true).

To fix this regression and still avoid reintroducing the bug the
previous commit fixed, tighten the check a bit and only force creating
the new layout when there's no allocation yet. This makes freezing the
layout after closing a window work again.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2236>
2022-03-13 00:16:19 +00:00
Jonas Dreßler
7bf8f40c84 magnifier: Update zoom region right after enabling the magnifier
We want the zoom region to always be where the mouse cursor is, so make
sure to update it initially, too.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2234>
2022-03-13 00:12:18 +00:00
Jonas Dreßler
f13a6145fd magnifier: Properly hide the second (real) cursor
The magnifier uses a PointerWatcher (which is based on a simple timeout
source) to update the zoom region based on the current mouse cursor
position 60 times a second. When updating the zoom region, it would also
hide mutters cursor using meta_cursor_tracker_set_pointer_visible().

Since a few months, mutter has decoupled the handling of input events
from the monitor refresh rate though, which means it's no longer
guaranteed that the cursor changes only 60 times a second (on higher
refresh rate monitors it actually never was). This means mutter might
show the cursor more often than 60 times a second, while we hide it only
60 times a second, leading to a flickering second cursor.

To fix this, implement the cursor-hiding by listening to
MetaCursorTrackers visibility-changed signal, and immediately hiding the
cursor again when it's shown.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2234>
2022-03-13 00:12:18 +00:00
Jonas Dreßler
aa9edc37a5 workspaceAnimation: Get time outside of the animation-complete callback
We want to use the current event time for activating the workspace, and
this time is only available when calling global.get_current_time() or
Clutter.get_current_event_time() from the context of an event handler.

So instead of trying to get that time when the animation has finished
from the onComplete() handler, get it before and store it as a variable
to use in the onComplete() handler later.

This fixes an error message when switching workspaces using the swipe
gesture where MetaWorkspace complains about the 0-timestamp we pass it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2233>
2022-03-13 00:06:03 +00:00
Ivan Molodetskikh
4bc195e797 windowManager: Change unfullscreen mode to NORMAL
The unfullscreen action doesn't make sense in other modes. In the
overview in particular it also prevents clicking on the top bar items on
a workspace with a fullscreen client.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2227>
2022-03-13 00:01:17 +00:00
Adam Williamson
81029c7d6c appDisplay: Fix a typo in the DEFAULT_FOLDERS definition
This causes a crash because when we look for 'categories' later
for this entry, it's undefined.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2238>
2022-03-12 09:32:56 +00:00
Adam Williamson
0db64d3562 appDisplay: Fix folder loop in _ensureDefaultFolders
In testing on Fedora, gnome-shell crashes here:

JS ERROR: TypeError: DEFAULT_FOLDERS[folder] is undefined

This needs to be a "for of" loop, not a "for in" loop, because
`folders` is an array of the hash's keys, not the hash itself.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2238>
2022-03-12 09:32:56 +00:00
Carlos Garnacho
c1d13fb471 keyboard: Prevent OSK key buttons from creating grabs
In a very un-StButton fashion, OSK keys are not interested in
altering the current focus state, as otherwise pressing those
will trigger a grab that will alter key focus, so the generated
key or IM state events will not be handled by the actor that
originally had the focus as long as the OSK key is pressed.

Despite being StButtons, OSK keys do already perform their own
press/release handling with internal state tracking, so it is
not a big stretch to simply consume the events, and update the
:active pseudo-class manually.

This makes OSK keys still look and behave as usual, but without
any grabbing shenanigans that might affect the focus state. This
makes all OSK keys work again.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4986
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2237>
2022-03-12 09:28:14 +00:00
Carlos Garnacho
c29e0cf6e6 grabHelper: Special case event funneling towards the OSK
In the case of bringing up the OSK while there is a grab (like, every
GNOME Shell entry), we used to special case event capturing so events
directed to the OSK would be let through.

When Clutter.Grab came around, events would be propagated only within
the actor hierarchy that holds the grab, which rendered this special
case just as useless as the OSK while a grab was hold. Since it wouldn't
be part of the grab hierarchy, clicking on the OSK would do nothing.

In order to let the OSK handle events, double down on the special case
and let it forward the event directly to the actor under the device,
instead of trying to let it through somehow. Since the actor under the
device are usually OSK buttons in this case, we don't need further
propagation to make it work, which makes the OSK functional again while
the shell holds a grab.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2237>
2022-03-12 09:28:14 +00:00