[ubuntu-uk] gnome desktop background changer

2010-10-16 Thread Jacob Mansfield
I am attempting to make the desktop background in gnome change automatically
to a random image from a set folder. I know the command I need is

gconftool-2 --type=string -s /desktop/gnome/background/picture_filename
/full/path/to/image/file

I have worked this into a basic shell script:

time=$1
# time to wait between changing the background in secs
while [ : ]
 do
 for filepath in `cat list`
 # list is a list of all files in the backgrounds directory and is the only
other non-image file in the folder
  do
  echo $filepath
  # for debug
  gconftool-2 --type=string -s /desktop/gnome/background/picture_filename
“$filepath”
  sleep $time
  done
 done

however allthough this sets the value (I can see it in the xml configuration
file with emacs) the background simply goes to the set colour not the image.
is there another value I need to get the background as an image? or is there
something wrong with my script? all help appreciated.
Jacob Mansfield
Programmer
-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] gnome desktop background changer

2010-10-16 Thread Steve Fisher
On 16 October 2010 10:01, Jacob Mansfield cyberja...@gmail.com wrote:

 I am attempting to make the desktop background in gnome change
 automatically to a random image from a set folder. I know the command I need
 is

 gconftool-2 --type=string -s /desktop/gnome/background/picture_filename
 /full/path/to/image/file

 I have worked this into a basic shell script:

 time=$1
 # time to wait between changing the background in secs
 while [ : ]
  do
  for filepath in `cat list`
  # list is a list of all files in the backgrounds directory and is the only
 other non-image file in the folder
   do
   echo $filepath
   # for debug
   gconftool-2 --type=string -s /desktop/gnome/background/picture_filename
 “$filepath”
   sleep $time
   done
  done

 however allthough this sets the value (I can see it in the xml
 configuration file with emacs) the background simply goes to the set colour
 not the image. is there another value I need to get the background as an
 image? or is there something wrong with my script? all help appreciated.
 Jacob Mansfield
 Programmer


 --
 ubuntu-uk@lists.ubuntu.com
 https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
 https://wiki.ubuntu.com/UKTeam/


Jacob

Have a look at:

http://www.itlure.com/2009/11/create-your-own-gnome-background.html

Steve
-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] gnome desktop background changer

2010-10-16 Thread Jacob Mansfield
I have over 500 pictures. entering all of their file names by hand isn't an
option.
Jacob Mansfield
Programmer



On 16 October 2010 10:27, Steve Fisher xirco...@gmail.com wrote:

 On 16 October 2010 10:01, Jacob Mansfield cyberja...@gmail.com wrote:

 I am attempting to make the desktop background in gnome change
 automatically to a random image from a set folder. I know the command I need
 is

 gconftool-2 --type=string -s /desktop/gnome/background/picture_filename
 /full/path/to/image/file

 I have worked this into a basic shell script:

 time=$1
 # time to wait between changing the background in secs
 while [ : ]
  do
  for filepath in `cat list`
  # list is a list of all files in the backgrounds directory and is the
 only other non-image file in the folder
   do
   echo $filepath
   # for debug
   gconftool-2 --type=string -s /desktop/gnome/background/picture_filename
 “$filepath”
   sleep $time
   done
  done

 however allthough this sets the value (I can see it in the xml
 configuration file with emacs) the background simply goes to the set colour
 not the image. is there another value I need to get the background as an
 image? or is there something wrong with my script? all help appreciated.
  Jacob Mansfield
 Programmer


 --
 ubuntu-uk@lists.ubuntu.com
 https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
 https://wiki.ubuntu.com/UKTeam/


 Jacob

 Have a look at:

 http://www.itlure.com/2009/11/create-your-own-gnome-background.html

 Steve

 --
 ubuntu-uk@lists.ubuntu.com
 https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
 https://wiki.ubuntu.com/UKTeam/


-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] gnome desktop background changer

2010-10-16 Thread Steve Fisher
Thinking out of the box, why not write a script to generate the xml file?

I will have a go, but have to nip out for a couple of hours.

Steve
-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] gnome desktop background changer

2010-10-16 Thread Steve Fisher
God, this was hard work!  But I think it runs, needs testing and all the
paths are hardcoded and need changing.

So I am assembling a directory of jpegs and will report back, but going out
(again) for a while.

#!/bin/bash
rm background-1.xml
echo background  background-1.xml
echo   starttime  background-1.xml
echo year2009/year  background-1.xml
echo month08/month  background-1.xml
echo day04/day  background-1.xml
echo hour00/hour  background-1.xml
echo minute00/minute  background-1.xml
echo second00/second  background-1.xml
echo   /starttime  background-1.xml
echo !-- This animation will start at midnight. --  background-1.xml

#counter variable
x=1

for file in *

do
#echo $x
 if [ $x -eq 1 ]
then
FE='to/usr/share/backgrounds/cosmos/'
FE=${FE}$file
FE=${FE}/to
fi
 if [ $x -gt 1 ]
then
FT='to/usr/share/backgrounds/cosmos/'
FT=${FT}$file
FT=${FT}/to
echo $FT  background-1.xml
fi
 echo   static  background-1.xml
