Skip to content

feat: native animated video backgrounds via libmpv - #1032

Open
dhia-gharsallaoui wants to merge 2 commits into
hyprwm:mainfrom
dhia-gharsallaoui:feat/video-background
Open

dhia-gharsallaoui wants to merge 2 commits into
hyprwm:mainfrom
dhia-gharsallaoui:feat/video-background

Conversation

@dhia-gharsallaoui

Copy link
Copy Markdown

Add optional libmpv-backed video decoding to the background widget. When path points at a video file (mp4, mkv, webm, mov, gif, ...) it is decoded with hardware acceleration and played, looping, as the lock background, reusing the existing cover-fit, blur, crossfade and color-fallback paths.

  • New CMpvVideo (src/renderer/MpvVideo.{hpp,cpp}) wraps libmpv's render API, decoding into an offscreen FBO that is composited like any other texture.
  • The background widget detects video paths and renders a frame each draw(), keeping the per-output frame-callback loop alive while the video plays.
  • New background options: video_loop, video_mute, video_hwdec, video_fps_cap, video_pause_on_battery.
  • libmpv is an optional dependency (HYPRLOCK_WITH_MPV). Without it the build is unchanged and video paths fall back to the background color.
  • Errors (missing file, no video track, decode failure) fall back to the background color with a clear log; a watchdog stops a frameless file from spinning the render loop. Teardown frees the mpv render context with the EGL context current, before EGL shutdown.

dhia-gharsallaoui and others added 2 commits June 2, 2026 01:41
Add optional libmpv-backed video decoding to the background widget. When
`path` points at a video file (mp4, mkv, webm, mov, gif, ...) it is decoded
with hardware acceleration and played, looping, as the lock background,
reusing the existing cover-fit, blur, crossfade and color-fallback paths.

- New CMpvVideo (src/renderer/MpvVideo.{hpp,cpp}) wraps libmpv's render API,
  decoding into an offscreen FBO that is composited like any other texture.
- The background widget detects video paths and renders a frame each draw(),
  keeping the per-output frame-callback loop alive while the video plays.
- New background options: video_loop, video_mute, video_hwdec,
  video_fps_cap, video_pause_on_battery.
- libmpv is an optional dependency (HYPRLOCK_WITH_MPV). Without it the build
  is unchanged and video paths fall back to the background color.
- Errors (missing file, no video track, decode failure) fall back to the
  background color with a clear log; a watchdog stops a frameless file from
  spinning the render loop. Teardown frees the mpv render context with the
  EGL context current, before EGL shutdown.

ext-session-lock-v1 isolates the lock surface from all other layers, so
external players (mpvpaper overlay, etc.) can no longer show through on
current Hyprland; rendering the video as part of the lock surface itself is
the only approach that works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant