Repository navigation
wallpaper: play video wallpapers in the shell - #4037
Conversation
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]>
There was a problem hiding this comment.
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.
|
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 |
|
/claude review |
| const iconTheme = (typeof SettingsData !== "undefined" && SettingsData.iconTheme) ? SettingsData.iconTheme : "System Default"; | ||
|
|
||
| if (currentTheme === dynamic) { | ||
| _themeAwaitsFrame = !wallpaperImagePath && VideoWallpaperService.framePending(rawWallpaperPath); |
There was a problem hiding this comment.
_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 reviewOne fix needed: the theme can stay stuck on the previous wallpaper's colors; everything else checked out.
|
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]>
|
Fixed in c532595. 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:
|
|
/claude review |
Claude reviewNo issues found. The earlier finding is fixed in c532595: |
| @@ -1,5 +1,6 @@ | |||
| import QtQuick | |||
| import QtQuick.Effects | |||
| import QtMultimedia | |||
There was a problem hiding this comment.
We need to keep QtMultimedia as an optional dependency. This creates a hard fail when it isnt installed
There was a problem hiding this comment.
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]>
Port 2.0 (cherry picked from commit c63dd71)
|
good! |
Description
Video files become ordinary wallpapers: the picker, the cycler, per-monitor and per-mode wallpapers and
dms ipc call wallpaper settake them like images. The shell plays them itself, so there is no external player to install or keep in sync.How it works
WallpaperBackgroundplays 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.VideoWallpaperServiceextracts one representative frame per video withffmpegand 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.Common/WallpaperFormats.js, instead of six copies of the same list.ffmpegis 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
mpvpaperfor 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.qmlsetsQT_FFMPEG_DECODING_HW_DEVICE_TYPES=vaapi. On NVIDIA, VA-API goes throughnvidia-vaapi-driver, and Qt does not get a zero-copy texture from it: every frame is copied back withav_hwframe_transfer_data. On an RTX 5070 (driver 615.78, libva-nvidia-driver 0.0.18, Qt 6.12), that copy eventually blocks invaSyncSurfaceon 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 withoutQT_DISABLE_HW_TEXTURES_CONVERSION. With software decoding (QT_FFMPEG_DECODING_HW_DEVICE_TYPES=,inshell.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=cudaskipsnvidia-vaapi-driverand 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,vaapiwould 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
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
I18n.tr()with translator context, reusing existing terms where possiblemake fmt, added/updated tests,make testpasses, andgo mod tidyis clean (no Go changes)make lint-qmlwith no new warningsTesting
make lint-qmlpasses.node --testandmake test-qmlpass, apart frombluez-codec.test.mjs, which fails onmastertoo when the checkout path contains a space.tests/wallpaper-formats.test.mjschecks the extension matching and runs the generatedfindpredicate 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