fbsetbg update from han

This commit is contained in:
rathnor 2003-10-16 15:54:20 +00:00
parent bc75892375
commit ecd7c04834
2 changed files with 56 additions and 26 deletions

View file

@ -1,5 +1,9 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 0.9.6: Changes for 0.9.6:
*03/10/17:
* fbsetbg update from Han - new option to explicitly say
which wallpaper setting to use, plus minor changes
fbsetbg
*03/10/15: *03/10/15:
* Fix event manager target window (Simon) * Fix event manager target window (Simon)
-> Some events don't have the main window as xany.window -> Some events don't have the main window as xany.window

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.21 2003/10/08 14:00:47 rathnor Exp $ # $Id: fbsetbg,v 1.22 2003/10/16 15:54:20 rathnor 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
@ -34,6 +34,7 @@
# - don't use $(), use `` # - don't use $(), use ``
# - don't use ~, use ${HOME} # - don't use ~, use ${HOME}
# - don't use id -u, use whoami # - don't use id -u, use whoami
# - don't use echo -e
# - getopts won't work on all platforms, but the config-file can # - getopts won't work on all platforms, but the config-file can
# compensate for that. # compensate for that.
# - various software like grep/sed/perl may be not present or not # - various software like grep/sed/perl may be not present or not
@ -45,7 +46,7 @@
# _NET_CURRENT_DESKTOP # _NET_CURRENT_DESKTOP
# The wallpapersetter is selected in this order # The wallpapersetter is selected in this order
wpsetters='Esetroot wmsetbg feh chbg display qiv xv xsri xli xsetbg' # broken icewmbg' wpsetters=${wpsetters:=Esetroot wmsetbg feh chbg display qiv xv xsri xli xsetbg} # broken icewmbg'
lastwallpaper=${HOME}/.fluxbox/lastwallpaper lastwallpaper=${HOME}/.fluxbox/lastwallpaper
@ -58,8 +59,9 @@ command="`basename \"$0\"`"
# Functions # Functions
display_usage() { display_usage() {
cat << EOF cat << EOF
Usage: $command [ -fFcCtTaA /path/to/wallpaper ] [ -l ] [ -h ] [ -i ] [ -p ] Usage: $command [-u wallpapersetter] [-fFcCtTaA /path/to/wallpaper] [-l] [-h] [-i] [-p]
Use $command -h for a complete help message. Use $command -h for a complete help message.
EOF EOF
} }
@ -85,11 +87,20 @@ Options:
-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
-u Use specified wallpapersetter
Files: Files:
~/.fluxbox/lastwallpaper In this file the wallpaper you set ~/.fluxbox/lastwallpaper In this file the wallpaper you set
will be stored, for the -l option: will be stored, for the -l option:
Environment variables:
wpsetters Wallpapersetters to use.
example:
wpsetters=feh fbsetbg wallpaper.jpg
DISPLAY The display you want to set the wallpaper on.
example:
DISPLAY=:0.0 fbsetbg -l
EOF EOF
} }
@ -165,34 +176,27 @@ debugfbsetbg() {
exit 0 exit 0
} }
# Find the default wallpapersetter
for wpsetter in $wpsetters; do
if find_it $wpsetter; then
WPSETTER=$wpsetter
break
fi
done
standardrant=\
"$WPSETTER sets the 'wrong' wallpaper. Transparency for fluxbox and
apps like aterm and xchat won't work right with it. Consider installing
chbg, wmsetbg (from windowmaker) or Esetroot (from Eterm) and I'll use
them instead."
standardok=\
"$WPSETTER is a nice wallpapersetter. You won't have any problems."
unset debug
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
message "no options given" message "no options given"
display_help display_help
exit 1 exit 1
fi fi
unset debug
# Parse command-line options # Parse command-line options
while :; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
-u)
if find_it "$2"; then
wpsetters=$2
else
message "Couldn't find \"$2\" for wallpapersetter"
display_usage
exit 1
fi
shift 2 ;;
-d|-i) debug=true -d|-i) debug=true
break ;; break ;;
-a) option='$aspect' -a) option='$aspect'
@ -257,12 +261,29 @@ while :; do
display_usage display_usage
exit 1 exit 1
else else
wallpaper=$1
break break
fi fi
;; ;;
esac esac
done done
# Find the default wallpapersetter
for wpsetter in $wpsetters; do
if find_it $wpsetter; then
WPSETTER=$wpsetter
break
fi
done
standardrant=\
"$WPSETTER sets the 'wrong' wallpaper. Transparency for fluxbox and
apps like aterm and xchat won't work right with it. Consider installing
chbg, wmsetbg (from windowmaker) or Esetroot (from Eterm) and I'll use
them instead."
standardok=\
"$WPSETTER is a nice wallpapersetter. You won't have any problems."
case $WPSETTER in case $WPSETTER in
chbg) chbg)
@ -280,7 +301,7 @@ case $WPSETTER in
debugstory=$standardok debugstory=$standardok
;; ;;
display) display)
full="`xwininfo -root|grep geom` -window root" full="`xwininfo -root 2> /dev/null|grep geom` -window root"
tile='-window root' tile='-window root'
center='-backdrop -window root' center='-backdrop -window root'
aspect=$full aspect=$full
@ -359,17 +380,22 @@ if [ "$debug" = true ];then
fi fi
option=${option:='$full'} option=${option:='$full'}
wallpaper=${wallpaper:=$1}
if [ ! -r "$wallpaper" ]; then if [ ! -r "$wallpaper" ]; then
message "Can't find wallpaper $wallpaper" message "Can't find wallpaper $wallpaper"
exit 1 exit 1
fi fi
if [ -z "$DISPLAY" ];then
message "You are not connected to an X session\nPerhaps you should set the DISPLAY environment variable?"
exit 1
fi
$WPSETTER `eval echo $option` "$wallpaper" $WPSETTER `eval echo $option` "$wallpaper"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
message "Something went wrong while setting the wallpaper. message "Something went wrong while setting the wallpaper.
Run '$WPSETTER $option "$wallpaper"' from an xterm to find out what." Run '$WPSETTER "`eval echo $option` $wallpaper"' from an xterm to find out what."
exit 1 exit 1
fi fi