Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / ksplash / ksplashx / utils / fromksplashmldefault.sh
blobede14bf1d9419902ff65d620848c41e21a7116fa
1 #! /bin/sh
3 # This script creates a KSplashX theme from KSplashML's theme using the Default engine.
4 # Just run in the theme's directory with theme name as argument and it'll create a new subdirectory "theme".
5 # Note that the positions in the icon bar may be a bit off, as KSplashML itself has them off;
6 # if it doesn't work for you, fiddle with the positions below (two places, also the description.txt file)
7 # You should also afterwards check Theme.rc (only Engine= and descriptive fields like Name= should matter)
9 # the -depth 8 is there to produce smaller png's (it doesn't seem to affect anything else *shrug*)
11 if test $# -ne 1; then
12 echo Theme name missing.
13 exit 1
15 theme="$1"
17 # check
18 grep "Engine = Default" Theme.rc >/dev/null 2>&1 || ( echo "No Theme.rc or Engine is not Default"; exit 1 )
20 # create the subdir
21 rm -r "$theme" 2>/dev/null
22 mkdir "$theme"
23 mkdir "$theme"/1600x1200
25 # create background image from top, bar and bottom
26 montage splash_top.png splash_inactive_bar.png splash_bottom.png -geometry +0+0 -tile 1x3 -depth 8 "$theme"/1600x1200/background.png
28 # cut the icons from the icon bar
29 # numbers are x position, width and icon number
30 for i in 0-58-1 58-58-2 116-58-3 174-58-4 232-58-5 290-50-6 340-60-7; do
31 x=`echo $i | sed 's/\(.*\)-.*-.*/\1/'`
32 w=`echo $i | sed 's/.*-\(.*\)-.*/\1/'`
33 n=`echo $i | sed 's/.*-.*-\(.*\)/\1/'`
34 convert splash_inactive_bar.png -crop ${w}x58+${x}+0 -depth 8 iconin.png
35 convert splash_active_bar.png -crop ${w}x58+${x}+0 -depth 8 iconac.png
36 montage iconac.png iconin.png -tile 2x1 -geometry +0+0 -depth 8 "$theme"/1600x1200/icon${n}_anim.png
37 cp iconac.png "$theme"/1600x1200/icon${n}.png
38 rm iconin.png iconac.png
39 done
41 # preview file
42 cp Preview.png "$theme"/Preview.png
44 # Theme.rc file
45 cat Theme.rc \
46 | sed 's/Engine = Default/Engine = KSplashX/' \
47 | sed "s/\[KSplash Theme: .*\]/\[KSplash Theme: $theme\]/" \
48 > "$theme"/Theme.rc
50 # CMakeLists.txt
52 cat >"$theme"/CMakeLists.txt <<EOF
53 install( FILES Preview.png Theme.rc DESTINATION \${DATA_INSTALL_DIR}/ksplash/Themes/$theme )
54 install( FILES 1600x1200/description.txt 1600x1200/background.png
55 1600x1200/icon1.png 1600x1200/icon2.png 1600x1200/icon3.png
56 1600x1200/icon4.png 1600x1200/icon5.png 1600x1200/icon6.png 1600x1200/icon7.png
57 1600x1200/icon1_anim.png 1600x1200/icon2_anim.png 1600x1200/icon3_anim.png
58 1600x1200/icon4_anim.png 1600x1200/icon5_anim.png 1600x1200/icon6_anim.png 1600x1200/icon7_anim.png
59 DESTINATION \${DATA_INSTALL_DIR}/ksplash/Themes/${theme}/1600x1200 )
60 EOF
62 # now the description file
64 cat >"$theme"/1600x1200/description.txt <<EOF
65 SCALE OFF
66 GEOMETRY_REL CC 0 0 CC 400 270
67 IMAGE 0 0 background.png
68 ANIM 1 0 190 2 icon1_anim.png 400
69 WAIT_STATE 1
71 STOP_ANIM 1
72 IMAGE 0 190 icon1.png
73 ANIM 2 58 190 2 icon2_anim.png 400
74 WAIT_STATE 2
76 STOP_ANIM 2
77 IMAGE 58 190 icon2.png
78 ANIM 3 116 190 2 icon3_anim.png 400
79 WAIT_STATE 3
81 STOP_ANIM 3
82 IMAGE 116 190 icon3.png
83 ANIM 4 174 190 2 icon4_anim.png 400
84 WAIT_STATE 4
86 STOP_ANIM 4
87 IMAGE 174 190 icon4.png
88 ANIM 5 232 190 2 icon5_anim.png 400
89 WAIT_STATE 5
91 STOP_ANIM 5
92 IMAGE 232 190 icon5.png
93 ANIM 6 290 190 2 icon6_anim.png 400
94 WAIT_STATE 6
96 STOP_ANIM 6
97 IMAGE 290 190 icon6.png
98 ANIM 7 340 190 2 icon7_anim.png 400
99 WAIT_STATE 7
101 STOP_ANIM 7
102 IMAGE 340 190 icon7.png
103 WAIT_STATE 8