diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/fbsetbg | 64 |
1 files changed, 43 insertions, 21 deletions
diff --git a/util/fbsetbg b/util/fbsetbg index b31cb6f..bd285f5 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.23 2003/11/23 01:19:01 rathnor Exp $ | 26 | # $Id: fbsetbg,v 1.24 2003/12/08 19:31:40 fluxgen 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 |
@@ -59,8 +59,8 @@ command="`basename \"$0\"`" | |||
59 | # Functions | 59 | # Functions |
60 | display_usage() { | 60 | display_usage() { |
61 | cat << EOF | 61 | cat << EOF |
62 | Usage: $command [-u wallpapersetter] [-fFcCtTaA /path/to/wallpaper] [-l] [-h] [-i] [-p] | 62 | Usage: $command [-u/-U [wallpapersetter]] [-fFcCtTaA /path/to/wallpaper] [-l] [-h] [-i] [-p] |
63 | Use $command -h for a complete help message. | 63 | Use \`\`$command -h'' for a complete help message. |
64 | 64 | ||
65 | EOF | 65 | EOF |
66 | } | 66 | } |
@@ -77,8 +77,9 @@ Options: | |||
77 | -a Set maximized wallpaper, preserving aspect. | 77 | -a Set maximized wallpaper, preserving aspect. |
78 | ( if your bgsetter doesn't support this | 78 | ( if your bgsetter doesn't support this |
79 | we fall back to -f ) | 79 | we fall back to -f ) |
80 | -u Use specified wallpapersetter, use no argument to forget | ||
80 | 81 | ||
81 | -F,-C,-T,-A same as uncapsed but without remembering. | 82 | -F,-C,-T,-A,-U same as uncapsed but without remembering. |
82 | 83 | ||
83 | -h Display this help | 84 | -h Display this help |
84 | 85 | ||
@@ -87,7 +88,7 @@ Options: | |||
87 | -i Information about selected wallpaper command | 88 | -i Information about selected wallpaper command |
88 | -d (deprecated, use -i) Debug info | 89 | -d (deprecated, use -i) Debug info |
89 | -p Tips | 90 | -p Tips |
90 | -u Use specified wallpapersetter | 91 | |
91 | 92 | ||
92 | Files: | 93 | Files: |
93 | 94 | ||
@@ -120,7 +121,7 @@ Common tips to use with $command: | |||
120 | session.screen0.rootCommand: $command -l | 121 | session.screen0.rootCommand: $command -l |
121 | 122 | ||
122 | 3) Use $command -i to find out what wallpapersetter $command will be | 123 | 3) Use $command -i to find out what wallpapersetter $command will be |
123 | used and what I think about it. | 124 | used and what $command thinks about it. |
124 | 125 | ||
125 | EOF | 126 | EOF |
126 | } | 127 | } |
@@ -178,19 +179,37 @@ debugfbsetbg() { | |||
178 | 179 | ||
179 | if [ $# -eq 0 ]; then | 180 | if [ $# -eq 0 ]; then |
180 | message "no options given" | 181 | message "no options given" |
181 | display_help | 182 | display_usage |
182 | exit 1 | 183 | exit 1 |
183 | fi | 184 | fi |
184 | 185 | ||
185 | 186 | ||
186 | unset debug | 187 | unset debug setterfromcommandline |
187 | |||
188 | # Parse command-line options | 188 | # Parse command-line options |
189 | while [ $# -gt 0 ]; do | 189 | while [ $# -gt 0 ]; do |
190 | case "$1" in | 190 | case "$1" in |
191 | -u) | 191 | -u) |
192 | if find_it "$2"; then | 192 | if find_it "$2"; then |
193 | wpsetters=$2 | 193 | grep -v wpsetters $lastwallpaper > ${lastwallpaper}.tmp |
194 | echo "wpsetters $2" >> ${lastwallpaper}.tmp | ||
195 | mv ${lastwallpaper}.tmp $lastwallpaper | ||
196 | WPSETTER=$2 | ||
197 | setterfromcommandline=true | ||
198 | elif [ -z "$2" ]; then | ||
199 | grep -v wpsetters $lastwallpaper > ${lastwallpaper}.tmp | ||
200 | mv ${lastwallpaper}.tmp $lastwallpaper | ||
201 | message "wpsetter removed from historyfile" | ||
202 | exit 0 | ||
203 | else | ||
204 | message "Couldn't find \"$2\" for wallpapersetter" | ||
205 | display_usage | ||
206 | exit 1 | ||
207 | fi | ||
208 | shift 2 ;; | ||
209 | -U) | ||
210 | if find_it "$2"; then | ||
211 | WPSETTER=$2 | ||
212 | setterfromcommandline=true | ||
194 | else | 213 | else |
195 | message "Couldn't find \"$2\" for wallpapersetter" | 214 | message "Couldn't find \"$2\" for wallpapersetter" |
196 | display_usage | 215 | display_usage |
@@ -242,22 +261,22 @@ while [ $# -gt 0 ]; do | |||
242 | -p) display_tips ; exit 0 ;; | 261 | -p) display_tips ; exit 0 ;; |
243 | -h) display_help ; exit 0 ;; | 262 | -h) display_help ; exit 0 ;; |
244 | --) | 263 | --) |
245 | echo "$command doesn't recognize -- gnu-longopts." | 264 | message "$command doesn't recognize -- gnu-longopts." |
246 | echo 'Use $command -h for a help message.' | 265 | message 'Use $command -h for a help message.' |
247 | display_usage | 266 | display_usage |
248 | exit 1 ;; | 267 | exit 1 ;; |
249 | -*) | 268 | -*) |
250 | echo 1>&2 "$command: unrecognized option "\`"$1'" | 269 | message "unrecognized option "\`"$1'" |
251 | display_usage | 270 | display_usage |
252 | exit 1 | 271 | exit 1 |
253 | ;; | 272 | ;; |
254 | *) | 273 | *) |
255 | if [ ! -r "$1" ]; then | 274 | if [ ! -r "$1" ]; then |
256 | echo "$1 isn't an existing wallpaper or a valid option." >&2 | 275 | message "$1 isn't an existing wallpaper or a valid option." |
257 | display_usage | 276 | display_usage |
258 | exit 1 | 277 | exit 1 |
259 | elif [ -z "$1" ]; then | 278 | elif [ -z "$1" ]; then |
260 | message 'No wallpaper to set' >&2 | 279 | message 'No wallpaper to set' |
261 | display_usage | 280 | display_usage |
262 | exit 1 | 281 | exit 1 |
263 | else | 282 | else |
@@ -269,12 +288,15 @@ while [ $# -gt 0 ]; do | |||
269 | done | 288 | done |
270 | 289 | ||
271 | # Find the default wallpapersetter | 290 | # Find the default wallpapersetter |
272 | for wpsetter in $wpsetters; do | 291 | if [ "$setterfromcommandline" != true ]; then |
273 | if find_it $wpsetter; then | 292 | wpsetters="`awk '/wpsetters/ {print $2}' $lastwallpaper` $wpsetters" |
274 | WPSETTER=$wpsetter | 293 | for wpsetter in $wpsetters; do |
275 | break | 294 | if find_it $wpsetter; then |
276 | fi | 295 | WPSETTER=$wpsetter |
277 | done | 296 | break |
297 | fi | ||
298 | done | ||
299 | fi | ||
278 | 300 | ||
279 | standardrant=\ | 301 | standardrant=\ |
280 | "$WPSETTER sets the 'wrong' wallpaper. Transparency for fluxbox and | 302 | "$WPSETTER sets the 'wrong' wallpaper. Transparency for fluxbox and |