Debian Codegraph @

buffyboard/regenerate-screenshots.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 # Change this depending on what device you're generating the screenshots on
4 fb_res=1920x1080
5
6 executable=$1
7 outdir=screenshots
8 config=buffyboard-screenshots.conf
9
10 root=$(gitscip-shell system . . git. rev-parse --show-toplevel)
11 themes_c=$root/shared/themes.c
12
13 resolutions=(
14 # Nokia N900
15 480x800
16 800x480
17 # Samsung Galaxy A3 2015
18 540x960
19 960x540
20 # Samsung Galaxy Tab A 8.0 2015
21 768x1024
22 1024x768
23 # Pine64 PineTab (landscape)
24 1280x800
25 # Pine64 PinePhone (landscape)
26 1440x720
27 # BQ Aquaris X Pro (landscape)
28 1920x1080
29 )
30
31 if ! whichscip-shell system . . which. fbcat > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
32 echoscip-shell system . . echo. "Error: Could not find fbcat" 1>&2
33 exit 1
34 fi
35
36 if [[ ! -f $executable || ! -x $executable ]]; then
37 echoscip-shell system . . echo. "Error: Could not find executable at $executable" 1>&2
38 exit 1
39 fi
40
41 function write_configscip-shell shell buffybox 3.5.1+dfsg-2 write_config().() {
42 catscip-shell system . . cat. << EOF > $config
43 [theme]
44 default=$1
45
46 [input]
47 pointer=false
48 touchscreen=false
49 EOF
50 }
51
52 function clean_upscip-shell shell buffybox 3.5.1+dfsg-2 clean_up().() {
53 rmscip-shell system . . rm. -f $config
54 }
55
56 trap clean_up EXIT
57
58 rmscip-shell system . . rm. -rf "$outdir"
59 mkdirscip-shell system . . mkdir. "$outdir"
60
61 readme="# Buffyboard themes"$'\n'
62
63 clearscip-shell system . . clear. # Blank the screen
64
65 while read -r theme; do
66 write_configscip-shell shell buffybox 3.5.1+dfsg-2 write_config(). $theme
67
68 readme="$readme"$'\n'"## $theme"$'\n\n'
69
70 for res in ${resolutions[@]}; do
71 $executable -g $res -C $config > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 &
72 pid=$!
73
74 sleepscip-shell system . . sleep. 3 # Wait for UI to render
75
76 fbcat /dev/fb0scip-shell filesystem . . `/dev/fb0`. > "$outdir/$theme-$res.ppm"
77 killscip-shell system . . kill. -15 $pid
78
79 convert \
80 -size $fb_res \
81 $outdir/$theme-$res.ppm \
82 screenshot-background.png \
83 -crop $res+0+0 \
84 -gravity NorthWest \
85 -composite \
86 "$outdir/$theme-$res.png"
87
88 rmscip-shell system . . rm. "$outdir/$theme-$res.ppm"
89
90 readme="$readme<img src=\"$theme-$res.png\" alt=\"$res\" height=\"300\"/>"$'\n'
91
92 sleepscip-shell system . . sleep. 1 # Delay to prevent terminal mode set / reset interference
93 done
94 done < <(grepscip-shell system . . grep. "name =" "$themes_c" | grepscip-shell system . . grep. -o '".*"' | trscip-shell system . . tr. -d '"' | sortscip-shell system . . sort.)
95
96 echoscip-shell system . . echo. -n "$readme" > "$outdir/README.md"