allow aspect/centered/tiled options with random in fbsetbg

This commit is contained in:
markt 2006-08-04 23:28:34 +00:00
parent 1dd5e0143e
commit 53adbd9921
2 changed files with 26 additions and 26 deletions

View file

@ -1,6 +1,9 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 1.0rc3: Changes for 1.0rc3:
*06/08/04: *06/08/04:
* Allow aspect/centered/tiled options with random background in fbsetbg
(thanks Julien Trolet)
util/fbsetbg
* Don't re-apply remembered settings on restart if they are set as window * Don't re-apply remembered settings on restart if they are set as window
properties (Mark) properties (Mark)
Remember.cc Screen.cc Window.cc Remember.cc Screen.cc Window.cc

View file

@ -59,9 +59,10 @@ command="`basename \"$0\"`"
# Functions # Functions
display_usage() { display_usage() {
cat << EOF cat << EOF
Usage: $command [-u/-U [wallpapersetter]] [-fFcCtTaA /path/to/wallpaper] Usage: $command [-u/-U [wallpapersetter]] [-fFcCtTaA] /path/to/wallpaper
[-r/-R /path/to/wallpaperdirectory] $command [-u/-U [wallpapersetter]] [-fFcCtTaA] -r/-R /path/to/wallpaperdirectory
[-b/-B fbsetrootoptions] [-l] [-h] [-i] [-p] $command [-b/-B fbsetrootoptions]
$command [-lhip]
Use \`\`$command -h'' for a complete help message. Use \`\`$command -h'' for a complete help message.
EOF EOF
@ -73,7 +74,7 @@ display_help() {
Options: Options:
-f Set fullscreen wallpaper. -f Set fullscreen wallpaper (default).
-c Set centered wallpaper. -c Set centered wallpaper.
-t Set tiled wallpaper. -t Set tiled wallpaper.
-a Set maximized wallpaper, preserving aspect. -a Set maximized wallpaper, preserving aspect.
@ -181,8 +182,8 @@ remembercommand() {
# Make dir/../../path/file.jpg work # Make dir/../../path/file.jpg work
case $wallpaper in case $wallpaper in
# no spaces allowed between the varname and '|' # no spaces allowed between the varname and '|'
/*) echo $option'|'$wallpaper'|'$DISPLAY >> $lastwallpaper ;; /*) echo $option $option2'|'$wallpaper'|'$DISPLAY >> $lastwallpaper ;;
*) echo $option'|'$PWD/$wallpaper'|'$DISPLAY >> $lastwallpaper ;; *) echo $option $option2'|'$PWD/$wallpaper'|'$DISPLAY >> $lastwallpaper ;;
esac esac
} }
@ -240,33 +241,25 @@ while [ $# -gt 0 ]; do
-d|-i) debug=true -d|-i) debug=true
break ;; break ;;
-a) option='$aspect' -a) option='$aspect'
wallpaper=$2 shift ;;
break ;;
-f) option='$full' -f) option='$full'
wallpaper=$2 shift ;;
break ;;
-c) option='$center' -c) option='$center'
wallpaper=$2 shift ;;
break ;;
-t) option='$tile' -t) option='$tile'
wallpaper=$2 shift ;;
break ;;
-A) option='$aspect' -A) option='$aspect'
wallpaper=$2
remember=false remember=false
break ;; shift ;;
-F) option='$full' -F) option='$full'
wallpaper=$2
remember=false remember=false
break ;; shift ;;
-C) option='$center' -C) option='$center'
wallpaper=$2
remember=false remember=false
break ;; shift ;;
-T) option='$tile' -T) option='$tile'
wallpaper=$2
remember=false remember=false
break ;; shift ;;
-b) option=fbsetroot -b) option=fbsetroot
shift shift
wallpaper=$* wallpaper=$*
@ -276,16 +269,20 @@ while [ $# -gt 0 ]; do
wallpaper=$* wallpaper=$*
remember=false remember=false
break ;; break ;;
-r) option=random -r) option2=$option
option=random
wallpaper=$2 # in this case it's a dir wallpaper=$2 # in this case it's a dir
break ;; break ;;
-R) option=random -R) option2=$option
option=random
wallpaper=$2 # in this case it's a dir wallpaper=$2 # in this case it's a dir
remember=false remember=false
break ;; break ;;
-l) -l)
if [ -r "$lastwallpaper" ]; then if [ -r "$lastwallpaper" ]; then
option=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f1` option=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f1`
option2=`echo $option|cut -d' ' -f2`
option=`echo $option|cut -d' ' -f1`
wallpaper=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f2` wallpaper=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f2`
if [ -z "$wallpaper" ]; then if [ -z "$wallpaper" ]; then
option=`grep "|${DISPLAY}.0$" $lastwallpaper|cut -d'|' -f1` option=`grep "|${DISPLAY}.0$" $lastwallpaper|cut -d'|' -f1`
@ -461,7 +458,7 @@ if [ "$debug" = true ]; then
fi fi
option=${option:='$full'} option=${option:='$full'}
option2=${option2:='$full'}
if [ -z "$DISPLAY" ]; then if [ -z "$DISPLAY" ]; then
@ -505,7 +502,7 @@ if [ "$option" = random ]; then
remember=false remember=false
#set -x #set -x
wallpaper="$wallpaperdir/`ls \"$wallpaperdir\"|sed -n ${wallpapernumber}p`" wallpaper="$wallpaperdir/`ls \"$wallpaperdir\"|sed -n ${wallpapernumber}p`"
option='$aspect' # have to choose something... option=$option2 # have to choose something...
else else
message "Invalid random wallpaper directory specified." message "Invalid random wallpaper directory specified."
exit 1 exit 1