Page 6 of 7 FirstFirst ... 4567 LastLast
Results 51 to 60 of 63

Thread: HOWTO: Finally! How to easily change your desktop to a random file at specified times

  1. #51
    Join Date
    Jan 2008
    Beans
    345

    Re: HOWTO: Finally! How to easily change your desktop to a random file at specified t

    Niicodemus -

    I tried your perl script on another Jaunty install (this one upgraded from Intrepid), and it works great. One question though. Can it 1) be modified to access images from multiple directories, and/or 2) be modified to include sub-directories?

    And I still have the errors in my previous post for the original installation. I would still like to get that resolved too.

    TIA,

    xeddog

  2. #52
    Join Date
    Jul 2009
    Location
    Cyprus
    Beans
    222
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: HOWTO: Finally! How to easily change your desktop to a random file at specified t

    thnx a lot nice 1

    i used the perl script works fine
    Last edited by hyperAura; July 28th, 2009 at 10:33 AM.

  3. #53
    Join Date
    Apr 2006
    Location
    UK
    Beans
    54
    Distro
    Ubuntu Development Release

    New version for jaunty/karmic

    Here's my fairly simple take on this. Since intrepid, gconftool has used DBUS, breaking the older scripts. This script works with both newer and older versions of Ubuntu.
    It works with as many directories as you like, and handles recursion happily.
    Although it's a fairly large file (nearly 3kb), that's mostly because of the heavy commenting.

    Your thoughts?
    Attached Files Attached Files
    Last edited by gnudoc; September 13th, 2009 at 02:30 PM.

  4. #54
    Join Date
    Sep 2009
    Beans
    63

    Re: New version for jaunty/karmic

    Quote Originally Posted by gnudoc View Post
    Here's my fairly simple take on this. Since intrepid, gconftool has used DBUS, breaking the older scripts. This script works with both newer and older versions of Ubuntu.
    It works with as many directories as you like, and handles recursion happily.
    Although it's a fairly large file (nearly 3kb), that's mostly because of the heavy commenting.

    Your thoughts?

    this script works really well for me - so thanks:]

    the only weird thing i encountered was that i got the following error message when running the script from the shell:
    Code:
    touch: cannot touch `.../scripts/wallpaper/Xdbus_details': No such file or directory
    chmod: cannot access `.../scripts/wallpaper/Xdbus_details': No such file or directory
    i know it says in your comments that i need to change the path to the Xdbus_details file, but since i'm fairly new to scripting i couldn't make sense of what you meant by
    Code:
    source the file at $DETAILS in your cronjob
    "*/10 * * * * . /path/to/Xdbus_details; /path/to/setwallpaper.sh" is the sort of thing you want
    plus, i can't seem to find the Xdbus_details file anywhere in my file system.

    other than that, thanks again for sharing the script!

  5. #55
    Join Date
    Mar 2006
    Beans
    393

    Re: HOWTO: Finally! How to easily change your desktop to a random file at specified t

    I just installed 9.04 in anticipation of the Big Day and now crontab won't change my background.

    • It worked fine in 8.04
    • It works fine in a terminal
    • It correctly changes ~/.gconf/desktop/gnome/background/%gconf.xml


    It just doesn't change the image.

    Anybody got any ideas?

    Update 2009.10.3: After some investigation, I discovered that the daemon to change the background, gconfd-2, does not realizes that the gconf files have changed. The result, no change in the image. Now to figure out what to do about it.
    Last edited by shawnhcorey; October 3rd, 2009 at 01:22 PM.
    Just my 0.00000002 million dollars worth,
    Shawn

    Programming is as much about organization and communication as it is about coding.

  6. #56
    Join Date
    Oct 2009
    Location
    Cedar Falls, Iowa USA
    Beans
    Hidden!

    Re: HOWTO: Finally! How to easily change your desktop to a random file at specified t

    Quote Originally Posted by shawnhcorey View Post
    Update 2009.10.3: After some investigation, I discovered that the daemon to change the background, gconfd-2, does not realizes that the gconf files have changed. The result, no change in the image. Now to figure out what to do about it.
    This is covered in Bug #285937.

    There are suggestions provided in the bug, but I prefer this:

    Code:
    export DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS:=$(grep "^DBUS_SESSION_BUS_ADDRESS=" ${HOME}/.dbus/session-bus/$(cat /var/lib/dbus/machine-id)-${DISPLAY##:[0-9].} )}
    This will export the needed environment variable "DBUS_SESSION_BUS_ADDRESS" if it is not set or is null. I would not put this in your crontab. Instead, it should be in the code calling gconftool-2. It must be set prior to the line executing gconftool-2.
    Last edited by major.stubble; October 28th, 2009 at 02:24 AM.

  7. #57
    Join Date
    Nov 2009
    Beans
    8
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HOWTO: Finally! How to easily change your desktop to a random file at specified t

    Here's the script I use for changing wallpaper in gnome. It uses the shuf command, not arrays. I'm not sure if it is in all versions of Ubuntu, but it works in 9.10 Karmic

    Code:
    #!/bin/bash
    
    # Script to randomly set Background from files in a directory
    
    # Directory Containing Pictures
    DIR="/home/username/Pictures/background"
    
    # Command to Select a random jpg file from directory
    # Delete the *.jpg to select any file but it may return a folder
    PIC=$(ls $DIR/*.jpg | shuf -n1)
    
    # Command to set Background Image
    gconftool -t string -s /desktop/gnome/background/picture_filename $PIC
    I pieced it together from other posts solving different problems, and it works, but if it can be improved let me know.
    Last edited by Derek S; November 22nd, 2009 at 07:20 AM.

  8. #58
    Join Date
    Feb 2010
    Location
    Hyderabad
    Beans
    6
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HOWTO: Finally! How to easily change your desktop to a random file at specified t

    Hello, first of all good work but when i execute the command

    sudo sh /bin/changewallpaper.sh

    it is showing the following error.

    /bin/changewallpaper.sh: 10: Syntax error: "(" unexpected

    Can u help me in this....

  9. #59
    Join Date
    Jul 2005
    Beans
    740
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOWTO: Finally! How to easily change your desktop to a random file at specified t

    Last edited by pt123; June 28th, 2010 at 03:55 AM.

  10. #60
    Join Date
    Feb 2010
    Location
    Hyderabad
    Beans
    6
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HOWTO: Finally! How to easily change your desktop to a random file at specified t

    hey tried the script...but now wall paper is not changing randomly i added following lines
    crontab -e
    */1 * * * * changewallpaper.sh
    @reboot changewallpaper.sh

    any suggestions ??

Page 6 of 7 FirstFirst ... 4567 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
  •