emersion / xdg-desktop-portal-wlr

xdg-desktop-portal backend for wlroots
MIT License
599 stars 61 forks source link

xdg-desktop-portal-wir fails to activate #318

Open francislen99 opened 2 months ago

francislen99 commented 2 months ago

Trying to manually activate this is what appears.

$ systemctl --user status xdg-desktop-portal-wlr

× xdg-desktop-portal-wlr.service - Portal service (wlroots implementation)
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-wlr.service; static)
     Active: failed (Result: exit-code) since Mon 2024-09-02 01:37:03 EEST; 2min 57s ago
    Process: 26659 ExecStart=/usr/libexec/xdg-desktop-portal-wlr (code=exited, status=1/FAILURE)
   Main PID: 26659 (code=exited, status=1/FAILURE)
        CPU: 3ms

Sep 02 01:37:03 B450M-DS3H systemd[1644]: xdg-desktop-portal-wlr.service: Scheduled restart job, restart counter is at 5.
Sep 02 01:37:03 B450M-DS3H systemd[1644]: xdg-desktop-portal-wlr.service: Start request repeated too quickly.
Sep 02 01:37:03 B450M-DS3H systemd[1644]: xdg-desktop-portal-wlr.service: Failed with result 'exit-code'.
Sep 02 01:37:03 B450M-DS3H systemd[1644]: Failed to start xdg-desktop-portal-wlr.service - Portal service (wlroots implementation).

Doing systemctl --user status xdg-desktop-portal.service I get:

$ systemctl --user status xdg-desktop-portal.service

● xdg-desktop-portal.service - Portal service
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
     Active: active (running) since Sun 2024-09-01 22:35:46 EEST; 3h 6min ago
   Main PID: 2390 (xdg-desktop-por)
      Tasks: 8 (limit: 38318)
     Memory: 6.3M (peak: 7.1M)
        CPU: 1.041s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
             └─2390 /usr/libexec/xdg-desktop-portal

Sep 01 22:35:22 B450M-DS3H systemd[1644]: Starting xdg-desktop-portal.service - Portal service...
Sep 01 22:35:22 B450M-DS3H xdg-desktop-por[2390]: Choosing wlr.portal for org.freedesktop.impl.portal.ScreenCast via the deprecated UseIn key
Sep 01 22:35:22 B450M-DS3H xdg-desktop-por[2390]: The preferred method to match portal implementations to desktop environments is to use the portals.conf(5) configuration file
Sep 01 22:35:46 B450M-DS3H xdg-desktop-por[2390]: Failed to create screen cast proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.wlr: Timeout was reached
Sep 01 22:35:46 B450M-DS3H xdg-desktop-por[2390]: No skeleton to export
Sep 01 22:35:46 B450M-DS3H systemd[1644]: Started xdg-desktop-portal.service - Portal service.

Linuxmint 22 wayland is my distro and i have downloaded xdg-desktop-portal-wlr (package) via the software manager, latest ubuntu version 0.7.1-1build2.

Have downloaded Wireplumber and pipewire together with some related packages to pipewire.

rogueai commented 2 months ago

Hi, I'm just a regular user so take my hint with a grain of salt, but I'd first check here: https://github.com/emersion/xdg-desktop-portal-wlr/wiki/%22It-doesn't-work%22-Troubleshooting-Checklist

I'm noticing from your logs you're not using portals.conf, so I'd first try creating ~/.config/xdg-desktop-portals/<compositor>-portals.conf where <compositor> is your current compositor as defined by $XDG_CURRENT_DESKTOP

For a sane default I would use this for portals.conf

[preferred]
default=gtk
org.freedesktop.impl.portal.ScreenCast=wlr
org.freedesktop.impl.portal.Screenshot=wlr
org.freedesktop.impl.portal.Inhibit=none

HTH.

francislen99 commented 2 months ago

Hi, I'm just a regular user so take my hint with a grain of salt, but I'd first check here: https://github.com/emersion/xdg-desktop-portal-wlr/wiki/%22It-doesn't-work%22-Troubleshooting-Checklist

I'm noticing from your logs you're not using portals.conf, so I'd first try creating ~/.config/xdg-desktop-portals/<compositor>-portals.conf where <compositor> is your current compositor as defined by $XDG_CURRENT_DESKTOP

For a sane default I would use this for portals.conf

[preferred]
default=gtk
org.freedesktop.impl.portal.ScreenCast=wlr
org.freedesktop.impl.portal.Screenshot=wlr
org.freedesktop.impl.portal.Inhibit=none

HTH.

