Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: HOWTO: XPlanet

  1. #21
    Join Date
    Aug 2008
    Location
    Pennsylvania, USA
    Beans
    21

    Re: HOWTO: XPlanet

    Having problems getting the clouds overlay to dsplay. Using xplanet ver.1.2.1 under Linux Mint 9 (Ubuntu 10.4 Gnome). I can retrieve the cloud overlay .jpg, but it's not displaying. Have specified the location of the jpg in the default config file and in the overly-clouds file. Tried specifying the file location in both the [default] and [earth] sections of the config file as well.

    command used is:

    xplanet -latitude 40 -longitude -75 -radius 50 -quality 100 -geometry 800x600 -fork -wait 1800 -config ~/.xplanet

    Any help?

    Steve

  2. #22
    Join Date
    Sep 2011
    Beans
    1

    Re: HOWTO: XPlanet

    I'm running the 11.10 beta and have had to change my script that sets the gnome background image to a live xplanet picture. I use it as a sort of clock, but I don't currently use cloud maps or any other clever stuff except for the night image that you have to set in the config file.

    The script is modified from the one found at http://xplanet.sourceforge.net/FAQ.php#gnome2, the important difference being that it is now necessary to use gsettings instead of gconftool.

    --------

    #!/bin/bash
    # Original script found at http://xplanet.sourceforge.net/FAQ.php#gnome2
    # Add this script to System->Preferences->Sessions->Startup Programs

    myName=$(basename $0)
    logger -p user.debug "$myName woke up at $(date)"

    # Check to see whether the parent process has died (user logged out)
    if [ "$PPID" == "1" ]; then
    logger -p user.debug "$myName (PID $$) exiting at $(date)"
    exit
    fi

    # how long to sleep between drawings
    sleep=295s

    # screen size
    geometry=1280x800

    # the name of the desktop image
    prefix=/tmp
    base=xplanet
    extension=png

    # Alternate between two filenames
    first=${base}1.$extension
    second=${base}2.$extension

    currentBackground=$(basename $(gsettings get org.gnome.desktop.background picture-uri) "'")

    logger -p user.debug "$myName current background file name is $currentBackground"

    # Set the name of the output file to be different than the current background
    if [ "$currentBackground" != "$first" ]; then
    outputFile=${prefix}/$first
    else
    outputFile=${prefix}/$second
    fi

    # Build the parameters (including the $outputFile and $geometry)
    xplanetParams="-num_times 1 -output $outputFile -geometry $geometry -projection mercator -proj_param 75"

    # The xplanet command
    logger -p user.debug "$myName running xplanet $xplanetParams"
    xplanet $xplanetParams | logger

    # update Gnome backgound
    gsettings set org.gnome.desktop.background picture-uri file://$outputFile

    # Sleep for a while, then run myself again
    sleep ${sleep} ; exec $0

  3. #23
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,510
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: HOWTO: XPlanet

    This is my 10.04 version of the script that automatically gets your screen resolution and location from various Gnome settings.

    Feel free to use those bits in your own scripts:

    Code:
    #!/bin/bash
    #xplanet-gnome.sh shell script v1.1
    #shows Earth on your Gnome desktop with current lighting conditions,i.e. day and night
    
    DELAY=5m
    PREFIX=~/
    OUTPUT=.xplanet.png
    #
    # These should extract your current screen resolution and location from your system
    # The location is found from the Gnome Clock Preferences Location.
    #
    GEOMETRY=$(xrandr | grep '*' | head -1 | cut -b 4-12)
    LONGITUDE=$(gconftool -g /apps/panel/applets/clock_screen0/prefs/cities | cut -f5 -d " " | cut -f2 -d "=" | sed 's/"//g' )
    LATITUDE=$(gconftool -g /apps/panel/applets/clock_screen0/prefs/cities | cut -f4 -d " " | cut -f2 -d "=" | sed 's/"//g' )
    #
    #default is no projection,i.e. render a globe
    #rectangular is the flat world map. also try ancient, azimuthal,  mercator,..
    PROJECTION=rectangular
    
    # This stuff is to prevent multiple instances running if you log out and log in again
    lockfile=$HOME/.xplanet.lock
    
    # Check if timestamp of lock file is older than boot time:
    if [ -e $lockfile ]; then
      CDATE=$(date +%s -r $HOME/.xplanet.lock)
      BOOTTIME=$(cat /proc/uptime | cut -f1 -d" ")
      CTIME=$(date +%s)
      FTIME=$(($CTIME - ${BOOTTIME/.*}))
      #
      # If older then it is a leftover - so delete it!
      if [[ $CDATE -lt $FTIME ]]; then
       rm -f $lockfile
     fi
    #
    fi
    
    if [ ! -e $lockfile ]; then
       # Delete lockfile if program receives command to end:
       trap "rm -f $lockfile; rm -f $PREFIX$OUTPUT; exit" INT TERM EXIT
       # and let's make one now....
       touch $lockfile
    else
       # Lockfile exists for this user profile, get me outa here!
       exit
    fi
    
    if [ -z $PROJECTION ]; then 
    xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE
    else
    xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE -projection $PROJECTION
    fi
    
    # Update Gnome backgound - this works in Ubuntu 9.04 & 10.04
    gconftool -t str -s /desktop/gnome/background/picture_filename "$PREFIX$OUTPUT"
    sleep $DELAY
    rm $lockfile
    exec $0
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

Page 3 of 3 FirstFirst 123

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
  •