I’ve been able to use screen sharing on wayland before and recently it just hasn’t been working when trying on Discord (via vesktop) and even Teams via a browser (librewolf). I had both of these working before.
Here’s my configuration for screensharing:
{pkgs, ...}: {
xdg = {
portal = {
enable = true;
wlr.enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
];
};
};
security.rtkit.enable = true;
services.pipewire = {
enable = true;
pulse.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
# jack.enable = true;
# media-session.enable = true;
};
}
I can’t seem to even find the xdg-desktop-portal-wlr.service or any portal-related services.
Anyone know what is going on?
1 Like
Okay, so I can find the xdg-desktop-portal-*.services, they are just run as user services and I wasn’t passing --user to systemctl, oops.
Not showing much useful information though. I reckon I’m missing a picker for the display maybe?
Okay, I think I’ve mostly resolved this on my own with the following:
{pkgs, ...}: {
xdg = {
portal = {
enable = true;
wlr = {
enable = true;
settings = {
screencast = {
chooser_type = "simple";
chooser_cmd = "${pkgs.slurp}/bin/slurp -f 'Monitor: %o' -or";
};
};
};
extraPortals = [
pkgs.xdg-desktop-portal-gtk
];
};
};
security.rtkit.enable = true;
services.pipewire = {
enable = true;
pulse.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
# jack.enable = true;
# media-session.enable = true;
};
}
But I think vesktop is still not having it. OBS is working though.
Those settings might not work for every Wayland compositor. Have you seen what programs.niri does?
# treatment as the display-manager modules.
systemd.user.services.niri = {
restartIfChanged = false;
# Defining the unit here generates a drop-in; without this it
# would carry the NixOS default Environment="PATH=coreutils:…",
# clobbering the PATH that niri-session imported into the user
# manager and breaking spawn actions that rely on it.
enableDefaultPath = false;
};
xdg.portal = {
enable = lib.mkDefault true;
# NOTE: `configPackages` is ignored when `xdg.portal.config.niri` is defined.
config.niri = {
default = [
"gnome"
"gtk"
];
"org.freedesktop.impl.portal.Access" = "gtk";
"org.freedesktop.impl.portal.FileChooser" = lib.mkIf (!cfg.useNautilus) "gtk";
1 Like
Having a similar issue, one thing was missing window/monitor picker, I’m using this to choose even single window/app:
chooser_type = “dmenu”;
chooser_cmd = “${pkgs.bemenu}/bin/bemenu --center -p "Share window:" -i -B 3”;
Right now I’m trying to figure it out why screensharing in Teams in Firefox does not work for me. Well, it does but It hangs on first image . It started happen to me maybe month ago. I did not have a chance to figure out what happen.
According to nixpkgs/nixos/modules/programs/wayland/sway.nix at a0374025a863d007d98e3297f6aa46cc3141c2f0 · NixOS/nixpkgs · GitHub do’ not you need xdg-desktop-portal-wlr as well?
Right now I’m trying to figure it out why screensharing in Teams in Firefox does not work for me. Well, it does but It hangs on first image . It started happen to me maybe month ago. I did not have a chance to figure out what happen.
I’ve just finish bisecting of nixpkgs and it was caused by wlr portal - ac2639c1f827b2ff76b471dfbfcc715842989793 .
Downgrading version back to original version resolved issue for me, you can try the same.
nixpkgs.overlays = [
(final: prev: {
xdg-desktop-portal-wlr = prev.xdg-desktop-portal-wlr.overrideAttrs (oldAttrs: {
version = "0.8.2";
src = oldAttrs.src.override {
rev = "v0.8.2";
sha256 = "sha256-HITf/hgiASWvn/z49mzS8IS1vuyXwdk1JiAOOHRSQMo=";
};
});
})
];
edit: version v0.8.4 works as well.
Additional upstream issue/PR context:
opened 09:39PM - 07 Jul 26 UTC
closed 04:41PM - 28 Jul 26 UTC
Since updating from 0.7.1 to 0.8.3, screen sharing from Chromium-based clients (… Vesktop/Electron, app_id: org.chromium.Chromium) shows only a single static frame. OBS via the same portal works fine.
Setup: mango (wlroots-based, advertises both zwlr_screencopy v3 and ext_image_copy_capture v1), AMD GPU, Mesa 26.x, PipeWire
Compiled with libpipewire 1.6.5
Linked with libpipewire 1.6.5, NixOS unstable.
Debug log shows negotiation completing normally (explicit modifier, DMABUF, 2 buffers), then immediately on entering "streaming":
pipewire: stream state changed to "streaming"
pipewire: out of buffers
pipewire: unable to export buffer
after which no frames are ever delivered — looks like the consumer holds both buffers of the 2-buffer pool, pw_stream_dequeue_buffer() returns NULL on the first process event, and nothing re-arms the capture loop.
Observations:
force_mod_linear=1 has no effect — with explicit-modifier negotiation the option is never consulted (only the DRM_FORMAT_MOD_INVALID fallback path reads it).
Patching XDPW_PWR_BUFFERS and XDPW_PWR_BUFFERS_MIN from 2 to 4 fully resolves it.
0.7.1 (zwlr_screencopy path) works unmodified on the same system.
Full debug log attached. Debug log Contain attempted force_mod_linear=1 fix.
[xdpw-0.8.3-debug.log](https://github.com/user-attachments/files/29768142/xdpw-0.8.3-debug.log)
opened 03:22PM - 19 Jun 26 UTC
closed 04:41PM - 28 Jul 26 UTC
env:
sway version 1.12
OBS Studio - 32.1.2
# the obs record eDP-1 monitor:
The … screen froze after ten seconds.
https://github.com/user-attachments/assets/d64cde59-7f17-46a2-9775-c0285708a3e1
# gpu-screen-record after obs frrezes:
https://github.com/user-attachments/assets/a7c1d2df-113c-4935-aa5e-c7914bfb5cf4
It can be seen that the obs card died in the final recorded scene.
This issue emerged only after 0.8.3.
# Reproduction steps
```conf
bindsym $mod+Return exec foot
```
keep hold press mod+return two sconds, let it open ten window at same time.
obs will frrezes.
master ← smlx:screencast-retry-timer
opened 02:38AM - 23 Jul 26 UTC
Currently, when the stream runs out of buffers, PipeWire's graph
iteration fail… s and freezes the stream.
This commit introduces a repeating timer to call
pw_stream_trigger_process at the negotiated frame rate when starved of
buffers to ensure recovery once a buffer becomes available.
Fixes: #390
Fixes: #395
I did, yes. I have screensharing working in Firefox on Jitsi, but for whatever reason Vesktop still doesn’t work and even Discord in the browser doesn’t work. Haven’t tried in a while though so things may have been resolved.
As an update to this thread. It seems like things are still broken.
I’ve found that the best way for me to share my screen with someone is to use Jitsi meet…