Alright did plenty of things to fix the systemctl --user status xdg-desktop-portal.service error reports and that is :

  1. remove any mention of gnome from /usr/share/xdg-desktop-portal/ on all .portals and the x-cinnamon.portals.conf and force the wlr.portals by replacing UseIn=wlroots;sway;Wayfire;river;phosh;Hyprland; with UseIn=X-Cinnamon;MATE;XFCE; (;MATE;XFCE I think are redundant and can be ignored, what is important here is X-Cinamon as XDG_CURRENT_DESKTOP=X-Cinnamon) In xapp.portal and xapp-gnome-keyring.portal their UseIn=X-Cinnamon;MATE;XFCE; I replaced with UseIn=wlroots;sway;Wayfire;river;phosh;Hyprland; so they wont be used, they could be removed i think but havent tested it so proceed with caution. I created the folder at /home/YOURNAME/.config/xdg-desktop-portal/ and with a script named x-cinnamon-portals.conf with the contents you provided.

  2. The contents of x-cinnamon.portals.conf located at /usr/share/xdg-desktop-portal I replaced with [preferred] default=xapp;gtk; org.freedesktop.impl.portal.desktop.wlr

  3. I installed dbus-broker from software manager as I saw a lot of people saying without it the system didnt function correctly

Now with systemctl --user status xdg-desktop-portal.service I get:

 ● xdg-desktop-portal.service - Portal service
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
     Active: active (running) since Mon 2024-09-02 16:27:53 EEST; 1min 44s ago
   Main PID: 2373 (xdg-desktop-por)
      Tasks: 7 (limit: 38318)
     Memory: 5.7M (peak: 6.3M)
        CPU: 109ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
             └─2373 /usr/libexec/xdg-desktop-portal

