3 # make-theme.sh for fbsplash-themes-arch-banner #
5 author_name
="Kurt J. Bosch"
6 author_email
="kjb-temp-2009 at alpenjodel.de"
8 # Distributed under the terms of the GNU General Public License #
14 flavour style color verbose_flavour
18 version url theme_license
21 if (( $# < ${#arg_names[@]} + 1 )); then
22 echo "Usage: ${0##*/} ${arg_names[*]} screen-size..." >&2
26 for var
in ${arg_names[@]}; do
27 read -r $var < <( echo "$1" )
34 logo_file
=archlinux-
${flavour}-${style}.png
36 description
="Theme with ArchLinux logo '${flavour}-${style}' and customizable services-icons"
38 # separator images dimensions
41 # width of the vertical progress bar
45 echo "${0##*/}: $*" >&2
54 [[ -f $1 ]] && return 0
56 err
"File not found: '$1'"
59 png_args
="-define png:color-type=6" # png:bit-depth=8"
62 # aligned to appear below makepkg msg2()
68 [[ -f images
/$file_name ]] && return 0
70 _msg images
/"$file_name"
72 convert
$png_args -depth 8 -background none \
73 /usr
/share
/archlinux
/logos
/"${file_name/%.*/.svg}" -trim +repage \
77 # make separator line images
79 local file_name
=$1 color_1
=$2 color_2
=$3
80 [[ -f images
/$file_name ]] && return 0
82 _msg images
/"$file_name"
84 convert
$png_args -type TrueColorMatte
-depth 8 \
86 $(( separator_w ))x$(( separator_h ))" xc
:black \
87 -fill "${color_1}" \
-draw "rectangle \
89 $(( separator_w - 2 )),$(( separator_h ))" \
90 -fill "${color_2}" -draw "line \
91 $(( 0 )),$(( separator_h/2 )) \
92 $(( separator_w )),$(( separator_h/2 ))" \
99 # make services placeholder icon
100 local file_name
=dummy.png
101 if ! [[ -f images
/$file_name ]]; then
102 _msg images
/"$file_name"
103 convert
$png_args -type TrueColorMatte
-depth 8 -size 1x1 xc
:transparent \
107 # make black (background) services icons cover
108 local file_name
=cover.png
109 if ! [[ -f images
/$file_name ]]; then
110 _msg images
/"$file_name"
111 convert
$png_args -type TrueColorMatte
-depth 8 -size ${icon_size}x
${icon_size} \
112 xc
:black
-fill black
-draw 'color 0,0 reset' \
116 # make semi transparent services icons cover
117 local file_name
=cover-a50.png
118 if ! [[ -f images
/$file_name ]]; then
119 _msg images
/"$file_name"
120 convert
$png_args -type TrueColorMatte
-depth 8 -size ${icon_size}x
${icon_size} \
121 xc
:transparent
-fill 'RGBA(0,0,0,0.5)' -draw 'color 0,0 reset' \
126 # make animated progress bar backgrounds
128 local postfix
=$1 color
=$2
129 local file_name_start
=progress-bkgd-start-
$postfix.mng
130 local file_name_stop
=progress-bkgd-stop-
$postfix.mng
131 if ! [[ -f images
/$file_name_start && -f images
/$file_name_stop ]]; then
132 _msg images
/"$file_name_start" images
/"$file_name_stop"
135 tmpdir
=$
( mktemp
-d spl_banner_anims_XXXXXX
) ||
return 1
136 local digits
=$
(( ${#progress_h} + 1 ))
138 local i a
=0 b
=$
(( progress_h
- 1 ))
139 for (( i
=a
; i
<=b
; i
++ )) do
140 local ii_start
=$
( printf "%0${digits}i" $
(( b
- i
)) )
141 local ii_stop
=$
( printf "%0${digits}i" $
(( i
)) )
142 convert
$png_args -type TrueColorMatte
-depth 8 \
144 $
(( progress_w
))x$
(( progress_h
)) xc
:black \
145 -fill "$color" -draw "rectangle \
147 $(( progress_w )),$(( progress_h ))" \
148 -fill '#000000' -draw "polygon \
149 $(( progress_w/3 )),$(( i )) \
150 $(( progress_w )),$(( i - stripe_h/2 )) \
151 $(( progress_w )),$(( i + stripe_h/2 ))" \
152 -fill '#000000' -draw "polygon \
153 $(( progress_w*2/3 )),$(( i - progress_h/2 )) \
154 $(( 0 )),$(( i - stripe_h/2 - progress_h/2 )) \
155 $(( 0 )),$(( i + stripe_h/2 - progress_h/2 ))" \
156 -fill '#000000' -draw "polygon \
157 $(( progress_w*2/3 )),$(( i + progress_h/2 )) \
158 $(( 0 )),$(( i - stripe_h/2 + progress_h/2 )) \
159 $(( 0 )),$(( i + stripe_h/2 + progress_h/2 ))" \
160 $tmpdir/spinner-stop-
${ii_stop}.png
161 cp $tmpdir/spinner-stop-
${ii_stop}.png \
162 $tmpdir/spinner-start-
${ii_start}.png
164 convert
-delay 1x30
$tmpdir/spinner-start-
*.png images
/$file_name_start
165 convert
-delay 1x30
$tmpdir/spinner-stop-
*.png images
/$file_name_stop
168 echo $file_name_start $file_name_stop
174 local file_name
=silent-
$screen_size.png
175 if ! [[ -f images
/$file_name ]]; then
176 _msg images
/"$file_name"
178 convert
$png_args -type TrueColorMatte
-depth 8 -size $screen_size xc
:black
-fill black
-draw 'color 0,0 reset' \
179 images
/silent-
$screen_size.png
185 local flavour
=$1 color_name
=$2 color
=$3
186 local file_name
=verbose-
${flavour}-${color_name}-${screen_size}.png
187 if ! [[ -f images
/$file_name ]]; then
188 _msg images
/"$file_name"
190 ( cd .tmp
&& make_logo archlinux-
${flavour}-black.png
)
192 [[ -f .tmp
/backgrnd-
${color_name}-${screen_size}.png
]] ||
193 convert
$png_args -type TrueColorMatte
-depth 8 -size $screen_size xc
:black
-fill "${color}" -draw 'color 0,0 reset' \
194 .tmp
/images
/backgrnd-
${color_name}-${screen_size}.png
196 local x
=$
(( screen_w
- 20 - logo_w
)) y
=$
(( screen_h
- 20 - logo_h
))
197 # If wide screen, avoid logo hidden behind [DONE]
198 (( x
>= 6*8*2 )) && x
=$
(( x
- 6*8 ))
199 composite
$png_args -geometry +${x}+${y} \
200 .tmp
/images
/archlinux-
${flavour}-black.png \
201 .tmp
/images
/backgrnd-
${color_name}-${screen_size}.png \
209 progress_colors
='#5dbded #106691'
211 ;; dark
) # doesn't look good on black background
212 progress_colors
='#5dbded #4d4d4d'
215 progress_colors
='#f0f0f0 #808080'
219 #check_file "$logo_file"
221 make_logo
"${logo_file}"
224 [[ $
( convert images
/"${logo_file}" -identify /dev
/null
) =~
[[:space
:]]([0-9]+)x
([0-9]+)[[:space
:]] ]] ||
225 err
"Unable to determine banner image size"
226 logo_w
=${BASH_REMATCH[1]}
227 logo_h
=${BASH_REMATCH[2]}
229 # progress bar length
234 read anim_start_file anim_stop_file
< <( make_anims
$color '#0a3f5a' )
235 make_separator separator-
$color.png
'#2979a2' '#5dbded'
237 read anim_start_file anim_stop_file
< <( make_anims
$color '#404040' )
238 make_separator separator-
$color.png
'#e0e0e0' '#ffffff'
241 make_separator separator-red.png
'#a22929' '#ed5d5d'
252 for f
in icon
$work_dir/some-long-file-name
9999 9999 svc_inactive_start fbsplash-dummy
'blendout(9999)'; do
253 svc_format
+="%-${#f}s "
259 [[ -h $1 ]] && return 0
261 ln -sT ${lib_dir}/"$1" "$1"
264 # args: <prefix> <file> [<arg>...]
266 local prefix
=$1 file=$2
268 add_link images
/"$file"
269 echo "${prefix}images/${file}" "${@}"
272 add_separator_red
() {
273 printf "$svc_format" $
( add_image
"icon " separator-red.png
$separator_x $separator_y svc_stop_failed fbsplash-dummy
)
274 printf "$svc_format" $
( add_image
"icon " separator-red.png
$separator_x $separator_y svc_start_failed fbsplash-dummy
)
278 local cover cover_a50 n icon_x stat_icon_x
279 cover
=$
( add_image
"icon " cover.png
)
280 #cover_a50=$( add_image "icon " cover-a50.png )
281 for (( n
=1; n
<=icon_count
; n
++ )); do
282 icon_x
=$
(( icon_bar_x
+ (n-1
) * icon_step
))
283 stat_icon_x
=$
(( icon_x
+ icon_size
/2 ))
284 printf "$svc_format" icon
${work_dir}/svc_
${n}_stop
$icon_x $icon_bar_y
285 # printf "$svc_format" icon ${work_dir}/svc_${n} $icon_x $icon_bar_y svc_inactive_start _icon_svc_${n}
286 # printf "$svc_format" $cover_a50 $icon_x $icon_bar_y svc_inactive_start _icon_svc_${n}
287 printf "$svc_format" icon
${work_dir}/cover-stop
$icon_x $icon_bar_y svc_stop _icon_svc_
${n} #'blendin(125)'
288 printf "$svc_format" icon
${work_dir}/stop
$stat_icon_x $icon_bar_y svc_stop _icon_svc_
${n}
289 printf "$svc_format" $cover $icon_x $icon_bar_y svc_stopped _icon_svc_
${n} #'blendin(125)'
290 printf "$svc_format" icon
${work_dir}/svc_${n}_stop $icon_x $icon_bar_y svc_stop_failed _icon_svc_${n}
291 printf "$svc_format" icon
${work_dir}/cover-fail
$icon_x $icon_bar_y svc_stop_failed _icon_svc_
${n} #'blendin(125)'
292 printf "$svc_format" icon
${work_dir}/fail
$stat_icon_x $icon_bar_y svc_stop_failed _icon_svc_
${n}
293 printf "$svc_format" icon
${work_dir}/svc_${n}_start $icon_x $icon_bar_y svc_start _icon_svc_${n}
294 printf "$svc_format" icon
${work_dir}/cover-start
$icon_x $icon_bar_y svc_start _icon_svc_
${n} #'blendout(125)'
295 printf "$svc_format" icon
${work_dir}/start
$stat_icon_x $icon_bar_y svc_start _icon_svc_
${n}
296 printf "$svc_format" icon
${work_dir}/svc_${n}_start $icon_x $icon_bar_y svc_started _icon_svc_${n}
297 printf "$svc_format" icon
${work_dir}/svc_${n}_start $icon_x $icon_bar_y svc_start_failed _icon_svc_${n}
298 printf "$svc_format" icon
${work_dir}/cover-fail
$icon_x $icon_bar_y svc_start_failed _icon_svc_
${n} #'blendin(125)'
299 printf "$svc_format" icon
${work_dir}/fail
$stat_icon_x $icon_bar_y svc_start_failed _icon_svc_
${n}
308 screen_w
="${screen_size%x*}"
309 screen_h
="${screen_size#*x}"
311 silent_background
=$
( cd ..
&& make_silent
)
314 in blue
) verbose_background
=$
( cd ..
&& make_verbose
$verbose_flavour blue
'#051e2a' )
315 ;; white
) verbose_background
=$
( cd ..
&& make_verbose
$verbose_flavour white
'#1e1e1e' )
318 # fixed point for placement
319 anchor_x
=$
(( screen_w
/ 2 ))
320 anchor_y
=$
(( screen_h
/ 2 ))
323 separator_x
=$
(( anchor_x
- separator_w
/2 ))
324 separator_y
=$
(( anchor_y
- separator_h
/2 ))
327 icon_bar_w
=$
(( separator_w
- icon_size
))
328 icon_bar_x
=$
(( anchor_x
- icon_bar_w
/2 ))
329 icon_bar_y
=$
(( separator_y
+ 20 ))
330 icon_step
=$
(( icon_size
*3/2 ))
331 icon_count
=$
(( ( icon_bar_w
+ icon_step
- icon_size
) / icon_step
))
333 # main area (logo image + progress bar)
334 main_w
=$
(( logo_w
+ 20 + progress_w
))
336 # status message font size
337 status_text_font_size
=${font_size}
339 # estimated height of 1000 lines of text
340 status_text_h_1000
=$
(( 15600 * status_text_font_size
/ 12 ))
342 # status message text heigth
343 status_text_h
=$
(( status_text_h_1000
/1000 ))
346 status_h
=$
(( status_text_h
+ 20 ))
347 status_x
=$
(( anchor_x
- main_w
/2 ))
348 status_y
=$
(( separator_y
- separator_h
/2 - status_h
))
350 # status message text position
351 status_text_x
=$
(( status_x
+ 15 ))
352 status_text_y
=$
(( status_y
+ status_h
/2 - status_text_h
/2 ))
354 # logo/banner position
355 logo_x
=$
(( anchor_x
- main_w
/2 ))
356 logo_y
=$
(( status_y
- logo_h
))
358 # progress bar position
359 progress_x
=$
(( anchor_x
+ main_w
/2 - progress_w
))
362 # progress bar bottom right corner
363 progress_x2
=$
(( anchor_x
+ main_w
/2 - 1 ))
364 progress_y2
=$
(( progress_y
+ progress_h
- 1 ))
367 message_log_x
=$
(( status_text_x
))
368 message_log_y
=$
(( icon_bar_y
+ icon_size
+ 20 ))
369 message_log_font_size
=${font_size}
370 # estimated height of 1000 lines of text
371 message_log_text_h_1000
=$
(( 15600 * message_log_font_size
/ 12 ))
373 #echo " Message log y is ${message_log_y}"
375 # number of message log lines
376 message_log_lines
=$
(( 1000 * ( screen_h
- message_log_y
- 10 ) / message_log_text_h_1000
))
378 #echo " Number of msglog textbox lines icon_size ${message_log_lines}"
382 add_image
"pic=" $verbose_background
393 add_image
"silentpic=" $silent_background
395 add_image
"icon " $logo_file $logo_x $logo_y
399 text_size=$status_text_font_size
400 text_x=$status_text_x
401 text_y=$status_text_y
402 text_color=$text_color
405 add_image
"icon " separator-
$color.png
$separator_x $separator_y
408 # This type is used by fbcondecor_helper in initcpio
414 add_image
"${INDENT}anim loop " $anim_start_file $progress_x $progress_y "blendin(125)"
416 box silent inter $progress_x $progress_y2 $progress_x2 $progress_y2 $progress_colors $progress_colors blendin(125)
417 box silent $progress_x $progress_y $progress_x2 $progress_y2 $progress_colors $progress_colors blendin(125)
420 <type reboot shutdown>
422 add_image
"${INDENT}anim loop " $anim_stop_file $progress_x $progress_y
424 box silent inter $progress_x $progress_y $progress_x2 $progress_y2 $progress_colors $progress_colors
425 box silent $progress_x $progress_y2 $progress_x2 $progress_y2 $progress_colors $progress_colors
429 box silent $progress_x $progress_y $progress_x2 $progress_y2 #0a3f5a
430 box silent inter $progress_x $progress_y $progress_x2 $progress_y2 $progress_colors $progress_colors
431 box silent $progress_x $progress_y2 $progress_x2 $progress_y2 $progress_colors $progress_colors
434 <type bootup reboot shutdown suspend>
438 (( icon_count
> 0 )) && add_icon_bar
442 # 'tuxoniceui_fbsplash' (version 1.0) doesn't know anything about types.
443 # It seems to show allways simply the last item defined on top.
444 # With this one at the end we allways get an upward growing progress
445 # whether suspend or resume it done.
447 box silent $progress_x $progress_y $progress_x2 $progress_y2 #0a3f5a
448 box silent inter $progress_x $progress_y2 $progress_x2 $progress_y2 $progress_colors $progress_colors
449 box silent $progress_x $progress_y $progress_x2 $progress_y2 $progress_colors $progress_colors
453 if (( message_log_lines
< 3 )); then
454 msg
"WARNING: Not including message log."
457 log_lines=$message_log_lines
458 # Don't truncate log messages - We only show errors here and don't use a mono spaced font
461 text silent $font_file $message_log_font_size $message_log_x $message_log_y $text_color msglog
466 } >${screen_size}.cfg
469 cat > metadata.xml
<<EOF
470 <?xml version="1.0" encoding=\"UTF-8\"?>
471 <thememeta xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
472 xsi:schemaLocation="http://fbsplash.berlios.de/schemas/1.0/thememeta.xsd">
473 <name>${theme_name}</name>
474 <version>${version}</version>
476 <name>${author_name}</name>
477 <email>${author_email}</email>
479 <description>${description}</description>
480 <license>${theme_license}</license>