Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sway: Simplify screen sharing #123034

Merged
merged 1 commit into from May 15, 2021

Conversation

primeos
Copy link
Member

@primeos primeos commented May 14, 2021

This should make it easier to get started.
The xdg-desktop-portal backend for wlroots is required and one needs to
"make sure WAYLAND_DISPLAY and XDG_CURRENT_DESKTOP are imported into
D-Bus." 0

Motivation for this change

I've tested this with Chromium (chromium --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu-memory-buffer-video-frames) and it worked (with and without XWayland enabled).

Users need at least the following to make screen sharing work (that shouldn't be part of the Sway module):

xdg.portal.enable = true;
services.pipewire.enable = true;
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

This should make it easier to get started.
The xdg-desktop-portal backend for wlroots is required and one needs to
"make sure WAYLAND_DISPLAY and XDG_CURRENT_DESKTOP are imported into
D-Bus." [0]

[0]: https://github.com/emersion/xdg-desktop-portal-wlr/blob/efcbcb60aa3bc46b0e290d5f6627783fbb534dcd/README.md#running
@ahdyt
Copy link

ahdyt commented May 28, 2021

I wonder this or newest pull req of portal make my screen sharing broke again, especially on obs-wayland overlay and firefox via home-manager?

@primeos
Copy link
Member Author

primeos commented May 28, 2021

This shouldn't break screen sharing, please open a new issue with more information.

@siraben
Copy link
Member

siraben commented Jul 20, 2021

This breaks screen sharing if the user already has extraPortals = with pkgs; [ xdg-desktop-portal-wlr ]; set.

@primeos
Copy link
Member Author

primeos commented Jul 20, 2021

@siraben why does screen sharing break if xdg-desktop-portal-wlr is twice in extraPortals?

@siraben
Copy link
Member

siraben commented Jul 20, 2021

Home Manager also starts a service for xdg-desktop-portal, since this is now added by default, both home-manager and nixos-rebuild fail to build the config. @ahdyt did you experience this as well?

@primeos
Copy link
Member Author

primeos commented Jul 20, 2021

The NixOS module for Sway doesn't start a service for xdg-desktop-portal by default (this option only has an effect with xdg.portal.enable).

both home-manager and nixos-rebuild fail to build the config.

Not sure what's happening here. AFAIK HM should be completely isolated from the NixOS config.
This probably requires further analysis and should also be a dedicated GH issue if it's really something that requires a change in Nixpkgs instead of the HM repo (might make sense to discuss it there first?).

@siraben
Copy link
Member

siraben commented Jul 20, 2021

I happened to have xdg.portal.enable = true (but extraPortals was blank). I installed xdg-desktop-portal via Home Manager already so was able to observe the change when upgrading the system config.

@siraben
Copy link
Member

siraben commented Jul 20, 2021

As discussed on Matrix, this is the error that appears for HM

  UNIT                           LOAD      ACTIVE SUB    DESCRIPTION                            
● wlsunset.service               not-found failed failed wlsunset.service                       
● xdg-desktop-portal-wlr.service loaded    failed failed Portal service (wlroots implementation)

and for nixos-rebuild

ln: failed to create symbolic link '/nix/store/lj3zw0xfqh4h51vwjrfkv1kvhij3hipk-user-units/xdg-desktop-portal-wlr.service': File exists

Both issues are resolved when xdg.portal.enable = true is removed.

@siraben
Copy link
Member

siraben commented Jul 20, 2021

@siraben why does screen sharing break if xdg-desktop-portal-wlr is twice in extraPortals?

Not sure why but I can replicate it with

  xdg = {
    portal = {
      enable = true;
      extraPortals = with pkgs; [
        xdg-desktop-portal-wlr
        xdg-desktop-portal-gtk # optionally remove
      ];
      gtkUsePortal = true;
    };
  };

@primeos
Copy link
Member Author

primeos commented Jul 20, 2021

Both issues are resolved when xdg.portal.enable = true is removed.

Isn't that the actual issue then (enabling this in both the NixOS and Home Manager configurations)?

ln: failed to create symbolic link '/nix/store/lj3zw0xfqh4h51vwjrfkv1kvhij3hipk-user-units/xdg-desktop-portal-wlr.service': File exists

That also isn't ideal but I don't think this warrants changing the Sway module (not sure if there's a meta issue for this case is only an example/instance of the underlying problem).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants