- Fixed relative path bug

- Simpler structure.
This commit is contained in:
rathnor 2003-04-29 11:26:34 +00:00
parent d90ab7cf31
commit 89eace13d6

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.2 2003/04/28 14:45:13 fluxgen Exp $ # $Id: fbsetbg,v 1.3 2003/04/29 11:26:34 rathnor Exp $
# #
# Portability notes: # Portability notes:
@ -38,9 +38,10 @@
# compensate for that. # compensate for that.
# #
wpsetters='wmsetbg Esetroot xli xsetbg display qiv xv xsri' wpsetters='Esetroot wmsetbg display qiv xv xsri xli xsetbg'
lastwallpaper=${HOME}/.fluxbox/lastwallpaper lastwallpaper=${HOME}/.fluxbox/lastwallpaper
WHOAMI=`whoami` WHOAMI=`whoami`
[ "$WHOAMI" = "root" ] && PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin [ "$WHOAMI" = "root" ] && PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin
@ -82,7 +83,7 @@ EOF
display_tips(){ display_tips(){
cat<<EOF cat<<EOF
To replace all occurances of bsetbg in a file use this command: To replace all occurrences of bsetbg in a file use this command:
perl -pi -e 's,([^f]|^)bsetbg,fbsetbg,' perl -pi -e 's,([^f]|^)bsetbg,fbsetbg,'
@ -114,76 +115,21 @@ message() {
} }
remembercommand() { remembercommand() {
#if the $wallpaper path is absolute
echo $option > $lastwallpaper echo $option > $lastwallpaper
echo $wallpaper >> $lastwallpaper case $wallpaper in
/*) echo $wallpaper >> $lastwallpaper ;;
*) echo $PWD/$wallpaper >> $lastwallpaper ;;
esac
} }
debugfbsetbg (){ debugfbsetbg (){
echo
standardrant (){ echo $debugstory
cat <<EOF echo
$WPSETTER sets the 'wrong' wallpaper. transparant apps like aterm and
xchat wont work right with it. Consider using wmsetbg (from windowmaker)
or Esetroot (from Eterm)
EOF
}
for wpsetter in $wpsetters; do
if find_it $wpsetter; then
WPSETTER=$wpsetter
break
fi
done
case $WPSETTER in
xsri)
echo "This is a RedHat specific app. I can't find docs about it."
;;
display)
standardrant
;;
Esetroot)
echo 'Esetroot is a nice app :)'
echo "You won't have any problems."
;;
wmsetbg)
echo 'wmsetbg is my favourite :)'
echo "You won't have any problems."
;;
xsetbg)
standardrant
echo 'Is actually xli'
echo 'fillscreen option (-f) is broken, defaults to (-a)'
;;
xli)
standardrant
echo 'fillscreen option (-f) is broken, defaults to (-a)'
;;
qiv)
standardrant
;;
xv)
standardrant
;;
'')
cat <<EOF
I Can't find and app to set the wallpaper with. You can install one in
many many ways but I will give you some simple advice: install Eterm and
your set. Eterm provides Esetroot and thats a great wallpapersetter. I
recommend you install the package provided by your distro.
EOF
esac
exit 0 exit 0
} }
if [ $1 = -d ];then
debugfbsetbg
fi
# Find the default wallpapersetter # Find the default wallpapersetter
# The precise order is up for debate. # The precise order is up for debate.
for wpsetter in $wpsetters; do for wpsetter in $wpsetters; do
@ -193,79 +139,93 @@ for wpsetter in $wpsetters; do
fi fi
done done
standardrant="$WPSETTER sets the 'wrong' wallpaper. Transparant apps like aterm and
xchat won't work right with it. Consider using wmsetbg (from windowmaker)
or Esetroot (from Eterm)"
case $WPSETTER in case $WPSETTER in
xsri) xsri)
full='--center-x --center-y --scale-width=100 --scale-width=100' full='--center-x --center-y --scale-width=100 --scale-width=100'
tile='--tile' tile='--tile'
center='--center-x --center-y' center='--center-x --center-y'
aspect=$full aspect=$full
debugstory="This is a RedHat specific app. I can't find docs about it."
;; ;;
display) display)
full='`xwininfo -root|grep geom` -window root' full='`xwininfo -root|grep geom` -window root'
tile='-window root' tile='-window root'
center='-backdrop -window root' center='-backdrop -window root'
aspect=$full aspect=$full
debugstory=$standardrant
;; ;;
Esetroot) Esetroot)
full='-scale' full='-scale'
tile='' tile=''
center='-c' center='-c'
aspect='-fit' aspect='-fit'
debugstory="Esetroot is a nice app. You won't have any problems."
;; ;;
wmsetbg) wmsetbg)
full='-s -S' full='-s -S'
tile='-t' tile='-t'
center='-b black -e' center='-b black -e'
aspect='-b black -a' aspect='-b black -a'
debugstory="wmsetbg is a nice app. You won't have any problems."
;; ;;
xsetbg) xsetbg)
tile='-border black' tile='-border black'
center='-center -border black' center='-center -border black'
aspect='-fullscreen -border black' aspect='-fullscreen -border black'
full=$aspect #broken full=$aspect #broken
debugstory="xsetbg is actually xli. The fillscreen option (-f) is broken, defaults to (-a). $standardrant"
;; ;;
xli) xli)
tile='-onroot -quiet -border black' tile='-onroot -quiet -border black'
center='-center -onroot -quiet -border black' center='-center -onroot -quiet -border black'
aspect='-fullscreen -onroot -quiet -border black' aspect='-fullscreen -onroot -quiet -border black'
full=$aspect #broken full=$aspect #broken
debugstory='The fillscreen option (-f) is broken, defaults to (-a). $standardrant'
;; ;;
qiv) qiv)
full='--root_s' full='--root_s'
tile='--root_t' tile='--root_t'
center='--root' center='--root'
aspect='-m --root' aspect='-m --root'
debugstory=$standardrant
;; ;;
xv) xv)
full='-max -smooth -root -quit' full='-max -smooth -root -quit'
tile='-root -quit' tile='-root -quit'
center='-rmode 5 -root -quit' center='-rmode 5 -root -quit'
aspect='-maxpect -smooth -root -quit' aspect='-maxpect -smooth -root -quit'
debugstory=$standardrant
;; ;;
'') '')
message "Can't find and app to set the wallpaper with. message "I can't find an app to set the wallpaper with. You can install one in
Use fbsetbg -d to find out what to do next" many many ways but I will give you some simple advice: install Eterm and
you're set. Eterm provides Esetroot and thats a great wallpaper setter. I
recommend you install the package provided by your distro."
exit 1 exit 1
;;
esac esac
#Get options. #Get options.
getopts ":a:f:c:t:Tlh-" COMMAND_LINE_ARGUMENT getopts ":a:f:c:t:Tdlh-" COMMAND_LINE_ARGUMENT
case "${COMMAND_LINE_ARGUMENT}" in case "${COMMAND_LINE_ARGUMENT}" in
d) debugfbsetbg
exit 0
;;
a) option=$aspect a) option=$aspect
wallpaper=$OPTARG wallpaper=$OPTARG
remembercommand
;; ;;
f) option=$full f) option=$full
wallpaper=$OPTARG wallpaper=$OPTARG
remembercommand
;; ;;
c) option=$center c) option=$center
wallpaper=$OPTARG wallpaper=$OPTARG
remembercommand
;; ;;
t) option=$tile t) option=$tile
wallpaper=$OPTARG wallpaper=$OPTARG
remembercommand
;; ;;
l) l)
if [ -r $lastwallpaper ];then if [ -r $lastwallpaper ];then
@ -300,3 +260,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