Wallpaper Changer setup for MiNT LXDE Tested Please.

Forum rules
Before you post please read how to get help
Post Reply
xaser
Level 1
Level 1
Posts: 17
Joined: Tue Sep 11, 2007 5:02 pm

Wallpaper Changer setup for MiNT LXDE Tested Please.

Post by xaser » Fri Nov 12, 2010 7:03 pm

Hello!

Well, I hope not bother too much, but, I would like to ask help with make some kind of wallpaper changer that may really work on LXDE.

I previously ask for this and also there was other posts from other users around hera asking also for help with this, but, after try to dealing with nitrogen feh, and other utilities suggested previously, I was unable since my knoowledge is somewhat limited for tweak this. The details appear to be messy for me is that the setting of the wallpaper file is a line of the config file of pcmanfm and I was also confused since I didnt found how to be called a efresh"of the wallpaper in order to show it after change the line without load pcmanfm.

Basically, I would like to have a script or uitilty configured that may change the wallpaper on LXDE every amount of time (that may be set by user) and that simply loads the wallpaper and refresh it in desktop background automatically.

Here is wher I would like to ask help if some good and skilled friend around here may help setting and testing it that effective really works on LXDE enviroment, since the info in internet are mainly for other enviroments like gnome, xfce, etc(kde have a nice automatic wallpaper changer included), but no success in found help/setting or script that really really work as expected in Mint LXDE.

If may be some kind of help in the way of a method, that may be descripted step by step set up (for a may be unskilled slooow mind person), I will be very gratefull.

Thanks to all and best regards!

P.D. I wonder if ther be possible some script like this but set and tested that really works on LXDE Mint:

http://www.webupd8.org/2009/11/3-lines- ... hange.html

Thanks again

User avatar
edwardr
Level 4
Level 4
Posts: 248
Joined: Thu Jun 03, 2010 1:09 pm
Location: USA - Texas

Re: Wallpaper Changer setup for MiNT LXDE Tested Please.

Post by edwardr » Thu Nov 18, 2010 6:07 pm

I use feh to choose a random wallpaper whenever I boot up on my Mint LXDE laptop. You want to randomly change the wallpaper at a certain interval, which is not the setup I have, but I did run into some instructions for that when I was configuring my system. I don't have my laptop with me, so I can't tell you exactly what to click on, but I hope this helps!

1) Open pcmanfm and disable it from managing the desktop (I think it will no longer display any desktop icons, in case you had any)

2) Install feh

3) Now to create a small program to change the background. Open a text editor (like leafpad) and copy and paste the following text into it, except replace YOUR_NAME with your home directory name:

Code: Select all

#!/bin/sh
while true;
do
   find /home/YOUR_NAME/.wallpaper -type f \( -name '*.jpg' -o -name '*.png' \) -print0 | shuf -n 1 -z | xargs -0 feh --bg-scale
   sleep 15m
done &
Note that the line "sleep 15m" will cause the wallpaper to be changed every 15 minutes. You can change this number to the interval you want.

4) Save the file in your home directory and name it wallpaper.sh


5) Open a terminal, type the following and press enter

Code: Select all

chmod +x wallpaper.sh

6) create a new directory in your home directory called .wallpaper and copy your background images into it. Don't forget the period in front of the directory name. The image files you copy into the folder must be either jpg or png images.


7) Run the following from a terminal to open the startup file so you can edit it (you will have to enter your password)

Code: Select all

gksu leafpad /etc/xdg/lxsession/Mint/autostart

8) Paste the following at the end of the file

Code: Select all

@/home/YOUR_NAME/wallpaper.sh
Note: replace YOUR_NAME with your home folder name


9) Save and close the file.


10) Close evrything else that is open, cross your fingers, and reboot.


Good luck!
The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true

gorillaki
Level 1
Level 1
Posts: 7
Joined: Mon Jul 12, 2010 10:38 am

Re: Wallpaper Changer setup for MiNT LXDE Tested Please.

Post by gorillaki » Wed Nov 24, 2010 8:34 am

