Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Lubuntu Wallpaper Changer

  1. #1
    Join Date
    Jul 2010
    Location
    New Jersey
    Beans
    167
    Distro
    Lubuntu

    Lubuntu Wallpaper Changer

    I noticed a lot of people are having problems finding a proper wallpaper changer for Lubuntu. I for one haven't been able to find a program that actually works right with PCManFM, this includes Nitrogen and feh among others.

    However I've been able to create a pretty simple script to get around this.

    Make sure to add this into your autostart programs if you want to use this. You can do this by going to:

    /etc/xdg/lxsession/Lubuntu/autostart

    Edit the file and add "@ /home/USERNAME/PATHTOSCRIPT" as you may notice with the other autostart apps.

    PATHTOSCRIPT means the file path to script.

    This is the script:

    Code:
    #!/bin/bash
    #Script
    n=10
    while [ $n -le 10 ]
    do
    sleep 8m &&
    NUMBER=$[ ( $RANDOM % 81 )  + 1 ]
    pcmanfm --set-wallpaper=/FILE_PATH_TO_WALLPAPERS/$NUMBER.jpg
    done
    For FILE_PATH_TO_WALLPAPERS you set the correct file path for me this was /home/bewbman/Wallpapers/ then my wallpaper was selected from this folder.

    The n set to 10 is obviously to create an infinite while loop so this keeps going on as long as its running.

    You can set whatever time you want for sleep, whether it be 5s or 1h, you choose that option.

    The NUMBER variable is to create a random variable to choose a picture from your folder, in here I have renamed the desktop pictures 1 - 81.

    So if you have 50 wallpapers MAKE SURE to change the number after "$RANDOM %" to how many wallpapers you have.

    It will pick a random number from 1 to whatever the number you have defined is and set the file path to that.

    For png images you can simply rename them to jpgs and it will recognize them as jpgs.

    When taking this script after you've modified it to the correct values place it in the folder you want, and save it in a text file. Make sure the name ends in .sh to make it a script. For me it was random.sh. Make sure to right click on it as well and go to properties, go to properties and click on 'Make It Executable'.

    After this you can test it in terminal just by running the filepath/filename.sh in terminal.

    It needs some user modifications but it works as a charm and as far as I'm concerned I haven't found anything that really works for this. This is also very light and does the job that you want so I'm happy with it. Was sharing it for others.

  2. #2
    Join Date
    Oct 2011
    Beans
    4

    Re: Lubuntu Wallpaper Changer

    cool! I will test it later.

    Some suggestions for tweaks-
    - get a random image from a directory (including subdirectories) without renaming the images to numbers
    - allow png, jpg, jpeg and gif extensions

  3. #3
    Join Date
    Oct 2008
    Location
    Down Under
    Beans
    1,568
    Distro
    Ubuntu Budgie 18.04 Bionic Beaver

    Re: Lubuntu Wallpaper Changer

    I can't get this to work, I have 4 wallpapers I wish to change every 15 minutes.

    I have re-named my wallpapers numerical 1 to 4.

    Change the sleep number to 15m , this means how often they will change, does it ??

    Changed the number after "$RANDOM %" to 4

    Named it wallpaperchange.sh , made it executable.

    Here is my wallpaperchange.sh

    Code:
    #!/bin/bash
    #Script
    n=10
    while [ $n -le 10 ]
    do
    sleep 2m &&
    NUMBER=$[ ( $RANDOM % 4 )  + 1 ]
    pcmanfm --set-wallpaper=/home/rodney/wallpaper/$NUMBER.jpg
    done
    What am I doing wrong ?


    Rodney

  4. #4
    Join Date
    Oct 2008
    Location
    Peterborough, ON
    Beans
    37
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Lubuntu Wallpaper Changer

    Your images are jpg or you have named as such?
    Your path to your images is correct?

    Just trying to think about what it could be, my experience
    has been its usually the simplest thing that causes the biggest
    headaches.

  5. #5
    Join Date
    Jan 2010
    Location
    Tucson, AZ
    Beans
    266
    Distro
    Ubuntu Budgie 20.04 Focal Fossa

    Re: Lubuntu Wallpaper Changer

    Yea, I could not get it to work either. Running it in terminal mode gave me some unknown error on line 8 about an invalid option for PCmanfm.

  6. #6
    Join Date
    Oct 2008
    Location
    Down Under
    Beans
    1,568
    Distro
    Ubuntu Budgie 18.04 Bionic Beaver

    Re: Lubuntu Wallpaper Changer

    Quote Originally Posted by makitso View Post
    Yea, I could not get it to work either. Running it in terminal mode gave me some unknown error on line 8 about an invalid option for PCmanfm.
    When I run it in a terminal nothing happens, the cursor just goes to the next line, and nothing.

  7. #7
    Join Date
    Oct 2008
    Location
    Down Under
    Beans
    1,568
    Distro
    Ubuntu Budgie 18.04 Bionic Beaver

    Re: Lubuntu Wallpaper Changer

    Well Well Well
    I left the terminal open and went and had breakfast, came back and the wallpaper is changing, HURRAH

  8. #8
    Join Date
    Oct 2009
    Location
    Sydney
    Beans
    4,301
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Lubuntu Wallpaper Changer

    I'm going to test that on 11.04 and 11.10 and if all will work, I'll include this guide on my Mega Thread

    Lubuntu needs stuff like that. Keep them coming

  9. #9
    Join Date
    Jul 2010
    Location
    New Jersey
    Beans
    167
    Distro
    Lubuntu

    Re: Lubuntu Wallpaper Changer

    I'm glad to hear someone got this to work, sorry I haven't logged on to my Ubuntu forums account in a while so I had no idea I got views and replies.

    A great way to test this is just set it to 5s instead of 8m to see what's wrong. If people are still having problems post what your code is and I can help.

    Keep in mind you can autostart this script with Openbox or assign it to a shortcut.

    Not only this you can use this base script to create a next wallpaper script like I have done which doesn't autoswitch just gets another one and put int he Openbox menu so you can right click your desktop and hit Next Wallpaper.

    If people need more explanation on this I can definitely help out.

    I will work on finding a way around png and other image types. I also want to create something that chooses a random file from a directory of course that might take a bit, I created this as a quick bandage for a problem many people face.
    Last edited by Gaygerbil; November 12th, 2011 at 03:47 AM.

  10. #10
    Join Date
    Oct 2008
    Location
    Down Under
    Beans
    1,568
    Distro
    Ubuntu Budgie 18.04 Bionic Beaver

    Re: Lubuntu Wallpaper Changer

    Any news on updates, I am enjoying it as it.

    Rodney

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •