Guide to getting niri working properly as a session manager with screen recording support.
sudo apt install pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-gnome xdg-desktop-portal-gtkAdd yourself to video and render groups for GPU access:
sudo usermod -aG video,render $USERLog out and back in (or reboot) for group changes to take effect.
If you built niri from source, the systemd units may not be installed. Create them manually:
[Unit]
Description=Niri Wayland Compositor
BindsTo=graphical-session.target
Before=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target
[Service]
Type=notify
ExecStart=/usr/local/bin/niri --session
Slice=session.slice
Restart=no[Unit]
Description=Niri Session Shutdown
DefaultDependencies=no
StopWhenUnneeded=yes
Conflicts=graphical-session.target graphical-session-pre.target
After=graphical-session.target graphical-session-pre.targetAfter creating these files:
systemctl --user daemon-reloadEnsure /usr/share/wayland-sessions/niri.desktop exists:
[Desktop Entry]
Name=Niri
Comment=A scrollable-tiling Wayland compositor
Exec=niri-session
Type=Application
DesktopNames=niriCreate ~/.config/xdg-desktop-portal/niri-portals.conf:
[preferred]
default=gtk
org.freedesktop.impl.portal.ScreenCast=gnome
org.freedesktop.impl.portal.Screenshot=gnomeImportant: Do NOT run niri directly. Use one of these methods:
- Via GDM (recommended): Log out, select "Niri" from the session menu (gear icon) at the login screen
- Via TTY: Run
niri-session(not justniri)
Running bare niri skips session setup and breaks portal functionality.
If using NVIDIA GPU, add to ~/.config/niri/config.kdl:
debug {
render-drm-device "/dev/dri/renderD128"
}Adjust the device path based on your system (ls /dev/dri/render*).
Screen recording with OBS + PipeWire + NVIDIA on Wayland has known issues:
- "buffer is corrupt" errors
- Black screen captures
- Format negotiation failures
The xdg-desktop-portal-gnome + niri + NVIDIA combination has compatibility issues. The portal may show windows but capture corrupt/blank frames.
- wlrobs plugin - Uses wlr-screencopy protocol directly (build from source)
- GPU-specific workarounds - Ensure niri and OBS use the same GPU
- Wait for fixes - OBS and portal implementations are actively being improved
Chrome/Brave PWAs ignore GTK font settings. Add --force-device-scale-factor=1.5 to desktop files.
Edit files in ~/.local/share/applications/chrome-*.desktop:
Exec=/opt/google/chrome/google-chrome --force-device-scale-factor=1.5 ...
Brave on Ubuntu doesn't read brave-flags.conf. Create a wrapper script:
~/.local/bin/brave:
#!/bin/bash
FLAGS=""
if [[ -f ~/.config/brave-flags.conf ]]; then
while read -r line; do
[[ "$line" =~ ^#.*$ || -z "$line" ]] && continue
FLAGS="$FLAGS $line"
done < ~/.config/brave-flags.conf
fi
exec /opt/brave.com/brave/brave $FLAGS "$@"chmod +x ~/.local/bin/braveThen update Brave desktop files to use /home/$USER/.local/bin/brave instead of /opt/brave.com/brave/brave-browser.
~/.config/brave-flags.conf:
--force-device-scale-factor=1.5
systemctl --user status niri.servicesystemctl --user status xdg-desktop-portal xdg-desktop-portal-gnome
busctl --user introspect org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop | grep ScreenCastjournalctl --user -u niri.service -bniri msg castssystemctl --user restart xdg-desktop-portal