Saturday 4 July 2015

Elementary OS FREYA and video desktop wallpaper


Ok, I'll admit it, I like messing with stuff.  So when someone assured me video wallpaper would not work with Elementary because it uses its own window manager, I had to find out.   And it does work.  The picture above and those following are screen shots from a 4k (very high definition) mp4 running ;in an oval porthole through' (the easiest way to describe how it looks) one of my normal wallpapers.

Running a full movie at 4k definition is probably not the best thing to do as you will chew up between 20 and 30% of a low end AMD cpu processing.  But it works well and the performance hit is just a little lag occasionally when loading a new firefox page or some other cpu intensive task.  Anyway it is quaint.



I also made a .desktop script so I could drag it to docky and run the script that creates the video wallpaper.  One neat trich here is that clicking the icon in Docky once starts the wallpaper, and clicking it in Docky again stops it.  Which turns out to be rather handy.

The tools you will need are.

(1)    Shantz xwinwrap
available here:   http://tech.shantanugoel.com/resources/downloads/shantz-xwinwrap.zip

You can read about xwinwrap here:   http://tech.shantanugoel.com/2008/09/03/shantz-xwinwrap.html

(2)    Mplayer
Download and install mplayer from your normal repository

(3)    A video you like.   RENAME the video file with NO SPACES.
So if it is called my fave video.mp4,  rename it to my-fave-video.mp4   (you get the drift.  unix scripts don;t like spaces)
 I created a folder for my video wallpapers and the script should (repeat - SHOULD) just cycle through any videos in that folder.   It does on mine.  If it doesn;t check that there are indeed no spaces in the file names.

UPDATE - I managed to kill the cycling through the videos thing.  I may have changed settings in mplayer.  I'll have to look into it.  But for now it will repeat the first video it finds in the folder.
If I work out what I changed I'll try to remember to update this.

Ok, down to work.  You need to install xwinwrap.  After you install it, open a terminal and type the command  xwinwrap.  If you get a list of things you can tell it to do, it is installed.  Move to the next step.

If you haven't already got it, install mplayer.

1 -  Create a folder to use for your wallpapers.  Give it a suitable name.
2 -  Create a new blank text document.   Give it a suitable name with NO SPACES.

Create a blank text file in your video wallpaper folder.  Give it a suitable name.name

Copy everything between the rows of start (but not the stars themselves) into the file and save it.
The following script is not mine.  Someone else did the work to make it. 
****************
!#/bin/bash
if ps -e | grep xwinwrap
 then
  killall xwinwrap
  sleep 1
  exit
 fi
# first number is width
xwinwrap -ni -o 1.0 -fs -s -st -sp -b -nf -g 1355x800+0+0 -sh circle -- mplayer -wid WID -nosound *.mp4


fi
sleep 1
exit
******************

The final step here is to save the file and then make it executable.  I am too lazy to use chmod, so I simply open the folder in Dolphin and right click the file, go to Properties and choose Make Executable.  You will need to do whatever you normally do.  If you get stuck just google how to do it from the command line.

A little note here.  If you delete "-sh circle" from the script you will end up with full screen wallpaper without the oval port hole.  If you change the  first two numbers in "1355x800+0+0" you will change the oval or circle.  If you change the last number you will change the horizontal position and the third number should change the vertical position.   Just so you can play around. 

Ok, so now if you were to run that file from inside the folder you should get a video wallpaper. But then you have to open your system monitor and stop mplayer manually when you want it to stop.

So I made a .desktop file that I dragged to Docky.  It should work fine on plank too. 
Make another file in the wallpapers folder and copy the following between the stars as you did before.

****************
[Desktop Entry]
Comment[en_US]=
Comment=
Exec=/home/YOUR USER NAME/Your-Folder-You-Made-for-Wallpaper/NAME-Of-The-File-You-Made
GenericName[en_US]=
GenericName=
Icon=avidemux
MimeType=
Name[en_US]=
Name=
Path=/home/YOUR USER NAME/Your-Folder-You-Made-for-Wallpaper
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
*****************




CHANGE the two lines in BOLD to whatever paths and file names you need.
Save the file with a name like   start-wallpaper.desktop     or something.  
Drag the   .desktop   file to Docky.  I think you can also drag it to Plank if that is your dock.

In Dolphin I right click on the .desktop file and give it a pretty icon to make it easier to find.

That's it really.  To start my video wallpaper I click the icon in Docky.  To turn it off and release memory I simply click it again.  It is that simple.

Thanks to Shantanu Goel  for creating xwinwrap.  And thanks for the person who created the script I use to make xwinwrap run easily.

In my video wallpaper folder I have another folder with a library of videos I like.  I simply drag videos out of the library to run them and back in again when I want to change them.  Dead Easy !!

No comments:

Post a Comment