Repository navigation
Description
With ENABLE_RUST_LIBOBS=ON (the build the OBS-Studio-Rust .deb and AppImage ship), OBS on Linux no longer asks the desktop to stop idle sleep or locking while it records or streams. It only runs xdg-screensaver reset every 30 s, which does nothing on Hyprland and other wlroots compositors and may do nothing on GNOME. A long unattended recording or stream can be cut off by suspend, or a portal screencast blanked by the lock screen. Found in a review of the merges since #275; not reported by a user yet.
This is a regression from #403 (the platform-nix.c port, by Nathan V). OBS-Studio-Rust v0.1.0-beta.20261012 is the first release that contains it (Linux .deb and AppImage). The C build (ENABLE_RUST_LIBOBS=OFF) and the Flatpak, which does not turn the option on, are not affected. macOS and Windows keep their own C implementations and are not affected either.
Location
libobs/cmake/os-linux.cmakeline 16, andos-freebsd.cmakeline 30:util/platform-nix.cis left out when the option is ON.os_inhibit_sleep_create,os_inhibit_sleep_set_activeandos_inhibit_sleep_destroythen come from the Rust shims inrust/obs-util/src/ffi/platform_nix.rs(exported vialibobs/cmake/rust-exports.d/obs-util-platform_nix.txtlines 35-37).nix::Inhibitinrust/obs-util/src/platform/unix/nix.rs(lines 1118-1244) ignores the reason and only starts a thread that runsxdg-screensaver resetevery 30 s.- The C version (
platform-nix.c,os_inhibit_sleep_create) first asksorg.freedesktop.portal.Inhibit(platform-nix-portal.c, flags suspend and idle), then, outside a Flatpak, a session D-Bus inhibitor (org.freedesktop.ScreenSaver,org.freedesktop.PowerManagement.Inhibit, the MATE or GNOME session manager;platform-nix-dbus.c), and usesxdg-screensaveronly when neither exists. Both files are still compiled with the option ON, but their only callers are in the excludedplatform-nix.c, so they are dead code. rust/README.md, the rust: Port libobs/util/platform-nix.c to obs-util #403 description and the comment innix.rssay the portal and D-Bus files "stay C", which reads as if they were still used. The parity test skips this area ("Sleep inhibit is not compared").
Class
Silent loss of a recording or stream: suspend ends it, and nothing in OBS says the inhibitor is missing (no inhibitor shows up in the desktop's list for OBS).
How it is reached
- Install the OBS-Studio-Rust .deb or AppImage (beta.20261012 or later) on a Wayland desktop with an idle suspend or lock timeout (Hyprland with hypridle, a wlroots compositor, GNOME).
- Start a recording or stream and leave the machine alone longer than the timeout.
The machine suspends or locks. With the C build, OBS holds a portal (or ScreenSaver) inhibitor from the first output start to the last output stop, and the desktop stays awake.
Reproduced headlessly with a fake org.freedesktop.portal.Inhibit and a fake org.freedesktop.ScreenSaver on a private D-Bus bus: with the option ON, os_inhibit_sleep_set_active(true) makes no D-Bus call at all; with it OFF, it calls Inhibit with the reason and releases it on set_active(false).
Proposed fix and failing test
Fix: keep os_inhibit_sleep_* in C for Linux and FreeBSD in both lanes. Move it, unchanged, from platform-nix.c into a new util/platform-nix-inhibit.c that both lanes compile, and drop the three Rust shims, nix::Inhibit and their export entries, so there is one definition and the exported symbol set stays the same. The rest of the Rust port is unchanged. Update rust/README.md, the code comments and the parity test header.
RED test test_inhibit_sleep_dbus (no display; GTestDBus starts a private dbus-daemon, skipped without one):
test_portal_inhibit_and_release: a fake portal ownsorg.freedesktop.portal.Desktop.set_active(true)must callInhibitwith the reason and flags 0xC;set_active(false)must close the returned request.test_screensaver_inhibit_and_release: no portal, a fakeorg.freedesktop.ScreenSaver.set_active(true)must callInhibit("libobs", reason);set_active(false)must callUnInhibitwith the same cookie.
Both fail with the option ON and pass with it OFF.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 13, 2026
Claiming: this issue.
test_inhibit_sleep_dbus(no display): fake org.freedesktop.portal.Inhibit and org.freedesktop.ScreenSaver on a private session bus; os_inhibit_sleep_set_active(true) must call Inhibit with the reason and set_active(false) must release it. 0 of 2 pass in the Rust lane today, 2 of 2 in the C lane.PR today.
test: Check os_inhibit_sleep uses the portal and ScreenSaver D-Bus
libobs: Keep Linux sleep inhibition in C with Rust libobs
test: Check os_inhibit_sleep uses the portal and ScreenSaver D-Bus
libobs: Keep Linux sleep inhibition in C with Rust libobs
libobs: Keep Linux sleep inhibition in C with Rust libobs (#454)
obs-util: Port Linux sleep inhibition to Rust (obs-rust#1504)
refactor(ci): port check-skips to Python (obs-rust#962) (obs-rust#2598)