Skip to content

wallpaper: play video wallpapers in the shell - #4037

Merged
purian23 merged 3 commits into
duxlabs-dev:masterfrom
KadirJeager:feat/video-wallpaper
Nov 1, 2026
Merged

purian23 merged 3 commits into
duxlabs-dev:masterfrom
KadirJeager:feat/video-wallpaper

Conversation

@KadirJeager

@KadirJeager KadirJeager commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Video files become ordinary wallpapers: the picker, the cycler, per-monitor and per-mode wallpapers and dms ipc call wallpaper set take them like images. The shell plays them itself, so there is no external player to install or keep in sync.

How it works

  • WallpaperBackground plays the video with QtMultimedia, the backend the lock screen video screensaver already uses. Playback pauses while the output cannot show it: shell locked, monitors off, a fullscreen window on that output, or the niri overview blur. While paused, the window stops rendering as it does for a still image.
  • VideoWallpaperService extracts one representative frame per video with ffmpeg and caches it under ~/.cache/dms/video-wallpaper. The frame stands in wherever a still image is needed, so the existing image pipeline stays unchanged: matugen, the picker thumbnails, the lock screen, the blurred surfaces and the still-image transition into the video.
  • The image and video extensions live in one place, Common/WallpaperFormats.js, instead of six copies of the same list.
  • Cycling has a new toggle, Advance when a video ends: the video plays once and the next wallpaper follows, instead of looping until the interval fires.

ffmpeg is optional. Without it, videos still play, but they have no thumbnail and the theme falls back to the seed color.

Difference from #3627

#3627 starts mpvpaper for every output. Here a video is just another wallpaper path, so per-monitor wallpapers work, the shell's transitions, blur and lock screen keep working, and no new player dependency is needed.

Hardware decoding on NVIDIA

shell.qml sets QT_FFMPEG_DECODING_HW_DEVICE_TYPES=vaapi. On NVIDIA, VA-API goes through nvidia-vaapi-driver, and Qt does not get a zero-copy texture from it: every frame is copied back with av_hwframe_transfer_data. On an RTX 5070 (driver 615.78, libva-nvidia-driver 0.0.18, Qt 6.12), that copy eventually blocks in vaSyncSurface on the render thread, and the GUI thread hangs waiting for the frame. The whole shell freezes and needs a restart. It happened after 9 to 40 minutes of playback, on the live desktop and in two nested sessions, with or without QT_DISABLE_HW_TEXTURES_CONVERSION. With software decoding (QT_FFMPEG_DECODING_HW_DEVICE_TYPES=, in shell.qml), 25 minutes and 42 switches played without a hang, at about a third of one core for a 1440p H.264 video.

QT_FFMPEG_DECODING_HW_DEVICE_TYPES=cuda skips nvidia-vaapi-driver and decodes on NVDEC through CUDA. Qt has no zero-copy path for it either, so frames are still copied back. In a nested session on this branch it ran 50 minutes, with 200 of 200 IPC checks answered and 75 video switches, at about 9% of one core, with memory flat between 360 and 830 MB. Under the same load, VA-API froze within 15 to 40 minutes.

The lock screen video screensaver uses the same path, so this is not new to this PR, but a wallpaper plays for hours instead of minutes. I left the pragma alone. Changing the decoder default for everyone is a separate decision, and I can only test NVIDIA. A list such as cuda,vaapi would probably let NVIDIA pick CUDA and fall back to VA-API elsewhere, but I have not checked how Qt orders and falls back through the list.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / internal cleanup
  • Documentation
  • Other

Related issues

Closes #1323

Screenshots / video

A 35-second recording from a nested headless Hyprland session running this branch is attached below. It shows a video wallpaper playing, the dash grid with frame thumbnails, and two switches where the theme follows the new video.

Checklist

  • My code follows the conventions in CONTRIBUTING.md
  • I have tested my changes locally
  • New user-facing strings are wrapped in I18n.tr() with translator context, reusing existing terms where possible
  • Go changes: ran make fmt, added/updated tests, make test passes, and go mod tidy is clean (no Go changes)
  • QML changes: ran make lint-qml with no new warnings
  • I have opened a corresponding pull request in dux-docs to document any new behaviors: https://github.com/duxlabs-dev/dux-docs

Testing

  • Hyprland 0.56.2, Qt 6.12, NVIDIA RTX 5070, one 2560x1440 monitor. Run on the live desktop (v2.0.0 with this change backported) and in nested headless Hyprland sessions on this branch.
  • Picked videos from the dash grid and set them over IPC. The theme was generated from each frame. Cycled through a folder of 15 videos with Advance when a video ends.
  • 45 back-to-back switches: memory stayed flat (742 → 754 → 749 MB).
  • make lint-qml passes. node --test and make test-qml pass, apart from bluez-codec.test.mjs, which fails on master too when the checkout path contains a space.
  • New test: tests/wallpaper-formats.test.mjs checks the extension matching and runs the generated find predicate against real files.

Not tested: per-monitor wallpapers on more than one physical output (I have one monitor), niri, and the lock and fullscreen pause paths beyond reading the code. I will open the dux-docs PR once the behaviour here is settled.

Written with AI assistance (Claude Code) at my direction.

🤖 Generated with Claude Code

Video files can be picked, cycled and set over IPC like images.
WallpaperBackground plays them with QtMultimedia and pauses while
they cannot be seen. A cached ffmpeg frame stands in for the video
wherever a still image is needed: matugen, thumbnails, lock screen
and blurred surfaces. Cycling can advance when a video ends.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 19:39
@github-actions github-actions Bot added feature internal ui Quickshell UI under quickshell/ labels Oct 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@KadirJeager

