File: makecrystalicon

package info (click to toggle)
fvwm-crystal 3.4.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 21,700 kB
  • ctags: 1,494
  • sloc: sh: 3,265; cs: 1,335; python: 875; makefile: 214
file content (42 lines) | stat: -rwxr-xr-x 1,615 bytes parent folder | download | duplicates (2)
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
41
42
#!/bin/bash

if [[ "$(echo $FVWM_USERDIR)" == "" ]]
then
    echo "Please, run this script when fvwm-crystal is running."
    echo "As an alternative, you may define \$FWVM_USERDIR and re-run this script:"
    exit 1
fi

usage() {
echo "Welcome! this is the little help of $0."
echo ""
echo "usage: $0 <file> <name>"
echo ""
echo "where <file> is the icon file you want to make application icons from. It must be into the current directory, or its full path must be provided,"
echo "and <name> is the application name (icon name without its extension)."
echo "The application icons will be created in ${FVWM_USERDIR}/icons/Default/*/apps."
echo "The directories ${FVWM_USERDIR}/icons/Default/*/apps will be created if they don't exist, that for the 3 supported icons sizes, 22x22, 32x32 and 48x48."
}

ICNAME=$(echo "$2").png
#echo $ICNAME

makeicon() {
    for ICPATH in 22x22 32x32 48x48
    do
	mkdir -p "${FVWM_USERDIR}/icons/Default/${ICPATH}/apps"
	echo "Creating ${ICNAME}"
	convert -resize ${ICPATH} "$1" "${FVWM_USERDIR}/icons/Default/${ICPATH}/apps/${ICNAME}"
        convert "${FVWM_USERDIR}/icons/Default/${ICPATH}/apps/${ICNAME}" -strip -resize ${ICPATH} "${FVWM_USERDIR}/icons/Default/${ICPATH}/apps/${ICNAME}"
        convert "${FVWM_USERDIR}/icons/Default/${ICPATH}/apps/${ICNAME}" -strip -resize ${ICPATH} "${FVWM_USERDIR}/icons/Default/${ICPATH}/apps/${ICNAME}"
        convert "${FVWM_USERDIR}/icons/Default/${ICPATH}/apps/${ICNAME}" -strip -resize ${ICPATH} "${FVWM_USERDIR}/icons/Default/${ICPATH}/apps/${ICNAME}"
    done
}

if [ -z "$2" ]
then
    usage
else
    makeicon "$1" "$2"
fi
exit 0