Commit Graph

869 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
Jonas Ådahl
f979ebcb1a remoteAccess: Hide indicator after a timeout
In order to make very short screen capture sessions more visible, let
the indicator remain visible, but a bit greyed out, for some seconds.
This makes it more obvious something was just capturing the screen.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2132>
2022-03-04 22:05:46 +00:00
Florian Müllner
26235bbe54 js: Use (dis)connectObject()
Start using the new methods to simplify signal cleanup. For now,
focus on replacing existing cleanups; in most cases this means
signals connected in the constructor and disconnected on destroy,
but also other cases with a similarly defined lifetime (say: from
show to hide).

This doesn't change signal connections that only exist for a short
time (say: once), handlers that are connected on-demand (say: the
first time a particular method is called), or connections that
aren't tracked (read: disconnected) at all.

We will eventually replace the latter with connectObject() as
well - especially from actor subclasses - but the changeset is
already big enough as-is :-)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1953>
2022-03-04 14:14:37 +00:00
Jonas Dreßler
eeabdd150c status/bluetooth: Clear list of connected signals on adapter changes
With the porting of gnome-bluetooth to the new GListModel API the
behavior regarding removing adapters changed: It now no longer
guarantees to emit "device-removed" signals for the paired devices when
the adapter gets removed.

This means we need to do that ourselves now, so clear the list of
connected signals when the default adapter changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2214>
2022-02-26 15:53:19 +00:00
Jonas Dreßler
94d9264d96 Revert "status/bluetooth: Bail out and hide UI when there's no adapter"
Turns out this broke showing the bluetooth menu entry for adapters which
rely on the had-devices-setup property being set while turned off. These
adapters are completely removed from the system by the firmware after
powering them off, so in that case there is no default adapter anymore,
although we still want to show the menu.

This reverts commit aaf47167b5.

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

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

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2200>
2022-02-23 12:23:52 +00:00
Florian Müllner
ac9fbe92e5 cleanup: Use new indentation style for arrays
We've made some progress on transitioning to the modern indentation
style, and for arrays the legacy style is now rare enough to make
a bulk transition feasible.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2200>
2022-02-23 12:23:52 +00:00