Commit Graph

32 Commits

Author SHA1 Message Date
Florian Müllner
dc0491ade8 dbusServices/screencast: Handle pipeline failures gracefully
If parsing the pipeline fails for some reason, we currently end up
with a zombie session that leads to a stuck recording indicator in
gnome-shell.

Instead, properly tear down the session to allow mutter and gnome-shell
to correctly update their state.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1878>
2021-06-09 15:21:35 +00:00
Jonas Dreßler
51bf7ec176 screencastService: Improve the gstreamer pipeline for recording
The current gstreamer pipeline performs quite bad on slower machines and
is dropping lots of frames, improve the pipeline by changing a few
things:

- Use threads for videoconvert and improve speed of videoconvert by
disabling some unneeded things
- Add a queue before the encoding step, this allows the encoder to work
at its own pace and will lead to a lot more stability
- Remove the fixed quantizer and only set a max quantizer, this helps
quite a bit with performance
- Change the deadline parameter of vp8enc to 1: This makes the encoder
go into real time mode, which will make it a lot faster
- Set cpu-used to 16, the maximum possible value.
- Set static-threshold to 1000, static-threshold is the motion detection
threshold, and while a value of 100 is recommended for screencasting in
the gstreamer documentation (see [1]), using 1000 appears to perform a
lot better and still outputs fairly good quality
- Set a larger buffer size than the default size, this seems to get a
bit more stability during high load scenarios

All in all, those changes make the pipeline drop no more frames when
recording at 30 FPS and 2K screen resolution. That was tested on a
fairly recent mobile core-i5 processor.

Also, because we now have two %T replacement strings for the number of
threads, we need to switch to replaceAll(). For that to work, we have to
put the %T matching expression into quotes.

[1] https://gstreamer.freedesktop.org/documentation/vpx/GstVPXEnc.html?gi-language=c#GstVPXEnc:static-threshold

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1633>
2021-05-04 13:45:57 +00:00
Simon Schneegans
a8a79c0333 extensionsService: Log error if preferences dialog failed to open
This is helpful for continuous integration checks to see whether the
preferences dialog of an extension can be opened successfully.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1830>
2021-05-01 21:07:36 +00:00
Florian Müllner
dedfdb6d0b dbusServices/screensaver: Disable auto-shutdown
For the screensaver service, it is quite normal that a consumer only
subscribes to the "ActiveChanged" signal without calling any methods.

The result is that we don't know about the consumer, and shut down
the service anyway after we hit the timeout.

If this happens, we break functionality like gnome-settings-daemon's
screen blanking on idle.

Fix this by simply disabling auto-shutdown for the service, which
also reflects the expectation that the screen saver service is
always running in a GNOME session.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1824>
2021-04-28 18:12:13 +00:00
Jan Tojnar
53dd291aba extensionsService: Really fix copying technical details
gdk_clipboard_set_text() is not introspectable, we have to use
gdk_clipboard_set_value() (shadowed as gdk_clipboard_set())
instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1796>
2021-04-09 20:53:34 +00:00
Jan Tojnar
1b5d71130e extensionsService: Fix copying technical details when extension crashes
This was forgotten when porting to GTK 4, leading to the following error
when user tries to copy the error message produced by an extension:

	JS ERROR: TypeError: Gtk.Clipboard is undefined
	_initActions/<@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:255:31
	run@resource:///org/gnome/Shell/Extensions/js/dbusService.js:177:20
	main@resource:///org/gnome/Shell/Extensions/js/main.js:19:13
	run@resource:///org/gnome/gjs/modules/script/package.js:206:19
	start@resource:///org/gnome/gjs/modules/script/package.js:190:8
	@/nix/store/fwnkwvhwm3kqck4fhkc5y5z853radggg-gnome-shell-40.0/share/gnome-shell/.org.gnome.Shell.Extensions-wrapped:7:17

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1795>
2021-04-08 08:10:36 +02:00
Florian Müllner
2e9a2e68b7 dbusServices/screencast: Use GTK4
The separate screencast service has some minimal GTK usage, which
we can trivially move to GTK4.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1591>
2021-01-25 21:09:22 +01:00
Florian Müllner
a32df6b7a3 extensionsService: Fix setting prefs dialog parent
Between the GTK4 port and the latest GTK4 version, calling realize()
on a newly created window to force its surface to be created stopped
working.

So instead, wait for the window to get realized regularly to set its
parent.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1574>
2021-01-18 11:40:46 +00:00
Florian Müllner
edd34c50d9 Port extensions app and portal to GTK4
With the previous preparations in place, it is time to take the plunge.

