summaryrefslogtreecommitdiff
path: root/util/fbsetbg
diff options
context:
space:
mode:
Diffstat (limited to 'util/fbsetbg')
-rw-r--r--util/fbsetbg20
1 files changed, 12 insertions, 8 deletions
diff --git a/util/fbsetbg b/util/fbsetbg
index 9c69071..e13127b 100644
--- a/util/fbsetbg
+++ b/util/fbsetbg
@@ -23,7 +23,7 @@
23# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25# 25#
26# $Id: fbsetbg,v 1.9 2003/07/02 05:42:47 fluxgen Exp $ 26# $Id: fbsetbg,v 1.10 2003/07/10 11:10:51 fluxgen Exp $
27 27
28# 28#
29# Portability notes: 29# Portability notes:
@@ -116,11 +116,13 @@ message() {
116} 116}
117 117
118remembercommand() { 118remembercommand() {
119 #if the $wallpaper path is absolute 119 grep -vs "${DISPLAY}$" ${lastwallpaper} > ${lastwallpaper}.tmp
120 echo $option > $lastwallpaper 120 mv -f ${lastwallpaper}.tmp ${lastwallpaper}
121 # Make dir/../../path/file.jpg work
121 case $wallpaper in 122 case $wallpaper in
122 /*) echo $wallpaper >> $lastwallpaper ;; 123 # no spaces allowed between the varname and '|'
123 *) echo $PWD/$wallpaper >> $lastwallpaper ;; 124 /*) echo $option'|'$wallpaper'|'$DISPLAY >> $lastwallpaper ;;
125 *) echo $option'|'$PWD/$wallpaper'|'$DISPLAY >> $lastwallpaper ;;
124 esac 126 esac
125} 127}
126 128
@@ -244,11 +246,13 @@ case "${COMMAND_LINE_ARGUMENT}" in
244 ;; 246 ;;
245 l) 247 l)
246 if [ -r $lastwallpaper ];then 248 if [ -r $lastwallpaper ];then
247 option=`head -n1 $lastwallpaper` 249 option=`grep "${DISPLAY}$" $lastwallpaper|cut -d'|' -f1`
248 wallpaper=`tail -n1 $lastwallpaper` 250 wallpaper=`grep "${DISPLAY}$" $lastwallpaper|cut -d'|' -f2`
249 else 251 else
250 message 'No previous wallpaper recorded. You have never used fbsetbg before.' 252 message 'No previous wallpaper recorded. You have never used fbsetbg before.'
253 exit 1
251 fi 254 fi
255 remember=false
252 ;; 256 ;;
253 h) display_help ; exit 0 ;; 257 h) display_help ; exit 0 ;;
254 T) display_tips ; exit 0 ;; 258 T) display_tips ; exit 0 ;;
@@ -282,4 +286,4 @@ fi
282$WPSETTER $option "$wallpaper" || message "Something went wrong while setting the wallpaper 286$WPSETTER $option "$wallpaper" || message "Something went wrong while setting the wallpaper
283Run '$WPSETTER $option "$wallpaper"' from an xterm to find out what." 287Run '$WPSETTER $option "$wallpaper"' from an xterm to find out what."
284#remember previous wallpaper 288#remember previous wallpaper
285remembercommand 289[ ! "$remember" = false ] && remembercommand