Results 1 to 3 of 3

Thread: Wallpaper changing

  1. #1
    Join Date
    Jan 2011
    Location
    Indianapolis IN, USA
    Beans
    139
    Distro
    Lubuntu 11.10 Oneiric Ocelot

    Wallpaper changing

    Say I have an image file that updates every once in a while. Like a static web cam. Is there any way I can monitor the file, and when it changes set it as my desktop (PCmanFM) wallpaper? I Don't want to just run a script that does it every * min. Waste time/resources when/if it doesn't change. (Every 3 min for a while, then nothing for hours/days.)

    Lubuntu 11.10 x64
    "Endure, and through enduring grow stronger."

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

    Re: Wallpaper changing

    This will change your wallpaper periodically

    http://ubuntuforums.org/showthread.php?t=1843824

    I know that's not what you want.

    You need someone clever with scripts to combine the above with watch or tail.



    For How-To's, Information and Screen-Casts on Lubuntu go to the
    Lubuntu One Stop Thread -

    Lubuntu One Stop Thread

    Rodney

  3. #3
    Join Date
    Jan 2011
    Location
    Indianapolis IN, USA
    Beans
    139
    Distro
    Lubuntu 11.10 Oneiric Ocelot

    Re: Wallpaper changing

    , I use that thread all the time. Very nice.

    And thanks, Never even heard of the watch command before, not a big CL person. Going to try and use it myself, don't know if I can, but will try.

    So, I did a little research, and sorta got one started. Though I didn't use the watch command, just du and if test then
    Code:
    #/bin/bash
    
    z2=0
    
    while :
    
    do
        z1=$(du /path/to/image.png | head -c 3)
        if test [$z1 != $z2]; then 
            pcmanfm --set-wallpaper=/path/to/image.png
            sleep 120
    
            fi
        z2=$(du /path/to/image.png | head -c 3)
        sleep 10
    done
    But it is never equal, even when it should. As I said, not good as scripts, first time trying variables, so I am sure it is just my stupidity.

    Any help?

    Well, I got it figgered out. Here is the working code for anyone
    Code:
    #/bin/bash
    while :
    
    do
        z1=$(du /path/to/image.png | head -c 3) # set z1 as the first 3 numbers in a filesize
        if test $z1 -ne $z2; then
            pcmanfm --set-wallpaper=/path/to/image.png
            z2=$(du /path/to/image.png | head -c 3) # set z2 as the first 3 numbers in a filesize    
            sleep 120
            else
            z2=$(du /path/to/image.png | head -c 3)  # set z2 as the first 3 numbers in a filesize
        sleep 5
            fi
    done
    Not pretty, I am sure, but it works.
    Last edited by Theredbaron1834; January 29th, 2012 at 08:26 PM.
    "Endure, and through enduring grow stronger."

Tags for this Thread

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
  •