Can I use org.gnome.shell.screencast dbus for wayland support?

I’m the developer of Blue Recorder (based on green recorder) and I rewritten it in rust with support for Xorg and Wayland

I don’t know if snapd allow connect to org.gnome.shell.screencast which I use for recording wayland session

I built the snap and I connect the session using slot interface

  gnome-shell-screencast:
    bus: session
    interface: dbus
    name: org.gnome.shell.screencast

and it appear is not doing anything
and I got this error message

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: MethodError("org.freedesktop.DBus.Error.AccessDenied", Some("An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.826\" (uid=1000 pid=1325666 comm=\"/snap/blue-recorder/x1/blue-recorder \" label=\"snap.blue-recorder.blue-recorder (enforce)\") interface=\"org.gnome.Shell.Screencast\" member=\"ScreencastArea\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.gnome.Shell.Screencast\" (uid=1000 pid=3159 comm=\"/usr/bin/gnome-shell \" label=\"unconfined\")"), Msg { type: Error, sender: "org.freedesktop.DBus", reply-serial: 2, body: Signature: [
        s (115),
] })', src/ffmpeg_interface.rs:320:18

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: MethodError("org.freedesktop.DBus.Error.AccessDenied", Some("An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.828\" (uid=1000 pid=1325666 comm=\"/snap/blue-recorder/x1/blue-recorder \" label=\"snap.blue-recorder.blue-recorder (enforce)\") interface=\"org.gnome.Shell.Screencast\" member=\"StopScreencast\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.gnome.Shell.Screencast\" (uid=1000 pid=3159 comm=\"/usr/bin/gnome-shell \" label=\"unconfined\")"), Msg { type: Error, sender: "org.freedesktop.DBus", reply-serial: 2, body: Signature: [
        s (115),
] })', src/ffmpeg_interface.rs:191:54

source code: https://github.com/xlmnxp/blue-recorder

Drop the slot add add a screencast-legacy plug to your app declaration, see https://snapcraft.io/docs/the-screencast-legacy-interface. You will need to connect the plug manually, eg. snap connect <yoursnap>:screencast-legacy system:screencast-legacy.

I would recommend taking a look at the xdg-portal https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.impl.portal.ScreenCast too.

1 Like

Note that neither the org.gnome.Shell.Screencast or org.freedesktop.portal.ScreenCast interfaces are going to work on Ubuntu releases prior to 21.04 (hirsute). They rely on gnome-shell (and xdg-desktop-portal for the portal interface) being built with Pipewire support, which wasn’t the case for Ubuntu 20.10 and earlier.

If you are running Hirsute, or some other system with a Pipewire enabled gnome-shell+xdg-desktop-portal, then you should be able to use the portal interface simply by plugging the desktop interface.

I use Ubuntu 20.04 and it work fine as native not snap package https://youtu.be/OO3GWWUxORU

that fix the problem, thank you Maciej

Sorry, I hadn’t double-checked 20.04. The interface is definitely missing in Ubuntu 20.10, likely because they replaced the old implementation with one depending on Pipewire.

The xdg-desktop-portal interface is a wrapper for gnome-shell’s org.gnome.Mutter.ScreenCast D-Bus interface, which definitely isn’t available in the older Ubuntu releases.

Someone make issue about this problem
Will the issue fix in 21.04 because Wayland will be default?

It should, yes. The screencast interface was made dependent on Pipewire, and gnome-shell in 21.04 is built with Pipewire.

1 Like