diff options
author | rathnor <rathnor> | 2003-10-16 15:54:20 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-10-16 15:54:20 (GMT) |
commit | ecd7c0483412088f64eda8b34d19e0f4b8afc86e (patch) | |
tree | bc49ef2a4fa6be22ddeb48261a54d6d95049bb3f /util/fbsetbg | |
parent | bc758923755eff4ffe02c3a5d5234ec7e79777fd (diff) | |
download | fluxbox-ecd7c0483412088f64eda8b34d19e0f4b8afc86e.zip fluxbox-ecd7c0483412088f64eda8b34d19e0f4b8afc86e.tar.bz2 |
fbsetbg update from han
Diffstat (limited to 'util/fbsetbg')
-rw-r--r-- | util/fbsetbg | 78 |
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 |
48 | wpsetters='Esetroot wmsetbg feh chbg display qiv xv xsri xli xsetbg' # broken icewmbg' | 49 | wpsetters=${wpsetters:=Esetroot wmsetbg feh chbg display qiv xv xsri xli xsetbg} # broken icewmbg' |
49 | lastwallpaper=${HOME}/.fluxbox/lastwallpaper | 50 | lastwallpaper=${HOME}/.fluxbox/lastwallpaper |
50 | 51 | ||
51 | 52 | ||
@@ -58,8 +59,9 @@ command="`basename \"$0\"`" | |||
58 | # Functions | 59 | # Functions |
59 | display_usage() { | 60 | display_usage() { |
60 | cat << EOF | 61 | cat << EOF |
61 | Usage: $command [ -fFcCtTaA /path/to/wallpaper ] [ -l ] [ -h ] [ -i ] [ -p ] | 62 | Usage: $command [-u wallpapersetter] [-fFcCtTaA /path/to/wallpaper] [-l] [-h] [-i] [-p] |
62 | Use $command -h for a complete help message. | 63 | Use $command -h for a complete help message. |
64 | |||
63 | EOF | 65 | EOF |
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 | ||
89 | Files: | 92 | Files: |
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: |
96 | Environment 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 | ||
94 | EOF | 105 | EOF |
95 | } | 106 | } |
@@ -165,34 +176,27 @@ debugfbsetbg() { | |||
165 | exit 0 | 176 | exit 0 |
166 | } | 177 | } |
167 | 178 | ||
168 | # Find the default wallpapersetter | ||
169 | for wpsetter in $wpsetters; do | ||
170 | if find_it $wpsetter; then | ||
171 | WPSETTER=$wpsetter | ||
172 | break | ||
173 | fi | ||
174 | done | ||
175 | |||
176 | standardrant=\ | ||
177 | "$WPSETTER sets the 'wrong' wallpaper. Transparency for fluxbox and | ||
178 | apps like aterm and xchat won't work right with it. Consider installing | ||
179 | chbg, wmsetbg (from windowmaker) or Esetroot (from Eterm) and I'll use | ||
180 | them instead." | ||
181 | |||
182 | standardok=\ | ||
183 | "$WPSETTER is a nice wallpapersetter. You won't have any problems." | ||
184 | |||
185 | unset debug | ||
186 | |||
187 | if [ $# -eq 0 ]; then | 179 | if [ $# -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 |
191 | fi | 183 | fi |
192 | 184 | ||
185 | |||
186 | unset debug | ||
187 | |||
193 | # Parse command-line options | 188 | # Parse command-line options |
194 | while :; do | 189 | while [ $# -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 |
264 | done | 269 | done |
265 | 270 | ||
271 | # Find the default wallpapersetter | ||
272 | for wpsetter in $wpsetters; do | ||
273 | if find_it $wpsetter; then | ||
274 | WPSETTER=$wpsetter | ||
275 | break | ||
276 | fi | ||
277 | done | ||
278 | |||
279 | standardrant=\ | ||
280 | "$WPSETTER sets the 'wrong' wallpaper. Transparency for fluxbox and | ||
281 | apps like aterm and xchat won't work right with it. Consider installing | ||
282 | chbg, wmsetbg (from windowmaker) or Esetroot (from Eterm) and I'll use | ||
283 | them instead." | ||
284 | |||
285 | standardok=\ | ||
286 | "$WPSETTER is a nice wallpapersetter. You won't have any problems." | ||
266 | 287 | ||
267 | case $WPSETTER in | 288 | case $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 | |||
359 | fi | 380 | fi |
360 | 381 | ||
361 | option=${option:='$full'} | 382 | option=${option:='$full'} |
362 | wallpaper=${wallpaper:=$1} | ||
363 | 383 | ||
364 | if [ ! -r "$wallpaper" ]; then | 384 | if [ ! -r "$wallpaper" ]; then |
365 | message "Can't find wallpaper $wallpaper" | 385 | message "Can't find wallpaper $wallpaper" |
366 | exit 1 | 386 | exit 1 |
367 | fi | 387 | fi |
368 | 388 | ||
389 | if [ -z "$DISPLAY" ];then | ||
390 | message "You are not connected to an X session\nPerhaps you should set the DISPLAY environment variable?" | ||
391 | exit 1 | ||
392 | fi | ||
393 | |||
394 | |||
369 | $WPSETTER `eval echo $option` "$wallpaper" | 395 | $WPSETTER `eval echo $option` "$wallpaper" |
370 | if [ $? -ne 0 ]; then | 396 | if [ $? -ne 0 ]; then |
371 | message "Something went wrong while setting the wallpaper. | 397 | message "Something went wrong while setting the wallpaper. |
372 | Run '$WPSETTER $option "$wallpaper"' from an xterm to find out what." | 398 | Run '$WPSETTER "`eval echo $option` $wallpaper"' from an xterm to find out what." |
373 | exit 1 | 399 | exit 1 |
374 | fi | 400 | fi |
375 | 401 | ||