X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fbsetbg;h=e1d18824f6ab3b7d8bccc6eb475430ecf548c60d;hb=97019b8b77f7e6450d87b057bcb6eae43e9f3e2b;hp=8e01b0e82d14c7366dae5cf4e2ed9507d1be8e99;hpb=f7ace0fad8ddfc2cfc9e3a127ff00c6338958078;p=chaz%2Fopenbox diff --git a/util/bsetbg b/util/bsetbg index 8e01b0e8..e1d18824 100644 --- a/util/bsetbg +++ b/util/bsetbg @@ -22,7 +22,7 @@ PATH=$PATH:/usr/bin:/usr/local/bin:/usr/X11R6/bin -img_apps="qiv xli xv wmsetbg Esetroot display xsetbg" +img_apps="display xli xsetbg Esetroot qiv wmsetbg xv" display_full_cmd="display -geometry 800x600 -window root" display_tile_cmd="display -window root" @@ -54,7 +54,7 @@ xli_tile_cmd="xli -onroot -quiet" xli_center_cmd="xli -center -onroot quiet" xli_default_cmd="$xli_center_cmd" -xsetbg_full_cmd="xsetbg -fillscreen" +xsetbg_full_cmd="xsetbg -fullscreen" xsetbg_tile_cmd="xsetbg" xsetbg_center_cmd="xsetbg -center" xsetbg_default_cmd="$xsetbg_center_cmd" @@ -62,12 +62,13 @@ xsetbg_default_cmd="$xsetbg_center_cmd" ################################## me=${0##*/} -version=2.1 +version=2.2 copyright="(c) 2000-$(date +%Y) by Timothy M. King (http://lordzork.com/)" config=$HOME/.bsetbgrc last_cmd_file=$HOME/.bsetbg_last_cmd refresh_cmd=xrefresh p=$me: +#debug=echo quit() { @@ -76,8 +77,7 @@ quit() exit ${rc:-0} } -bool() -{ +bool() { case $1 in [yY][eE][sS]|1|[yY]|[tT][rR][uU][eE]|[oO][nN]) : ;; *) return 1 ;; @@ -107,18 +107,21 @@ $me $version $copyright -full stretch an image to fill the desktop -exec specify an external command to execute + -app specify the image application to use -post arguments to be passed to the post-command -debug prints commands without executing them -EOF - # this is extremely lame, but probably more portable than grep -E - bsetroot_help=$(bsetroot -help 2>&1| grep -v "^bsetroot" | grep -v "^ -help") - case $bsetroot_help in - BaseDisplay*) echo ;; - *-gradient*) echo "$bsetroot_help" - esac + -display use display connection + -mod modula pattern + -foreground, -fg modula foreground color + -background, -bg modula background color + + -gradient gradient texture + -from gradient start color + -to gradient end color + + -solid solid color - cat < generate a config file -help this message -version output version information @@ -382,7 +385,9 @@ check_no_exec() post_command() { - if [ -n "$POST_COMMAND" -a "$rc" -le 0 ]; then + bool $noconfig || read_config + + if [ -n "$POST_COMMAND" -a "$1" = 0 ]; then if [ -n "$debug" ]; then $debug "running post_command: $POST_COMMAND $post_args" else @@ -422,7 +427,9 @@ check_cmd() command=${2:-$1}; eval ${3:-${2:-$1}}=1 elif bool $do_post; then add_post_arg ${1} - else + elif [ "$command" = do_exec ]; then + do_exec=1 + elif [ "$command" != do_bsetroot ]; then finished=1 fi } @@ -433,7 +440,7 @@ parse_args() -d|*-debug|d) unset refresh_cmd; debug=echo\ $me\_debug: ;; - -p|-*-post|p) + -p|*-post|p) unset finished do_standard do_exec; do_post=1 ;; -c|*-center|c|-t|*-tile*|t|-f|*-full|f) @@ -451,7 +458,7 @@ parse_args() esac ;; -a|*-app|a|-e|*-exec|e) - check_cmd "do_exec" ;; + command=do_exec; check_cmd ;; -mod|-gradient|-solid|-display) check_cmd "do_bsetroot" && add_arg $1 ;; @@ -493,7 +500,7 @@ done [ "$debug" ] && echo -$command $args -post_command $rc +$debug $command $args +post_command ${rc:-0} quit $rc