echo duration1795.0/duration  background-1.xml
 FS=   file/usr/share/backgrounds/cosmos/
FS=${FS}$file
FS=${FS}/file
 FR=   from/usr/share/backgrounds/cosmos/
FR=${FR}$file
FR=${FR}/from
 FT=   to/usr/share/backgrounds/cosmos/
FT=${FT}$file
FT=${FT}/to
 echo $FS  background-1.xml
echo   static  background-1.xml
echo duration5.0/duration  background-1.xml
echo $FR  background-1.xml
echo /transition  background-1.xml
 #ls $file  # Lists all files in $PWD (current directory).

x=$(( $x + 1 ))

#echo $x

done

echo $FE  background-1.xml
echo /transition  background-1.xml
echo /background  background-1.xml

exit 0
-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] gnome desktop background changer

2010-10-16 Thread Alan Lord (News)
On 16/10/10 13:52, Steve Fisher wrote:
 #!/bin/bash
 rm background-1.xml

I think Heredocs would be easier to read  faster  here.

cat  background-1.xml  EOF
background
  starttime
   year2009/year
   month08/month
   day04/day
   hour00/hour
   minute00/minute
   second00/second
  /starttime
!-- This animation will start at midnight. --
EOF

Al


-- 
The Open Learning Centre
http://www.theopenlearningcentre.com


-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] gnome desktop background changer

2010-10-16 Thread Jacob Mansfield
you're gonna have to explain a little more than that I'm afraid
Jacob Mansfield
Programmer



On 16 October 2010 16:30, Alan Lord (News) alansli...@gmail.com wrote:

 On 16/10/10 13:52, Steve Fisher wrote:
  #!/bin/bash
  rm background-1.xml

 I think Heredocs would be easier to read  faster  here.

 cat  background-1.xml  EOF
 background
  starttime
   year2009/year
   month08/month
   day04/day
   hour00/hour
   minute00/minute
   second00/second
  /starttime
 !-- This animation will start at midnight. --
 EOF

 Al


 --
 The Open Learning Centre
 http://www.theopenlearningcentre.com


 --
 ubuntu-uk@lists.ubuntu.com
 https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
 https://wiki.ubuntu.com/UKTeam/

-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] gnome desktop background changer

2010-10-16 Thread Steve Fisher
OK script finished tested and working:

#!/bin/bash
rm background-2.xml
echo background  background-2.xml
echo   starttime  background-2.xml
echo year2009/year  background-2.xml
echo month08/month  background-2.xml
echo day04/day  background-2.xml
echo hour00/hour  background-2.xml
echo minute00/minute  background-2.xml
echo second00/second  background-2.xml
echo   /starttime  background-2.xml
echo !-- This animation will start at midnight. --  background-2.xml

#counter variable
x=1

for file in *.jpg

do
if [ $x -eq 1 ]
then
FE='to/usr/share/backgrounds/testdir/'
FE=${FE}$file
FE=${FE}/to
fi
 if [ $x -gt 1 ]
then
FT='to/usr/share/backgrounds/testdir/'
FT=${FT}$file
FT=${FT}/to
echo $FT  background-2.xml
echo /transition  background-2.xml
 fi
 echo   static  background-2.xml
echo duration1795.0/duration  background-2.xml
 FS=   file/usr/share/backgrounds/testdir/
FS=${FS}$file
FS=${FS}/file
 FR=   from/usr/share/backgrounds/testdir/
FR=${FR}$file
FR=${FR}/from
 FT=   to/usr/share/backgrounds/testdir/
FT=${FT}$file
FT=${FT}/to
 echo $FS  background-2.xml
echo   /static  background-2.xml
echo   transition  background-2.xml
echo duration5.0/duration  background-2.xml
echo $FR  background-2.xml
 #ls $file  # Lists all files in $PWD (current directory).

x=$(( $x + 1 ))

#echo $x

done

echo $FE  background-2.xml
echo /transition  background-2.xml
echo /background  background-2.xml

exit 0

Change /usr/share/backgrounds/testdir/ to match your directory with search
 replace.

Will tart it up with zenity later.
-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] gnome desktop background changer

2010-10-16 Thread Alan Lord (News)
On 16/10/10 16:39, Jacob Mansfield wrote:
 you're gonna have to explain a little more than that I'm afraid
 Jacob Mansfield
 Programmer

http://tldp.org/LDP/abs/html/here-docs.html


-- 
The Open Learning Centre
http://www.theopenlearningcentre.com


-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] gnome desktop background changer

2010-10-16 Thread Steve Fisher
Instructions:

1. Dump a load of jpegs in a directory, I used /usr/backgrounds/testdir
2. Copy the script into the same directory and make it executable.  Edit and
change path and name of output xml to suite.
3. Open terminal change directory and run script
4. Drag and drop output xml to background section of appearance.
-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] gnome desktop background changer

2010-10-16 Thread Steve Fisher
Ha Ha Ha http://darkrule.freewebhostx.com/hello/xmlmaker.php

http://darkrule.freewebhostx.com/hello/xmlmaker.phpIf only I had read
further down the link I originally gave you.
-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/