hyprwm / xdg-desktop-portal-hyprland

xdg-desktop-portal backend for Hyprland
BSD 3-Clause "New" or "Revised" License
267 stars 45 forks source link

Screen share breaks if monitor gets powered off #217

Open YourSandwich opened 3 months ago

YourSandwich commented 3 months ago

Hi, when i turn off both of my monitors and turn them back on, full-screen share does not work anymore, only applications work. Restarting xdg-desktop-portal-hyprland like this fixes it:

killall xdg-desktop-portal-hyprland
hyprctl dispatch exec xdg-desktop-portal-hyprland

This is the error log when trying to screen share after restarting my monitors:

[LOG] Found output name DP-2
[LOG] Found output name DP-3
[LOG] [toplevel] Activated, bound to 5bf148448890, toplevels: 7
[LOG] [screencopy] Registered for toplevel export
[LOG] [screenshot] init successful
[LOG]  | Got interface: wl_output (ver 4)
[LOG] Found output name HEADLESS-1
[LOG]  | Got interface: wl_output (ver 4)
[LOG] Found output name DP-3
[LOG]  | Got interface: wl_output (ver 4)
[LOG] Found output name DP-2
[LOG] [toplevel] (activate) locks: 2
[LOG] [screencopy] New session:
[LOG] [screencopy]  | /org/freedesktop/portal/desktop/request/1_53/webrtc_57693349
[LOG] [screencopy]  | /org/freedesktop/portal/desktop/session/1_53/webrtc_session1912455590
[LOG] [screencopy]  | appid: 
[LOG] [screencopy] SelectSources:
[LOG] [screencopy]  | /org/freedesktop/portal/desktop/request/1_53/webrtc1134696143
[LOG] [screencopy]  | /org/freedesktop/portal/desktop/session/1_53/webrtc_session1912455590
[LOG] [screencopy]  | appid: 
[LOG] [screencopy] option persist_mode to 1
[LOG] [screencopy] unused option multiple
[LOG] [screencopy] unused option types
[LOG] [screencopy] restore data invalid / missing, prompting
[LOG] execAndGet: WAYLAND_DISPLAY=wayland-1 QT_QPA_PLATFORM="wayland" XCURSOR_SIZE=32 HYPRLAND_INSTANCE_SIGNATURE=cba1ade848feac44b2eda677503900639581c3f4_1716390875_1544677884 XDPH_WINDOW_SHARING_LIST="1212459120[HC>]kitty[HT>]tmux[HE>]1212461600[HC>]kitty[HT>]tmux[HE>]1212462960[HC>]firefox[HT>]Mozilla Firefox[HE>]1212463072[HC>]Element-Nightly[HT>]Element[HE>]1212660592[HC>]org.keepassxc.KeePassXC[HT>]Noa.kdbx [Locked] - KeePassXC[HE>]1212661952[HC>]thunderbird[HT>]Mozilla Thunderbird[HE>]1212663280[HC>]kitty[HT>]fish[HE>]" hyprland-share-picker 2>&1
[LOG] [sc] Selection: r/screen:DP-3

[LOG] [screencopy] SHAREDATA returned selection 0
[LOG] [screencopy] Start:
[LOG] [screencopy]  | /org/freedesktop/portal/desktop/request/1_53/webrtc542465749
[LOG] [screencopy]  | /org/freedesktop/portal/desktop/session/1_53/webrtc_session1912455590
[LOG] [screencopy]  | appid: 
[LOG] [screencopy]  | parent_window: 
[ERR] [screencopy] Couldn't obtain a format from dma
[LOG] [screencopy] Sent restore token to /org/freedesktop/portal/desktop/session/1_53/webrtc_session1912455590

First 5 lines are before turning off the monitros.

iabdelkareem commented 2 months ago

+1 I'm also experiencing this issue.

hugoeustaquio commented 1 month ago

Same here, but thanks for the workarround, I just wrote an script with IPC:

handle() {
  case $1 in
    monitoradded*) killall xdg-desktop-portal-hyprland; hyprctl dispatch exec xdg-desktop-portal-hyprland ;;
  esac
}

socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done