As both the app and the portal use the same small library for handling
external windows, port everything at once to avoid the hassle of building
and installing two versions of the library.

With the portal using GTK4 now, all extensions must port their preference
widgets as well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1495>
2021-01-14 13:03:21 +00:00
Florian Müllner
ba039bcce5 dbusServices/extensions: Remove event box
In GTK4, all widgets are reactive, and therefore GtkEventBox has
been removed. In order to make the upcoming GTK4 port a bit cleaner,
remove the expander's event box now.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1495>
2021-01-14 13:03:21 +00:00
Florian Müllner
99a796e426 dbusServices/extensions: Stop stacking frames
We currently use separate frames for the details expander and the
expanded details. That layout works as long as frames are boxy (as
in the default GTK3 style), but breaks down with rounded corners
(as in the default GTK4 style).

In order to work with either style, adapt the layout to use a single
surrounding frame and appropriate borders as separator.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1495>
2021-01-14 13:03:21 +00:00
Florian Müllner
9bb91ca875 dbusServices/extensions: Stop using GtkToolbar
Toolbars have been removed from GTK4, so just use a regular GtkBox
for the error details bottom bar.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1495>
2021-01-14 13:03:21 +00:00
Florian Müllner
1016b919f0 dbusServices/extensions: Stop using GtkContainer API
The interface has been removed in GTK4, so use widget-specific API
for adding children where possible.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1495>
2021-01-14 13:03:21 +00:00
Florian Müllner
a450550e5f dbusServices/extensions: Stop using :margin shortcut
The property has been removed in GTK4, so prepare for a port by
setting the four individual margin properties instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1495>
2021-01-14 13:03:21 +00:00
Florian Müllner
2189dc61fb dbusServices/extensions: Use consistent style for property names
GtkBuilder understands both dashes and underscores in property names,
and we currently use a mix of both. The actual properties use dashes,
so settle on that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1495>
2021-01-14 13:03:21 +00:00
Florian Müllner
9d14b0c682 dbusServices/extensions: Set title on window instead of headerbar
GTK4 will remove the GtkHeaderBar:title property, so stop using it
and set the window's title property instead, as that's what headbars
use in both GTK3 and GTK4 unless explicitly overridden.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1495>
2021-01-14 13:03:21 +00:00
Florian Müllner
618762ebe0 dbusServices/extensions: Minor cleanup
There's little point in setting properties to their default value,
so stop doing that.

(GtkFrame:shadow-type actually defaults to "edged-in" rather than "in",
but all types other than "none" are treated the same nowadays)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1495>
2021-01-14 13:03:21 +00:00
Florian Müllner
af5aff3251 dbusServices/screensaver: Split out public ScreenSaver service
Commit 799bbdb50 split out the public Fdo notification service, so
that any app with permission to talk to org.freedesktop.Notifications
will in fact be limited to that service.

To a somewhat lesser extent this applies to the org.gnome.ScreenSaver
service as well, which some applications still use instead of the
Inhibit portal.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1520>
2020-12-07 16:24:19 +00:00
Florian Müllner
8a47f1c667 cleanup: Remove empty leading/trailing lines in blocks
gjs added a new rule to its eslint ruleset that forbids "block padding",
so make sure we conform to that rule before syncing up the configuration.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1498
2020-11-16 18:04:23 +00:00
Florian Müllner
386d25e6f8 dbusServices/screencast: Add recordings to recent items
This is useful functionality that got lost when replacing the built-in
recorder with an external screencast service; bring it back.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3171
2020-09-14 21:15:13 +00:00
Florian Müllner
b3f35912be dbusServices/screencast: Save under resolved file path
... instead of using the original template as file name.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3097
2020-09-02 16:28:48 +02:00
Florian Müllner
9d6ccb6072 dbusServices/screencast: Quote filename in pipeline
Otherwise Gst fails to parse the pipeline string if the filename
contains spaces, as all words following the first are interpreted
as additional Gst elements.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1403
2020-08-11 11:50:44 +00:00
Jonas Ådahl
2b0731ab81 Move screencasting into a separate service process
Move the screencasting into a separate D-Bus service process, using
PipeWire instead of Clutter API. The service is implemented in
Javascript using the dbusService.js helper, and implements the same API
as was done by screencast.js and the corresponding C code.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1372
2020-07-31 10:51:12 +02:00
Jonas Ådahl
73436b5276 dbusService: Queue shutdown check on startup
If something started the service, but crashed before managing to make a
method call, we'd end up with the service running indefinitely. Fix this
by queueing a shutdown check immediately on startup.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1372
2020-07-31 10:51:12 +02:00
Florian Müllner
82fd68b985 notificationDaemon: Fix grouping by PID
For fd.o notifications, we are taking the sender's PID into
account when associating notifications with sources (mainly
to deal with notify-send).

