diff options
author | rathnor <rathnor> | 2003-04-29 11:26:34 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-04-29 11:26:34 (GMT) |
commit | 89eace13d6f7bd7ca2fbd47858a6b653d689c5e4 (patch) | |
tree | 8ba5cc5ffb1270f225481ba24923e14f2e3b4bcb /util/fbsetbg | |
parent | d90ab7cf316db544581389a6be367761911be3ae (diff) | |
download | fluxbox_lack-89eace13d6f7bd7ca2fbd47858a6b653d689c5e4.zip fluxbox_lack-89eace13d6f7bd7ca2fbd47858a6b653d689c5e4.tar.bz2 |
- Fixed relative path bug
- Simpler structure.
Diffstat (limited to 'util/fbsetbg')
-rw-r--r-- | util/fbsetbg | 111 |
1 files changed, 36 insertions, 75 deletions
diff --git a/util/fbsetbg b/util/fbsetbg index be7b093..0aa0a31 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.2 2003/04/28 14:45:13 fluxgen Exp $ | 26 | # $Id: fbsetbg,v 1.3 2003/04/29 11:26:34 rathnor Exp $ |
27 | 27 | ||
28 | # | 28 | # |
29 | # Portability notes: | 29 | # Portability notes: |
@@ -38,9 +38,10 @@ | |||
38 | # compensate for that. | 38 | # compensate for that. |
39 | # | 39 | # |
40 | 40 | ||
41 | wpsetters='wmsetbg Esetroot xli xsetbg display qiv xv xsri' | 41 | wpsetters='Esetroot wmsetbg display qiv xv xsri xli xsetbg' |
42 | lastwallpaper=${HOME}/.fluxbox/lastwallpaper | 42 | lastwallpaper=${HOME}/.fluxbox/lastwallpaper |
43 | 43 | ||
44 | |||
44 | WHOAMI=`whoami` | 45 | WHOAMI=`whoami` |
45 | [ "$WHOAMI" = "root" ] && PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin | 46 | [ "$WHOAMI" = "root" ] && PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin |
46 | 47 | ||
@@ -82,7 +83,7 @@ EOF | |||
82 | display_tips(){ | 83 | display_tips(){ |
83 | cat<<EOF | 84 | cat<<EOF |
84 | 85 | ||
85 | To replace all occurances of bsetbg in a file use this command: | 86 | To replace all occurrences of bsetbg in a file use this command: |
86 | 87 | ||
87 | perl -pi -e 's,([^f]|^)bsetbg,fbsetbg,' | 88 | perl -pi -e 's,([^f]|^)bsetbg,fbsetbg,' |
88 | 89 | ||
@@ -114,76 +115,21 @@ message() { | |||
114 | } | 115 | } |
115 | 116 | ||
116 | remembercommand() { | 117 | remembercommand() { |
117 | echo $option > $lastwallpaper | 118 | #if the $wallpaper path is absolute |
118 | echo $wallpaper >> $lastwallpaper | 119 | echo $option > $lastwallpaper |
120 | case $wallpaper in | ||
121 | /*) echo $wallpaper >> $lastwallpaper ;; | ||
122 | *) echo $PWD/$wallpaper >> $lastwallpaper ;; | ||
123 | esac | ||
119 | } | 124 | } |
120 | 125 | ||
121 | debugfbsetbg (){ | 126 | debugfbsetbg (){ |
122 | 127 | echo | |
123 | standardrant (){ | 128 | echo $debugstory |
124 | cat <<EOF | 129 | echo |
125 | |||
126 | $WPSETTER sets the 'wrong' wallpaper. transparant apps like aterm and | ||
127 | xchat wont work right with it. Consider using wmsetbg (from windowmaker) | ||
128 | or Esetroot (from Eterm) | ||
129 | |||
130 | EOF | ||
131 | } | ||
132 | |||
133 | for wpsetter in $wpsetters; do | ||
134 | if find_it $wpsetter; then | ||
135 | WPSETTER=$wpsetter | ||
136 | break | ||
137 | fi | ||
138 | done | ||
139 | |||
140 | case $WPSETTER in | ||
141 | xsri) | ||
142 | echo "This is a RedHat specific app. I can't find docs about it." | ||
143 | ;; | ||
144 | display) | ||
145 | standardrant | ||
146 | ;; | ||
147 | Esetroot) | ||
148 | echo 'Esetroot is a nice app :)' | ||
149 | echo "You won't have any problems." | ||
150 | ;; | ||
151 | wmsetbg) | ||
152 | echo 'wmsetbg is my favourite :)' | ||
153 | echo "You won't have any problems." | ||
154 | ;; | ||
155 | xsetbg) | ||
156 | standardrant | ||
157 | echo 'Is actually xli' | ||
158 | echo 'fillscreen option (-f) is broken, defaults to (-a)' | ||
159 | ;; | ||
160 | xli) | ||
161 | standardrant | ||
162 | echo 'fillscreen option (-f) is broken, defaults to (-a)' | ||
163 | ;; | ||
164 | qiv) | ||
165 | standardrant | ||
166 | ;; | ||
167 | xv) | ||
168 | standardrant | ||
169 | ;; | ||
170 | '') | ||
171 | cat <<EOF | ||
172 | |||
173 | I Can't find and app to set the wallpaper with. You can install one in | ||
174 | many many ways but I will give you some simple advice: install Eterm and | ||
175 | your set. Eterm provides Esetroot and thats a great wallpapersetter. I | ||
176 | recommend you install the package provided by your distro. | ||
177 | |||
178 | EOF | ||
179 | esac | ||
180 | exit 0 | 130 | exit 0 |
181 | } | 131 | } |
182 | 132 | ||
183 | if [ $1 = -d ];then | ||
184 | debugfbsetbg | ||
185 | fi | ||
186 | |||
187 | # Find the default wallpapersetter | 133 | # Find the default wallpapersetter |
188 | # The precise order is up for debate. | 134 | # The precise order is up for debate. |
189 | for wpsetter in $wpsetters; do | 135 | for wpsetter in $wpsetters; do |
@@ -193,79 +139,93 @@ for wpsetter in $wpsetters; do | |||
193 | fi | 139 | fi |
194 | done | 140 | done |
195 | 141 | ||
142 | standardrant="$WPSETTER sets the 'wrong' wallpaper. Transparant apps like aterm and | ||
143 | xchat won't work right with it. Consider using wmsetbg (from windowmaker) | ||
144 | or Esetroot (from Eterm)" | ||
145 | |||
196 | case $WPSETTER in | 146 | case $WPSETTER in |
197 | xsri) | 147 | xsri) |
198 | full='--center-x --center-y --scale-width=100 --scale-width=100' | 148 | full='--center-x --center-y --scale-width=100 --scale-width=100' |
199 | tile='--tile' | 149 | tile='--tile' |
200 | center='--center-x --center-y' | 150 | center='--center-x --center-y' |
201 | aspect=$full | 151 | aspect=$full |
152 | debugstory="This is a RedHat specific app. I can't find docs about it." | ||
202 | ;; | 153 | ;; |
203 | display) | 154 | display) |
204 | full='`xwininfo -root|grep geom` -window root' | 155 | full='`xwininfo -root|grep geom` -window root' |
205 | tile='-window root' | 156 | tile='-window root' |
206 | center='-backdrop -window root' | 157 | center='-backdrop -window root' |
207 | aspect=$full | 158 | aspect=$full |
159 | debugstory=$standardrant | ||
208 | ;; | 160 | ;; |
209 | Esetroot) | 161 | Esetroot) |
210 | full='-scale' | 162 | full='-scale' |
211 | tile='' | 163 | tile='' |
212 | center='-c' | 164 | center='-c' |
213 | aspect='-fit' | 165 | aspect='-fit' |
166 | debugstory="Esetroot is a nice app. You won't have any problems." | ||
214 | ;; | 167 | ;; |
215 | wmsetbg) | 168 | wmsetbg) |
216 | full='-s -S' | 169 | full='-s -S' |
217 | tile='-t' | 170 | tile='-t' |
218 | center='-b black -e' | 171 | center='-b black -e' |
219 | aspect='-b black -a' | 172 | aspect='-b black -a' |
173 | debugstory="wmsetbg is a nice app. You won't have any problems." | ||
220 | ;; | 174 | ;; |
221 | xsetbg) | 175 | xsetbg) |
222 | tile='-border black' | 176 | tile='-border black' |
223 | center='-center -border black' | 177 | center='-center -border black' |
224 | aspect='-fullscreen -border black' | 178 | aspect='-fullscreen -border black' |
225 | full=$aspect #broken | 179 | full=$aspect #broken |
180 | debugstory="xsetbg is actually xli. The fillscreen option (-f) is broken, defaults to (-a). $standardrant" | ||
226 | ;; | 181 | ;; |
227 | xli) | 182 | xli) |
228 | tile='-onroot -quiet -border black' | 183 | tile='-onroot -quiet -border black' |
229 | center='-center -onroot -quiet -border black' | 184 | center='-center -onroot -quiet -border black' |
230 | aspect='-fullscreen -onroot -quiet -border black' | 185 | aspect='-fullscreen -onroot -quiet -border black' |
231 | full=$aspect #broken | 186 | full=$aspect #broken |
187 | debugstory='The fillscreen option (-f) is broken, defaults to (-a). $standardrant' | ||
232 | ;; | 188 | ;; |
233 | qiv) | 189 | qiv) |
234 | full='--root_s' | 190 | full='--root_s' |
235 | tile='--root_t' | 191 | tile='--root_t' |
236 | center='--root' | 192 | center='--root' |
237 | aspect='-m --root' | 193 | aspect='-m --root' |
194 | debugstory=$standardrant | ||
238 | ;; | 195 | ;; |
239 | xv) | 196 | xv) |
240 | full='-max -smooth -root -quit' | 197 | full='-max -smooth -root -quit' |
241 | tile='-root -quit' | 198 | tile='-root -quit' |
242 | center='-rmode 5 -root -quit' | 199 | center='-rmode 5 -root -quit' |
243 | aspect='-maxpect -smooth -root -quit' | 200 | aspect='-maxpect -smooth -root -quit' |
201 | debugstory=$standardrant | ||
244 | ;; | 202 | ;; |
245 | '') | 203 | '') |
246 | message "Can't find and app to set the wallpaper with. | 204 | message "I can't find an app to set the wallpaper with. You can install one in |
247 | Use fbsetbg -d to find out what to do next" | 205 | many many ways but I will give you some simple advice: install Eterm and |
248 | exit 1 | 206 | you're set. Eterm provides Esetroot and thats a great wallpaper setter. I |
207 | recommend you install the package provided by your distro." | ||
208 | exit 1 | ||
209 | ;; | ||
249 | esac | 210 | esac |
250 | 211 | ||
251 | #Get options. | 212 | #Get options. |
252 | getopts ":a:f:c:t:Tlh-" COMMAND_LINE_ARGUMENT | 213 | getopts ":a:f:c:t:Tdlh-" COMMAND_LINE_ARGUMENT |
253 | case "${COMMAND_LINE_ARGUMENT}" in | 214 | case "${COMMAND_LINE_ARGUMENT}" in |
215 | d) debugfbsetbg | ||
216 | exit 0 | ||
217 | ;; | ||
254 | a) option=$aspect | 218 | a) option=$aspect |
255 | wallpaper=$OPTARG | 219 | wallpaper=$OPTARG |
256 | remembercommand | ||
257 | ;; | 220 | ;; |
258 | f) option=$full | 221 | f) option=$full |
259 | wallpaper=$OPTARG | 222 | wallpaper=$OPTARG |
260 | remembercommand | ||
261 | ;; | 223 | ;; |
262 | c) option=$center | 224 | c) option=$center |
263 | wallpaper=$OPTARG | 225 | wallpaper=$OPTARG |
264 | remembercommand | ||
265 | ;; | 226 | ;; |
266 | t) option=$tile | 227 | t) option=$tile |
267 | wallpaper=$OPTARG | 228 | wallpaper=$OPTARG |
268 | remembercommand | ||
269 | ;; | 229 | ;; |
270 | l) | 230 | l) |
271 | if [ -r $lastwallpaper ];then | 231 | if [ -r $lastwallpaper ];then |
@@ -300,3 +260,4 @@ fi | |||
300 | $WPSETTER $option "$wallpaper" || message "Something went wrong while setting the wallpaper | 260 | $WPSETTER $option "$wallpaper" || message "Something went wrong while setting the wallpaper |
301 | Run '$WPSETTER $option "$wallpaper"' from an xterm to find out what." | 261 | Run '$WPSETTER $option "$wallpaper"' from an xterm to find out what." |
302 | #remember previous wallpaper | 262 | #remember previous wallpaper |
263 | remembercommand | ||