Sep 02 16:27:52 B450M-DS3H systemd[1609]: Starting xdg-desktop-portal.service - Portal service...
Sep 02 16:27:53 B450M-DS3H systemd[1609]: Started xdg-desktop-portal.service - Portal service. ` 

But still xdg-desktop-portal-wlr doesnt activate


systemctl --user status xdg-desktop-portal-wlr.service
× xdg-desktop-portal-wlr.service - Portal service (wlroots implementation)
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-wlr.service; static)
     Active: failed (Result: exit-code) since Mon 2024-09-02 16:27:54 EEST; 16min ago
    Process: 3026 ExecStart=/usr/libexec/xdg-desktop-portal-wlr (code=exited, status=1/FAILURE)
   Main PID: 3026 (code=exited, status=1/FAILURE)
        CPU: 5ms

Sep 02 16:27:54 stefanos-B450M-DS3H systemd[1609]: xdg-desktop-portal-wlr.service: Scheduled restart job, restart counter is at 4.
Sep 02 16:27:54 B450M-DS3H systemd[1609]: xdg-desktop-portal-wlr.service: Start request repeated too quickly.
Sep 02 16:27:54 B450M-DS3H systemd[1609]: xdg-desktop-portal-wlr.service: Failed with result 'exit-code'.
Sep 02 16:27:54 B450M-DS3H systemd[1609]: Failed to start xdg-desktop-portal-wlr.service - Portal service (wlroots implementation). 

What gives?

rogueai commented 2 months ago

Eh, difficult to say, at this point your best bet is to start xdpw yourself and try to get some logs for devs to have a look at.

Stop your xdg-desktop-portal-wlr user service and start it manually in debug mode with:

 /usr/lib/xdg-desktop-portal-wlr -r -l DEBUG
francislen99 commented 2 months ago

Eh, difficult to say, at this point your best bet is to start xdpw yourself and try to get some logs for devs to have a look at.

Stop your xdg-desktop-portal-wlr user service and start it manually in debug mode with:

 /usr/lib/xdg-desktop-portal-wlr -r -l DEBUG

Whats the equivalent command for that in linuxmint/ubuntu based distros? Don't use arch currently.

rogueai commented 2 months ago

The command should be the same, you'll need to find out where your distro installs the xdpw executable

rogueai commented 2 months ago

Actually you can just cat the service and find the ExecStart bit:

systemctl --user cat xdg-desktop-portal-wlr 
francislen99 commented 2 months ago

Actually you can just cat the service and find the ExecStart bit:

systemctl --user cat xdg-desktop-portal-wlr 

Here's the output:

$systemctl --user cat xdg-desktop-portal-wlr 

# /usr/lib/systemd/user/xdg-desktop-portal-wlr.service
[Unit]
Description=Portal service (wlroots implementation)
PartOf=graphical-session.target
After=graphical-session.target
ConditionEnvironment=WAYLAND_DISPLAY

[Service]
Type=dbus
BusName=org.freedesktop.impl.portal.desktop.wlr
ExecStart=/usr/libexec/xdg-desktop-portal-wlr
Restart=on-failure
rogueai commented 2 months ago

Ok so you should run:

/usr/libexec/xdg-desktop-portal-wlr -r -l DEBUG

And try to activate the portal again. Just make sure you've stopped the user service first.

francislen99 commented 2 months ago

Alright heres the output :

/usr/libexec/xdg-desktop-portal-wlr -r -l DEBUG
2024/09/02 18:58:30 [INFO] - config: no config file found, using the default config
2024/09/02 18:58:30 [DEBUG] - config: outputname:  (null)
2024/09/02 18:58:30 [DEBUG] - config: max_fps:  0.000000
2024/09/02 18:58:30 [DEBUG] - config: exec_before:  (null)
2024/09/02 18:58:30 [DEBUG] - config: exec_after:  (null)
2024/09/02 18:58:30 [DEBUG] - config: chooser_cmd: (null)
2024/09/02 18:58:30 [DEBUG] - config: chooser_type: default
2024/09/02 18:58:30 [DEBUG] - config: force_mod_linear: 0
2024/09/02 18:58:30 [DEBUG] - dbus: connected
2024/09/02 18:58:30 [DEBUG] - wlroots: wl_display connected
2024/09/02 18:58:30 [DEBUG] - pipewire: pw_loop created
2024/09/02 18:58:30 [DEBUG] - pipewire: establishing connection to core
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register wl_drm  (Version: 2)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register wl_compositor  (Version: 4)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register wl_shm  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: |-- registered to interface wl_shm (Version 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register wl_output  (Version: 2)
2024/09/02 18:58:30 [DEBUG] - wlroots: |-- registered to interface wl_output (Version 4)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zxdg_output_manager_v1  (Version: 3)
2024/09/02 18:58:30 [DEBUG] - wlroots: |-- registered to interface zxdg_output_manager_v1 (Version 3)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register wl_data_device_manager  (Version: 3)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zwp_primary_selection_device_manager_v1  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register gtk_primary_selection_device_manager  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register wl_subcompositor  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register xdg_wm_base  (Version: 3)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zxdg_shell_v6  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register wl_shell  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register gtk_shell1  (Version: 3)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register wp_viewporter  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zwp_pointer_gestures_v1  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zwp_tablet_manager_v2  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register wl_seat  (Version: 5)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zwp_relative_pointer_manager_v1  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zwp_pointer_constraints_v1  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zxdg_exporter_v1  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zxdg_importer_v1  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zwp_linux_dmabuf_v1  (Version: 3)
2024/09/02 18:58:30 [DEBUG] - wlroots: |-- registered to interface zwp_linux_dmabuf_v1 (Version 3)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zwp_keyboard_shortcuts_inhibit_manager_v1  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register zwp_text_input_manager_v3  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wlroots: interface to register gtk_text_input_manager  (Version: 1)
2024/09/02 18:58:30 [DEBUG] - wayland: registry listeners run
2024/09/02 18:58:30 [ERROR] - Compositor doesn't support zwlr_screencopy_manager_v1!
2024/09/02 18:58:30 [DEBUG] - pipewire: disconnecting fom core
2024/09/02 18:58:30 [ERROR] - xdpw: failed to initialize screencast
'impl->enter_count > 0' failed at ../spa/plugins/support/loop.c:362 loop_leave()
rogueai commented 2 months ago

This is likely the issue:

Compositor doesn't support zwlr_screencopy_manager_v1

Again, I'm no developer here so please don't take my word on this, but I suspect xdpw just doesn't work on Cinnamon, which I got is your current DE?

francislen99 commented 2 months ago

This is likely the issue:

Compositor doesn't support zwlr_screencopy_manager_v1

Again, I'm no developer here so please don't take my word on this, but I suspect xdpw just doesn't work on Cinnamon, which I got is your current DE?

Yep. Mint 22 wayland CInnamon

rogueai commented 2 months ago

I suppose you've already tried the regular xdg-desktop-portal-xapp? Here it says screen cast is supported, not sure if in wayland

francislen99 commented 2 months ago

I suppose you've already tried the regular xdg-desktop-portal-xapp? Here it says screen cast is supported, not sure if in wayland

Tried it, seems like it doesn't work correctly since for example on OBS theres no display capture unless i open apps with x11 config and it displays just a black screen. Seems like its impossible atm unless xdg-desktop-portal-wlr it starts accepting cinnamon.

francislen99 commented 2 months ago

Anyways I found the fix to my problem for not being able to use discord share screen and obs.

For discord go to system settings then Start up Applications and find discord. Select it and on the edit startup program window put on the COmmand box : env XDG_SESSION_TYPE=x11 discord /usr/bin/Discord and save. Do the same for the discord desktop icon by going properties and on the command box put the same as we did previously. Now discord share screen should not load for infinity and youll be able to share a specific window of your choice. Sharing the entire screen will display only a black screen.

For obs open the terminal and put QT_QPA_PLATFORM=xcb obs Obs should start and now select window capture as display capture is broken. On window capture select the screens of your choice and youre good.

Thats all from me so I will let this open, any dev that sees the issues and any reports here can close this thread later.