support for bsetroot in fbsetbg

This commit is contained in:
fluxgen 2003-12-12 13:07:47 +00:00
parent 96c1445408
commit 5d4980a9c6

View file

@ -23,7 +23,7 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
# $Id: fbsetbg,v 1.24 2003/12/08 19:31:40 fluxgen Exp $ # $Id: fbsetbg,v 1.25 2003/12/12 13:07:47 fluxgen Exp $
# Portability notes: # Portability notes:
# To guarantee this script works on all platforms that support fluxbox # To guarantee this script works on all platforms that support fluxbox
@ -59,7 +59,7 @@ command="`basename \"$0\"`"
# Functions # Functions
display_usage() { display_usage() {
cat << EOF cat << EOF
Usage: $command [-u/-U [wallpapersetter]] [-fFcCtTaA /path/to/wallpaper] [-l] [-h] [-i] [-p] Usage: $command [-u/-U [wallpapersetter]] [-fFcCtTaA /path/to/wallpaper] [-bB bsetrootoptions] [-l] [-h] [-i] [-p]
Use \`\`$command -h'' for a complete help message. Use \`\`$command -h'' for a complete help message.
EOF EOF
@ -71,23 +71,24 @@ display_help() {
Options: Options:
-f Set fullscreen wallpaper -f Set fullscreen wallpaper.
-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.
( if your bgsetter doesn't support this ( if your bgsetter doesn't support this
we fall back to -f ) we fall back to -f )
-u Use specified wallpapersetter, use no argument to forget -u Use specified wallpapersetter, use no argument to forget.
-b Forward the options to bsetroot.
-F,-C,-T,-A,-U same as uncapsed but without remembering. -F,-C,-T,-A,-U,-B same as uncapsed but without remembering.
-h Display this help -h Display this help.
-l Set previous wallpaper -l Set previous wallpaper.
-i Information about selected wallpaper command -i Information about selected wallpaper command.
-d (deprecated, use -i) Debug info -d (deprecated, use -i) Debug info.
-p Tips -p Tips.
Files: Files:
@ -162,6 +163,10 @@ message() {
remembercommand() { remembercommand() {
grep -vs "|${DISPLAY}$" ${lastwallpaper} > ${lastwallpaper}.tmp grep -vs "|${DISPLAY}$" ${lastwallpaper} > ${lastwallpaper}.tmp
mv -f ${lastwallpaper}.tmp ${lastwallpaper} mv -f ${lastwallpaper}.tmp ${lastwallpaper}
if [ "$option" = bsetroot ]; then
echo $option'|'$wallpaper'|'$DISPLAY >> $lastwallpaper
return
fi
# 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 '|'
@ -246,6 +251,15 @@ while [ $# -gt 0 ]; do
wallpaper=$2 wallpaper=$2
remember=false remember=false
break ;; break ;;
-b) option=bsetroot
shift
wallpaper=$*
break ;;
-B) option=bsetroot
shift
wallpaper=$*
remember=false
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`
@ -403,16 +417,25 @@ fi
option=${option:='$full'} option=${option:='$full'}
if [ ! -r "$wallpaper" ]; then
message "Can't find wallpaper $wallpaper"
exit 1
fi
if [ -z "$DISPLAY" ];then if [ -z "$DISPLAY" ];then
message "You are not connected to an X session\nPerhaps you should set the DISPLAY environment variable?" message "You are not connected to an X session\nPerhaps you should set the DISPLAY environment variable?"
exit 1 exit 1
fi fi
if [ "$option" = bsetroot ]; then
bsetroot $wallpaper
if [ ! "$remember" = false ]; then
remembercommand
fi
exit 0
fi
if [ ! -r "$wallpaper" ]; then
message "Can't find wallpaper $wallpaper"
exit 1
fi
$WPSETTER `eval echo $option` "$wallpaper" $WPSETTER `eval echo $option` "$wallpaper"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then