Skip to content

Wolfyxon/xfce-live-wallpaper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ Deprecated

This repo is no longer maintained. However I'll continue to review and merge pull requests.

I'm planning to make a universal script for all DEs at some point.

Live wallpaper for Linux XFCE

A simple script that allows you to play a GIF, video or image sequence on your desktop wallpaper! IMPORTANT NOTE: I'm not sure this will work on every machine. I wrote that script especially for myself. If you discover a bug or know how to improve it, create an issue

Make sure you have these programs installed:

  • python
  • ffmpeg
  • imagemagick

Note

I highly recommend to use performance CPU governor or the desktop may lag. You can change the governor by using:

sudo cpupower frequency-set -g performance

You can permanently change the governor by editing file /etc/default/cpupower. Replace #governor='powersave' with:

governor='performance'

Make sure to remove the #!

Demonstation

Preview quality may not be accurate with actual wallpaper quality.

See also https://youtu.be/RJ0nsBiiqEY

Usage

IMPORTANT NOTE: Paths must be global, example: /home/username/Pictures/file not ./file
python main.py <type> <path> <frame update wait time (optional, default 0.05)>

  • GIF (Best quality)
python main.py -gif /home/username/Pictures/mygif.gif
  • Video (Worst quality)
python main.py -video /home/username/Videos/myvideo.mp4
  • Image sequence (slideshow)
python main.py -sequence /home/username/Pictures/wallpapers/
  • Last cached animation
python main.py -cache

How does it work?

First it takes the GIF/video and then converts it to frames.

  • Video
os.system("ffmpeg -i "+path+" -vf fps=30 -vf scale=1280:720 cache/frame-%d.png")
  • GIF
os.system("convert "+path+" -coalesce cache/frame.png")
  1. The frames are being saved in folder cahce that is located in the same directory as the script. (If you use -sequence or -cache nothing is being converted)
  2. Next, it runs the 2nd script that is used for changing the wallpaper, with path and wait time arguments.
def runFromCache():
    os.system("python " + os.path.abspath("./wallpaper.py") + " " + os.path.abspath("./cache") + " " + str(wait_time))
  1. Then the wallpaper.py keeps changing wallpaper to each frame.
while True:
    time.sleep(wait_time)
    for i in range(len(sequence_files)):
        setWallpaper(path+"/"+"frame-"+str(i)+".png")
        time.sleep(wait_time)

(See also setWallpaper(path) inside code.)

Alternatives

XFCE's wallpaper updating is very slow and leads to major lag when not waiting. Best way to make animated wallpaper is by not using any DE that renders something on desktop (like Qtile, i3). Wallpaper on these can be updated with feh which is way faster. Someone already made a script for that https://github.com/thomas10-10/foo-Wallpaper-Feh-Gif