You don't need feh, nitrogen or whatever to rotate the wallpaper on lxde.
pcmanfm is absolutely adequate, by means of a very simple script.
First, you must set a directory with your wallpapers-say /home/user/wallpapers
Then tell pcmanfm to use a wallpaper from that directory, formatted the way you like.
Then, create a rotator script. This one is adjusted from a nitrogen rotator, and works perfectly. It's only for .jpg images, but you can add other types with ease.

Code: Select all

#!/bin/bash

DIR=/home/user/wallpapers
FLOOR=1
RANGE=`ls -1 "$DIR"/*.jpg | wc | awk '// {print $1}'`

number=0

while [ 1 -eq 1 ]; do
	
	number=$RANDOM
	while [ "$number" -le $FLOOR ]; do
  		number=$RANDOM
	done
	let "number %= $RANGE"  # Scales $number down within $RANGE.
	COUNTER=1
	for X in "$DIR"/*.jpg
	do
		if [ $number -eq $COUNTER ]; then
			pcmanfm --set-wallpaper "$X"
		fi
	COUNTER=$(($COUNTER+1))
	done
	COUNTER=1
	sleep 2m
done
You can adjust the DIR and sleep time at will.
Save it as, say, "rotator", make it executable and store it at a system PATH.
Now by executting "rotator" you have a great wallpaper changer for LXDE/pcmanfm. Put the script to autostart at LXDE session manager, and you are set.
One thing to have in mind is to kill the script at logout. Actually I'm using ArchLinux with openbox/tint2, not pure LXDE, but pcmanfm is the filemanager, as well as desktop/wallpaper manager.
At logout, I'm running the command

Code: Select all

killall -9 rotator | exit 0 && openbox --exit
So now at next login under openbox (or any other WM) you won't have multiple script instances running.

xaser
Level 1
Level 1
Posts: 17
Joined: Tue Sep 11, 2007 5:02 pm

Re: Wallpaper Changer setup for MiNT LXDE Tested Please.

Post by xaser » Thu Nov 25, 2010 1:19 am

First of all, Thank You very much edwardr and gorillaki, for take time to make such usefull replies!
This is the way in this forum is a great place to be, and the good will of people around here.

Both solutions seems pretty fine, but for my knoledge level, I may suppose to start by try the pcman script option, and would like to know about which script may be run at the logout process that may be suitable to insert the line for kill the wllapaper changer.

Also, seems like a nice script feature that may be included as an option to activate in Mint LXDE, in order that may make the LXDE flavor with a nice small new detail.

But, over all, thanks again to the friends for the kind replies, and to all others around too.

Best regards!

gorillaki
Level 1
Level 1
Posts: 7
Joined: Mon Jul 12, 2010 10:38 am

Re: Wallpaper Changer setup for MiNT LXDE Tested Please.

Post by gorillaki » Thu Nov 25, 2010 8:23 am

Howdy,
the command for LXDE is "lxsession-logout". It isn't a script, but a compiled binary, so it's not trivial to add the wallpaper killscript to it.
But you can assign an openbox key combo (say alt+crtl+end) which will run

Code: Select all

killall -9 rotator | exit 0 && lxsession-logout
Or, you can add an alias at your .bashrc - say something like

Code: Select all

alias lxlogout='killall -9 rotator | exit 0 && lxsession-logout'
Now alt+F2 and "lxlogout" will do the trick for you.
Many choices here- actually that's the great thing about Linux.

xaser
Level 1
Level 1
Posts: 17
Joined: Tue Sep 11, 2007 5:02 pm

Re: Wallpaper Changer setup for MiNT LXDE Tested Please.

Post by xaser » Mon Dec 13, 2010 12:01 pm

Hi gorillaki!

Thanks for such usefull and detailed answer, I will test it as soon I make my clean install of LXDE version.I wonder if such small add on could be included in MiNT LXDE 10 version, since the small code that it may requires may be a nice additional touch to a now wonderful version.

Best regards!

Post Reply

Return to “Others”