all repos — fluxbox @ ecd7c0483412088f64eda8b34d19e0f4b8afc86e

custom fork of the fluxbox windowmanager

fbsetbg update from han
rathnor rathnor
commit

ecd7c0483412088f64eda8b34d19e0f4b8afc86e

parent

bc758923755eff4ffe02c3a5d5234ec7e79777fd

2 files changed, 56 insertions(+), 26 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,9 @@

(Format: Year/Month/Day) 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: * Fix event manager target window (Simon) -> Some events don't have the main window as xany.window
M util/fbsetbgutil/fbsetbg

@@ -23,7 +23,7 @@ # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,

# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # 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: # To guarantee this script works on all platforms that support fluxbox

@@ -34,6 +34,7 @@ # - don't use [ -e file ] use [ -r file ]

# - don't use $(), use `` # - don't use ~, use ${HOME} # - don't use id -u, use whoami +# - don't use echo -e # - getopts won't work on all platforms, but the config-file can # compensate for that. # - various software like grep/sed/perl may be not present or not

@@ -45,7 +46,7 @@ # TODO purheps: xprop -root _WIN_WORKSPACE

# _NET_CURRENT_DESKTOP # 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

@@ -58,8 +59,9 @@

# Functions display_usage() { 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. + EOF }

@@ -85,11 +87,20 @@

-i Information about selected wallpaper command -d (deprecated, use -i) Debug info -p Tips + -u Use specified wallpapersetter Files: ~/.fluxbox/lastwallpaper In this file the wallpaper you set 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 }

@@ -165,34 +176,27 @@ echo

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 message "no options given" display_help exit 1 fi + + +unset debug # Parse command-line options -while :; do +while [ $# -gt 0 ]; do 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 break ;; -a) option='$aspect'

@@ -257,12 +261,29 @@ message 'No wallpaper to set' >&2

display_usage exit 1 else + wallpaper=$1 break fi ;; esac 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 chbg)

@@ -280,7 +301,7 @@ aspect='--center-x --center-y --scale-width=100 --scale-height=100 --keep-aspect --color=black'

debugstory=$standardok ;; display) - full="`xwininfo -root|grep geom` -window root" + full="`xwininfo -root 2> /dev/null|grep geom` -window root" tile='-window root' center='-backdrop -window root' aspect=$full

@@ -359,17 +380,22 @@ exit 0

fi option=${option:='$full'} -wallpaper=${wallpaper:=$1} if [ ! -r "$wallpaper" ]; then message "Can't find wallpaper $wallpaper" exit 1 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" if [ $? -ne 0 ]; then 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 fi