Skip to content

[ADD] animated video player func for the wallpaper script - #35

Open
lebgdu543 wants to merge 2 commits into
elifouts:mainfrom
lebgdu543:patch-1
Open

[ADD] animated video player func for the wallpaper script#35
lebgdu543 wants to merge 2 commits into
elifouts:mainfrom
lebgdu543:patch-1

Conversation

@lebgdu543

@lebgdu543 lebgdu543 commented Apr 23, 2026

Copy link
Copy Markdown

Add Video Wallpaper Support

Summary

Extended the wallpaper script to support video files (.mp4, .mkv) in addition to static images (.jpg, .jpeg, .png, .gif).

Changes Made

  1. Extended file format support - Updated the find command to include .mp4 and .mkv files alongside existing image formats

  2. Generated video thumbnails - Created a generate_video_thumbnail() function that:

    • Uses ffmpeg to extract the first frame from each video at 1 second
    • Scales thumbnails to 200x112px for consistent display
    • Caches thumbnails in ~/.cache/wallpaper_thumbnails/ to avoid regenerating them
  3. Updated menu display - Modified menu() to:

    • Show video thumbnails in wofi (so users can see what video they're selecting)
    • Maintain the img: prefix that wofi uses for image previews
  4. Video playback - Added video file detection in main() that:

    • Detects if the selected file is a video using regex matching
    • Uses mpvpaper to play videos as animated wallpapers on Wayland
    • Extracts the first frame for color generation with wal, so color schemes still update properly
  5. Maintained existing functionality - Static images continue to use awww img as before, with no impact to the original workflow

Dependencies

  • ffmpeg - for thumbnail generation
  • mpvpaper - for playing videos as wallpapers
sudo pacman -S ffmpeg
yay -S mpvpaper-git

Testing

Videos now appear in the wallpaper selector with thumbnails and play as animated backgrounds while maintaining automatic color scheme generation.

Feel free to adjust the tone or detail level!

build with claude-haiku-4.5:duck.ai -> https://nc.eren.ynh.fr/s/kMFA2q2SGob87tY

Refactor wallpaper script for improved functionality

Need to install `mpvpaper`
yay -S mpvpaper-git
Removed redundant pkill command for mpvpaper before playing video.
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