patch from Han

This commit is contained in:
fluxgen 2003-07-10 11:10:51 +00:00
parent 1f855e63ac
commit 4167ea790c

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.9 2003/07/02 05:42:47 fluxgen Exp $ # $Id: fbsetbg,v 1.10 2003/07/10 11:10:51 fluxgen Exp $
# #
# Portability notes: # Portability notes:
@ -116,11 +116,13 @@ message() {
} }
remembercommand() { remembercommand() {
#if the $wallpaper path is absolute grep -vs "${DISPLAY}$" ${lastwallpaper} > ${lastwallpaper}.tmp
echo $option > $lastwallpaper mv -f ${lastwallpaper}.tmp ${lastwallpaper}
# Make dir/../../path/file.jpg work
case $wallpaper in case $wallpaper in
/*) echo $wallpaper >> $lastwallpaper ;; # no spaces allowed between the varname and '|'
*) echo $PWD/$wallpaper >> $lastwallpaper ;; /*) echo $option'|'$wallpaper'|'$DISPLAY >> $lastwallpaper ;;
*) echo $option'|'$PWD/$wallpaper'|'$DISPLAY >> $lastwallpaper ;;
esac esac
} }
@ -244,11 +246,13 @@ case "${COMMAND_LINE_ARGUMENT}" in
;; ;;
l) l)
if [ -r $lastwallpaper ];then if [ -r $lastwallpaper ];then
option=`head -n1 $lastwallpaper` option=`grep "${DISPLAY}$" $lastwallpaper|cut -d'|' -f1`
wallpaper=`tail -n1 $lastwallpaper` wallpaper=`grep "${DISPLAY}$" $lastwallpaper|cut -d'|' -f2`
else else
message 'No previous wallpaper recorded. You have never used fbsetbg before.' message 'No previous wallpaper recorded. You have never used fbsetbg before.'
exit 1
fi fi
remember=false
;; ;;
h) display_help ; exit 0 ;; h) display_help ; exit 0 ;;
T) display_tips ; exit 0 ;; T) display_tips ; exit 0 ;;
@ -282,4 +286,4 @@ fi
$WPSETTER $option "$wallpaper" || message "Something went wrong while setting the wallpaper $WPSETTER $option "$wallpaper" || message "Something went wrong while setting the wallpaper
Run '$WPSETTER $option "$wallpaper"' from an xterm to find out what." Run '$WPSETTER $option "$wallpaper"' from an xterm to find out what."
#remember previous wallpaper #remember previous wallpaper
remembercommand [ ! "$remember" = false ] && remembercommand