aboutsummaryrefslogtreecommitdiff
path: root/util/fbsetbg
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-10-16 15:54:20 (GMT)
committerrathnor <rathnor>2003-10-16 15:54:20 (GMT)
commitecd7c0483412088f64eda8b34d19e0f4b8afc86e (patch)
treebc49ef2a4fa6be22ddeb48261a54d6d95049bb3f /util/fbsetbg
parentbc758923755eff4ffe02c3a5d5234ec7e79777fd (diff)
downloadfluxbox-ecd7c0483412088f64eda8b34d19e0f4b8afc86e.zip
fluxbox-ecd7c0483412088f64eda8b34d19e0f4b8afc86e.tar.bz2
fbsetbg update from han
Diffstat (limited to 'util/fbsetbg')
-rw-r--r--util/fbsetbg78
1 files changed, 52 insertions, 26 deletions
diff --git a/util/fbsetbg b/util/fbsetbg
index fccf90b..b747e30 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.21 2003/10/08 14:00:47 rathnor Exp $ 26# $Id: fbsetbg,v 1.22 2003/10/16 15:54:20 rathnor Exp $
27 27
28# Portability notes: 28# Portability notes:
29# To guarantee this script works on all platforms that support fluxbox 29# To guarantee this script works on all platforms that support fluxbox
@@ -34,6 +34,7 @@
34# - don't use $(), use `` 34# - don't use $(), use ``
35# - don't use ~, use ${HOME} 35# - don't use ~, use ${HOME}
36# - don't use id -u, use whoami 36# - don't use id -u, use whoami
37# - don't use echo -e
37# - getopts won't work on all platforms, but the config-file can 38# - getopts won't work on all platforms, but the config-file can
38# compensate for that. 39# compensate for that.
39# - various software like grep/sed/perl may be not present or not 40# - various software like grep/sed/perl may be not present or not
@@ -45,7 +46,7 @@
45# _NET_CURRENT_DESKTOP 46# _NET_CURRENT_DESKTOP
46 47
47# The wallpapersetter is selected in this order 48# The wallpapersetter is selected in this order
48wpsetters='Esetroot wmsetbg feh chbg display qiv xv xsri xli xsetbg' # broken icewmbg' 49wpsetters=${wpsetters:=Esetroot wmsetbg feh chbg display qiv xv xsri xli xsetbg} # broken icewmbg'
49lastwallpaper=${HOME}/.fluxbox/lastwallpaper 50lastwallpaper=${HOME}/.fluxbox/lastwallpaper
50 51
51 52
@@ -58,8 +59,9 @@ command="`basename \"$0\"`"
58# Functions 59# Functions
59display_usage() { 60display_usage() {
60 cat << EOF 61 cat << EOF
61Usage: $command [ -fFcCtTaA /path/to/wallpaper ] [ -l ] [ -h ] [ -i ] [ -p ] 62Usage: $command [-u wallpapersetter] [-fFcCtTaA /path/to/wallpaper] [-l] [-h] [-i] [-p]
62Use $command -h for a complete help message. 63Use $command -h for a complete help message.
64
63EOF 65EOF
64} 66}
65 67
@@ -85,11 +87,20 @@ Options:
85 -i Information about selected wallpaper command 87 -i Information about selected wallpaper command
86 -d (deprecated, use -i) Debug info 88 -d (deprecated, use -i) Debug info
87 -p Tips 89 -p Tips
90 -u Use specified wallpapersetter
88 91
89Files: 92Files:
90 93
91 ~/.fluxbox/lastwallpaper In this file the wallpaper you set 94 ~/.fluxbox/lastwallpaper In this file the wallpaper you set
92 will be stored, for the -l option: 95 will be stored, for the -l option:
96Environment variables:
97 wpsetters Wallpapersetters to use.
98 example:
99 wpsetters=feh fbsetbg wallpaper.jpg
100
101 DISPLAY The display you want to set the wallpaper on.
102 example:
103 DISPLAY=:0.0 fbsetbg -l
93 104
94EOF 105EOF
95} 106}
@@ -165,34 +176,27 @@ debugfbsetbg() {
165 exit 0 176 exit 0
166} 177}
167 178
168# Find the default wallpapersetter
169for wpsetter in $wpsetters; do
170 if find_it $wpsetter; then
171 WPSETTER=$wpsetter
172 break
173 fi
174done
175
176standardrant=\
177"$WPSETTER sets the 'wrong' wallpaper. Transparency for fluxbox and
178apps like aterm and xchat won't work right with it. Consider installing
179chbg, wmsetbg (from windowmaker) or Esetroot (from Eterm) and I'll use
180them instead."
181
182standardok=\
183"$WPSETTER is a nice wallpapersetter. You won't have any problems."
184
185unset debug
186
187if [ $# -eq 0 ]; then 179if [ $# -eq 0 ]; then
188 message "no options given" 180 message "no options given"
189 display_help 181 display_help
190 exit 1 182 exit 1
191fi 183fi
192 184
185
186unset debug
187
193# Parse command-line options 188# Parse command-line options
194while :; do 189while [ $# -gt 0 ]; do
195 case "$1" in 190 case "$1" in
191 -u)
192 if find_it "$2"; then
193 wpsetters=$2
194 else
195 message "Couldn't find \"$2\" for wallpapersetter"
196 display_usage
197 exit 1
198 fi
199 shift 2 ;;
196 -d|-i) debug=true 200 -d|-i) debug=true
197 break ;; 201 break ;;
198 -a) option='$aspect' 202 -a) option='$aspect'
@@ -257,12 +261,29 @@ while :; do
257 display_usage 261 display_usage
258 exit 1 262 exit 1
259 else 263 else
264 wallpaper=$1
260 break 265 break
261 fi 266 fi
262 ;; 267 ;;
263 esac 268 esac
264done 269done
265 270
271# Find the default wallpapersetter
272for wpsetter in $wpsetters; do
273 if find_it $wpsetter; then
274 WPSETTER=$wpsetter
275 break
276 fi
277done
278
279standardrant=\
280"$WPSETTER sets the 'wrong' wallpaper. Transparency for fluxbox and
281apps like aterm and xchat won't work right with it. Consider installing
282chbg, wmsetbg (from windowmaker) or Esetroot (from Eterm) and I'll use
283them instead."
284
285standardok=\
286"$WPSETTER is a nice wallpapersetter. You won't have any problems."
266 287
267case $WPSETTER in 288case $WPSETTER in
268 chbg) 289 chbg)
@@ -280,7 +301,7 @@ case $WPSETTER in
280 debugstory=$standardok 301 debugstory=$standardok
281 ;; 302 ;;
282 display) 303 display)
283 full="`xwininfo -root|grep geom` -window root" 304 full="`xwininfo -root 2> /dev/null|grep geom` -window root"
284 tile='-window root' 305 tile='-window root'
285 center='-backdrop -window root' 306 center='-backdrop -window root'
286 aspect=$full 307 aspect=$full
@@ -359,17 +380,22 @@ if [ "$debug" = true ];then
359fi 380fi
360 381
361option=${option:='$full'} 382option=${option:='$full'}
362wallpaper=${wallpaper:=$1}
363 383
364if [ ! -r "$wallpaper" ]; then 384if [ ! -r "$wallpaper" ]; then
365 message "Can't find wallpaper $wallpaper" 385 message "Can't find wallpaper $wallpaper"
366 exit 1 386 exit 1
367fi 387fi
368 388
389if [ -z "$DISPLAY" ];then
390 message "You are not connected to an X session\nPerhaps you should set the DISPLAY environment variable?"
391 exit 1
392fi
393
394
369$WPSETTER `eval echo $option` "$wallpaper" 395$WPSETTER `eval echo $option` "$wallpaper"
370if [ $? -ne 0 ]; then 396if [ $? -ne 0 ]; then
371 message "Something went wrong while setting the wallpaper. 397 message "Something went wrong while setting the wallpaper.
372Run '$WPSETTER $option "$wallpaper"' from an xterm to find out what." 398Run '$WPSETTER "`eval echo $option` $wallpaper"' from an xterm to find out what."
373 exit 1 399 exit 1
374fi 400fi
375 401