This broke when the implementation under the well-known name
was moved into a separate service, as the implementation in
gnome-shell will now always see the public notification-daemon
as sender.

Restore the old behavior by resolving the sender PID in the
separate service, and pass it as hint to the implementation
in gnome-shell.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2592
2020-05-19 08:24:07 +00:00
Florian Müllner
a90fcb7ddb dbusServices/extensions: Handle parentWindow parameter
Now that the service implements the preference dialog, it's time
to support OpenExtensionPrefs()'s parentWindow parameter and make
the dialog a transient of the external window if specified.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1087
2020-03-26 18:32:30 +01:00
Florian Müllner
23e5cd4e10 dbusServices/extensions: Include Params module
It's unused and was removed in commit a0467bf875, which broke extensions
that rely on it in their preference widget.

As the removal only happened post-3.36.0, add it back until we branch.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2476
2020-03-24 10:38:24 +01:00
Florian Müllner
34e85342d8 dbusServices/extensions: Take over prefs dialog from app
As outlined earlier, in order to turn the Extensions app into a properly
sandboxed application, we need to split out the extension prefs dialog
and move it elsewhere.

With "elsewhere" being the new Extensions D-Bus service, effectively
turning it into a shell extensions portal.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1106
2020-03-23 15:39:12 +00:00
Florian Müllner
91b7474d5a dbusServices/extensions: Proxy Extensions API
Similar to the previously added org.freedesktop.Notifications proxy,
this exposes the org.gnome.Shell.Extensions API and forwards any
request to the real implementation in gnome-shell.

The motivation differs though: We want to be able to package the
extension app as flatpak and distribute it separately, but the
extension prefs dialog is hard to impossible to sandbox:

 - filenames need translating between host and sandbox, and we
   can only do that in some cases (serializing/deserializing
   extensions), but not others (extension settings that refer
   to files)

 - system extensions install their GSettings schemas in the system
   path; the best we can do there is assume a host prefix of /usr
   and set GSETTINGS_SCHEMA_DIR in the flatpak (eeks)

 - extensions may rely on additional typelibs that are present on
   the host (for example because gnome-shell itself depends on
   them), but not inside the sandbox - unless we bundle all of
   gnome-shell's dependencies

 - if gjs/mozjs differ between host and sandbox, extensions must
   handle different runtimes for the extension and its prefs

And all those issues occur despite a very permissive sandbox (full
host filesystem access, full dconf access, full org.gnome.Shell
access (including Eval()!)).

This new service will give us an alternative place for handling
the preference dialog:

 - it runs outside of gnome-shell process, so can open windows

 - it runs on the host, so the extension's prefs get to run
   in the same namespace as the extension itself

That is, the service will provide portal-like functionality (albeit
not using the org.freedesktop.portal.* namespace, as extension
management is an inherently privileged operation).

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1106
2020-03-23 15:39:12 +00:00
Florian Müllner
2c91b6164c dbusServices: Allow to inhibit auto-shutdown
While we only shut down after a method call completed or (if the
interface has signals) the sender disconnects from the bus, services
may need to inhibit auto-shutdown for more specific reasons themselves,
for example when a method call kicks off an operation that should
complete before shutting down.

Add hold() and release() methods like Gio.Application for those cases.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1115
2020-03-21 20:16:22 +00:00
Florian Müllner
799bbdb503 dbusServices/notifications: Add a separate notification daemon
Add a small service that exposes the Fdo notification API under the
well-known name, and forwards any requests to the actual implementation
in the shell.

That way any app with permission to talk to org.freedesktop.Notifications
will get exactly that, and nothing more.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/547
2020-03-12 16:09:27 +00:00
Florian Müllner
574c560677 dbusServices: Add some base classes for small stand-alone services
There are a couple of D-Bus services that are currently provided by
gnome-shell for which it makes sense to move them fully or partially
into separate processes:

 - screen recording (performance)
 - FDO notifications (security)
 - Extensions (portalization)

Add some base classes and build system glue to take care of the
common boilerplate.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/547
2020-03-12 16:09:27 +00:00