emersion / xdg-desktop-portal-wlr

xdg-desktop-portal backend for wlroots
MIT License
596 stars 59 forks source link

Configuration problem with wofi output selector for screen sharing #124

Closed robertjk closed 3 years ago

robertjk commented 3 years ago

I had a problem with screen sharing not working for me in Google Hangouts. I'm using Arch, Sway (version 1.6), Firefox Developer Edition (89.0b6), xdg-desktop-portal-wlr package (0.3.0-1).

wofi configuration

I found out that the root of the problem was wofi configuration. As soon as I set the following in ~/.config/xdg-desktop-portal-wlr/config things work fine:

[screencast]
chooser_cmd = wofi --show=dmenu --prompt="Select the output to share"
chooser_type = dmenu

Which is weird, because even though I used to have show=drun in my ~/.config/wofi/config I see in code in this repo you explicitly call wofi with -d -n flags, which should force wofi to run in dmenu mode ignoring the value from my personal configuration.

Should I debug that further?

Everything works fine for me now, but I thought I might report this as an issue, so that other people can benefit from the fix. Please tell me, if you're interested in fixing that, and if you are I can debug that futher.

Idea: Default prompt text

I think it might be nice to add some default prompt text to display when showing output selector. In wofi you pass that using --prompt argument. I'm pretty sure slurp and bemenu might have similar parameters. I pass mine as Select the output to share.

danshick commented 3 years ago

I think it might be nice to add some default prompt text to display when showing output selector. In wofi you pass that using --prompt argument. I'm pretty sure slurp and bemenu might have similar parameters. I pass mine as Select the output to share.

Related #121 and https://github.com/emersion/slurp/issues/83

danshick commented 3 years ago

@columbarius Do you know anything about wofi configs and argument/config precedence w.r.t. this issue? Can we reproduce this outside of xdpw, making this an upstream bug?

columbarius commented 3 years ago

@danshick I don't know about this issue and i can't really reproduce it even with xdpw.

@robertjk may you send me your wofi config (or the relevant part)? I don't use a config file and just adding an empty one with the line show=drun didn't break xdpw for me.

chooser_cmd="wofi -d -n"                                                                                       
chooser_type=dmenu
columbarius commented 3 years ago

think it might be nice to add some default prompt text to display when showing output selector. In wofi you pass that using --prompt argument. I'm pretty sure slurp and bemenu might have similar parameters. I pass mine as Select the output to share.

Good idea! Created #125. I sticked to the xdg-desktop-portal language using monitor and window instead of output.

robertjk commented 3 years ago

@robertjk may you send me your wofi config (or the relevant part)? I don't use a config file and just adding an empty one with the line show=drun didn't break xdpw for me.

chooser_cmd="wofi -d -n"                                                                                       
chooser_type=dmenu

Okay, so I did some more testing.

1. No wofi configuration, no xdg-desktop-portal configuration

First I tried without ~/.config/wofi/config nor ~/.config/xdg-desktop-portal-wlr/config files.

Screen sharing doesn't work. Wofi prompt to select an output is never shown.

$ 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: active (running) since Sat 2021-05-01 12:32:30 CEST; 22s ago
   Main PID: 42227 (xdg-desktop-por)
      Tasks: 2 (limit: 18728)
     Memory: 1.2M
        CPU: 8ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-wlr.service
             └─42227 /usr/lib/xdg-desktop-portal-wlr

maj 01 12:32:30 robert-laptop systemd[1765]: Starting Portal service (wlroots implementation)...
maj 01 12:32:30 robert-laptop systemd[1765]: Started Portal service (wlroots implementation).
maj 01 12:32:49 robert-laptop xdg-desktop-portal-wlr[42227]: 2021/05/01 12:32:49 [ERROR] - wlroots: no output found

2. With wofi configuration, no xdg-desktop-portal-wlr configuration

~/.config/xdg-desktop-portal-wlr/config doesn't exist and ~/.config/wofi/config has the following contents:

mode = drun
insensitive = true

Screensharing doesn't work: Wofi prompt to select an output is never shown.

$ 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: active (running) since Sat 2021-05-01 12:37:00 CEST; 16s ago
   Main PID: 42696 (xdg-desktop-por)
      Tasks: 2 (limit: 18728)
     Memory: 1.2M
        CPU: 7ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-wlr.service
             └─42696 /usr/lib/xdg-desktop-portal-wlr

maj 01 12:37:00 robert-laptop systemd[1765]: xdg-desktop-portal-wlr.service: Deactivated successfully.
maj 01 12:37:00 robert-laptop systemd[1765]: Stopped Portal service (wlroots implementation).
maj 01 12:37:00 robert-laptop systemd[1765]: Starting Portal service (wlroots implementation)...
maj 01 12:37:00 robert-laptop systemd[1765]: Started Portal service (wlroots implementation).
maj 01 12:37:12 robert-laptop xdg-desktop-portal-wlr[42696]: 2021/05/01 12:37:12 [ERROR] - wlroots: no output found

3. No wofi configuration, with xdg-desktop-portal-wlr configuration

~/.config/wofi/config doesn't exist and ~/.config/xdg-desktop-portal-wlr/config has the following contents:

[screencast]
chooser_cmd = wofi --show=dmenu --prompt="Select the output to share"
chooser_type = dmenu

Screen sharing does work. Wofi prompt to select an output is shown.

4. With wofi configuration, with xdg-desktop-portal-wlr configuration

Both ~/.config/wofi/config and ~/.config/xdg-desktop-portal-wlr/config exist and have contents as before.

Screen sharing does work. Wofi prompt to select an output is shown.

Implications

So it seems I was wrong to assume it was the fault of wofi's config file. It seems the only thing that does make a difference here is presence of ~/.config/xdg-desktop-portal-wlr/config with the following contents:

[screencast]
chooser_cmd = wofi --show=dmenu --prompt="Select the output to share"
chooser_type = dmenu

With this configuration present, a prompt to select an output is shown and screen sharing works fine. Without it, it's never shown and it doesn't work. Seems chooser_type = default somehow doesn't work on my system.

Should we pursuse this further, or is it somehow expected and it's not a bug?

columbarius commented 3 years ago

With this configuration present, a prompt to select an output is shown and screen sharing works fine. Without it, it's never shown and it doesn't work. Seems chooser_type = default somehow doesn't work on my system.

Should we pursuse this further, or is it somehow expected and it's not a bug?

That's a bug and was fixed in #114.

robertjk commented 3 years ago

Then I'm closing this. Sorry for the unnecessary alarm.

danshick commented 3 years ago

Then I'm closing this. Sorry for the unnecessary alarm.

No problem. Thanks @columbarius.