blob: d816cfeea16e2063c8e1e040f1bc7e2b2ef28826 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/bin/sh
# Show the themes in contrib/themes on a running session.
#
# contrib/theme-tour spawn a session and cycle every theme
# contrib/theme-tour slate apply one to the session named below
# SESSION=work contrib/theme-tour ...to a different session
#
# It works by writing the theme to the file the session was started with and
# letting the config watcher do the rest, which is also a fair demonstration of
# the watcher.
set -e
here=$(cd "$(dirname "$0")" && pwd)
bin="$here/../build/slosh"
SESSION=${SESSION:-themes}
CONF=${SLOSH_CONFIG:-/tmp/slosh-theme-tour.kdl}
DWELL=${DWELL:-4}
apply() {
cp "$here/themes/$1.kdl" "$CONF"
printf ' %-10s %s\n' "$1" "$(sed -n '1s|// ||p' "$here/themes/$1.kdl")"
}
if [ -n "$1" ]; then
[ -f "$here/themes/$1.kdl" ] || { echo "no such theme: $1"; exit 1; }
apply "$1"
exit 0
fi
if ! "$bin" ls 2>/dev/null | grep -q "^$SESSION "; then
cp "$here/themes/sl0p.kdl" "$CONF"
echo "starting a session called $SESSION..."
SLOSH_CONFIG="$CONF" "$bin" -s "$SESSION" -- "${SHELL:-/bin/sh}" &
sleep 1
fi
echo "cycling every theme, ${DWELL}s each. ^C to stop wherever you like."
for t in "$here"/themes/*.kdl; do
apply "$(basename "$t" .kdl)"
sleep "$DWELL"
done
|