waycrate / xdg-desktop-portal-luminous

A xdg-desktop-portal for wlroots based compositors implementing zwlr_screencopy. Written by @decodetalkers
GNU General Public License v3.0
33 stars 5 forks source link

Runtime error when initiating screencasting #16

Open isti115 opened 10 months ago

isti115 commented 10 months ago

The Settings part of the portal seems to be working perfectly, but when I try to initiate a ScreenCast, I get the following error:

2023-12-29T10:54:58.517785Z  INFO
  dispatch_message {
    msg=Msg {
      type: MethodCall,
      sender: UniqueName(Str(Borrowed(":1.15"))),
      path: ObjectPath("/org/freedesktop/portal/desktop"),
      iface: InterfaceName(Str(Borrowed("org.freedesktop.impl.portal.ScreenCast"))),
      member: MemberName(Str(Borrowed("CreateSession"))), body: Signature("oosa{sv}")
    }
  }:dispatch_method_call {
    msg=Msg {
      type: MethodCall,
      sender: UniqueName(Str(Borrowed(":1.15"))),
      path: ObjectPath("/org/freedesktop/portal/desktop"),
      iface: InterfaceName(Str(Borrowed("org.freedesktop.impl.portal.ScreenCast"))),
      member: MemberName(Str(Borrowed("CreateSession"))),
      body: Signature("oosa{sv}")
    }
  }:dispatch_method_call_try {
    msg=Msg {
      type: MethodCall,
      sender: UniqueName(Str(Borrowed(":1.15"))),
      path: ObjectPath("/org/freedesktop/portal/desktop"),
      iface: InterfaceName(Str(Borrowed("org.freedesktop.impl.portal.ScreenCast"))),
      member: MemberName(Str(Borrowed("CreateSession"))),
      body: Signature("oosa{sv}")
    }
  }:
  xdg_desktop_portal_luminous::screencast:
  Start shot:
    path :/org/freedesktop/portal/desktop/request/1_77/obs4,
    appid: thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Connect(NoWaylandLib)', src/screencast.rs:194:63

I am running the binary from the development shell provided through flake.nix, so I assume, that the Wayland library should be present, as it's among the nativeBuildInputs. Also, wayshot works without any issues.

Decodetalkers commented 10 months ago

line 194 is libwayshot init connection, and it says there is no waylandlib

Decodetalkers commented 10 months ago

so, I think that is there is no wayland_display for the service

Decodetalkers commented 10 months ago

you can try to start it from commandline not systemd service..

image

it should need a WAYLAND_DISPLAY

isti115 commented 10 months ago

Thanks for helping me troubleshoot this! The error message was in fact captured by running it in the terminal, but I also have my WAYLAND_DISPLAY imported into the systemd environment, so there has got to be another cause at play.

In case anyone is facing the same issue, the temporary workaround I came up with was using the wlr portal for screencasting and relying on the luminous portal for the accent-color and cholor-scheme settings only. ~/.config/xdg-desktop-portal/portals.conf:

[preferred]
default=wlr
org.freedesktop.impl.portal.Settings=luminous
Shinyzenith commented 10 months ago

Thanks for helping me troubleshoot this! The error message was in fact captured by running it in the terminal, but I also have my WAYLAND_DISPLAY imported into the systemd environment, so there has got to be another cause at play.

In case anyone is facing the same issue, the temporary workaround I came up with was using the wlr portal for screencasting and relying on the luminous portal for the accent-color and cholor-scheme settings only. ~/.config/xdg-desktop-portal/portals.conf:

[preferred]
default=wlr
org.freedesktop.impl.portal.Settings=luminous

This is really interesting. Just to be clear, I am a Nix newbie and I copied the flake.nix from another project...maybe my flake code is the real issue here?

Are you sure luminous portal is receiving the WAYLAND_DISPLAY properly? Because wayshot and luminous use the same code for the backend ( libwayshot ). If wayshot works, there's no reason why luminous shouldn't.

Can you provide your distribution and compositor?

isti115 commented 10 months ago

Can you provide your distribution and compositor?

Of course, it's NixOS 23.11 and river 0.2.6, but I tried under Sway as well and got the same result. I'll make a build that prints the environmental variables just to be sure that WAYLAND_DISPLAY is present and correct for the portal, but I would be very surprised if it wasn't, since as I've said, I have tried it from a terminal and have imported (and verified via systemctl --user show-environment) it into the systemd environment as well.

Shinyzenith commented 10 months ago

Hm still sounds like it's worth a shot. Please let me know!

Arun-Singh-1242 commented 1 month ago

hm still sounds like it's wort a shot. please let me know!