Copy link
Copy Markdown
Contributor Author

Demo, recorded in a nested headless Hyprland session running this branch (35 s): a video wallpaper playing, the dash wallpaper grid with frame thumbnails, and two switches where the theme follows the new video.

video-wallpaper-demo-pr.mp4

@bbedward

Copy link
Copy Markdown
Member

/claude review

Comment thread quickshell/Common/Theme.qml Outdated
const iconTheme = (typeof SettingsData !== "undefined" && SettingsData.iconTheme) ? SettingsData.iconTheme : "System Default";

if (currentTheme === dynamic) {
_themeAwaitsFrame = !wallpaperImagePath && VideoWallpaperService.framePending(rawWallpaperPath);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_themeAwaitsFrame only clears through onWallpaperImagePathChanged. When extraction fails, or the first request finds ffmpeg missing, wallpaperImagePath stays "" and nothing fires. framePending turns false, but _failed is changed in place and Theme doesn't watch ffmpegMissing. The result: the theme keeps the previous wallpaper's colors and never falls back to the seed color. A session that starts on a video without ffmpeg installed always hits this, which contradicts the PR description. WallpaperBackground.onResolvedSourceChanged has the same gap and keeps the old still image.

Fix: reassign instead of mutating (_failed = Object.assign({}, _failed, {[video]: true})). Then bind readonly property bool wallpaperFramePending: VideoWallpaperService.framePending(rawWallpaperPath) and regenerate when it turns false while _themeAwaitsFrame is set. That handler also covers the frame arriving, so it can replace onWallpaperImagePathChanged.

@claude

claude Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Claude review

One fix needed: the theme can stay stuck on the previous wallpaper's colors; everything else checked out.

  • The theme never regenerates when a video's frame can't be extracted or ffmpeg is missing, because _themeAwaitsFrame is never cleared. quickshell/Common/Theme.qml:1987
    Checked: the QML diff, including video playback and pausing in WallpaperBackground, frame extraction and shell quoting in VideoWallpaperService, advancing on video end and how core handles wallpaper.trigger, per-monitor settings, imports and singleton dependencies, the new still-frame callers, i18n, and deprecated shims. Model: claude-opus-5-5.

A failed frame extraction mutated _failed in place, so framePending()
bindings never saw it, and nothing changed when ffmpeg went missing
either: the theme kept the previous wallpaper's colors and the
background kept the previous still. Theme and WallpaperBackground now
bind framePending and move on once it drops, so a video without a
frame falls back to the seed color and drops the old still.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@KadirJeager

Copy link
Copy Markdown
Contributor Author

Fixed in c532595. _failed is now reassigned instead of mutated, and Theme and WallpaperBackground bind framePending and move on once it drops. So a video whose frame never arrives (failed extraction, no ffmpeg) re-themes from the seed color and drops the previous still.

Checked in a nested headless Hyprland session. A broken file makes ffmpeg fail before the 100 ms theme debounce, which hides the bug, so I used an ffmpeg that fails after 3 s:

  • before: the theme kept the previous wallpaper's colors and the old still stayed up
  • after: the theme regenerates from the seed and the background drops the old still
  • a valid video still themes from its frame on both

@bbedward

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Claude review

No issues found. The earlier finding is fixed in c532595: _failed is now reassigned, and Theme and WallpaperBackground bind framePending, so a frame that never arrives now falls back to the seed color and drops the old still image.
Checked: the full QML diff again. That covers the theme waiting for the frame and resuming, source handoff and video layer load and fade in WallpaperBackground, play and pause conditions (lock, monitors off, fullscreen, overview blur), advancing when a video ends for shared and per-monitor wallpapers, ffmpeg frame extraction (argument quoting, queue, timeout path through Proc), the callers switched to the still frame, per-monitor cycling settings, imports, i18n and deprecated shims. Model: claude-opus-5-5.

@@ -1,5 +1,6 @@
import QtQuick
import QtQuick.Effects
import QtMultimedia

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to keep QtMultimedia as an optional dependency. This creates a hard fail when it isnt installed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d523899. The video layer moved to Modules/VideoWallpaperLayer.qml and WallpaperBackground loads it by url, the same way DAnimatedAlbumArt and VideoScreensaverPlayer do, so WallpaperBackground.qml no longer imports QtMultimedia. Without it only that loader fails, logs QtMultimedia not available, video wallpapers show their still frame, and the extracted frame stays as the wallpaper and theme source.

Checked in a nested headless Hyprland session with a video wallpaper, hiding QtMultimedia by mounting an empty directory over /usr/lib/qt6/qml/QtMultimedia:

  • before: the shell exits at startup with WallpaperBackground.qml[3:1]: module "QtMultimedia" is not installed
  • after: the shell starts, the bar, dock and widgets are up, the still frame is shown and the theme is generated from it
  • with QtMultimedia installed the video still plays (consecutive screenshots differ across the whole screen)

WallpaperBackground imported QtMultimedia directly, so without it the
whole file failed to load and the shell did not start. The video layer
now lives in VideoWallpaperLayer.qml and is loaded by url, like
DAnimatedAlbumArt and VideoScreensaverPlayer: without QtMultimedia only
that loader fails, and the video's still frame stays as the wallpaper
and theme source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@purian23
purian23 merged commit c63dd71 into duxlabs-dev:master Nov 1, 2026
3 checks passed
dux-ci Bot pushed a commit that referenced this pull request Nov 1, 2026
@matsuzaka-yuki

Copy link
Copy Markdown

good!

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

Labels

feature internal ui Quickshell UI under quickshell/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add better support and functionality for Live Wallpapers

5 participants