wok-next diff make-slitaz-icons/stuff/mksit.sh @ rev 17950

Add: "make-slitaz-icons": tool to create SliTaz icon set from any Linux icon sets; "slitaz-icons-faenza": candidate to substitute "slitaz-icon" in the upcoming SliTaz release, still need testing (to find absent icons).
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Apr 16 03:14:37 2015 +0300 (2015-04-16)
parents
children 4b2ef27b7a68
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make-slitaz-icons/stuff/mksit.sh	Thu Apr 16 03:14:37 2015 +0300
     1.3 @@ -0,0 +1,838 @@
     1.4 +#!/bin/sh
     1.5 +# Make SliTaz icon theme
     1.6 +# Aleksej Bobylev <al.bobylev@gmail.com>, 2014-2015
     1.7 +# (Started in November 2014)
     1.8 +
     1.9 +VERSION="150416"
    1.10 +
    1.11 +. /lib/libtaz.sh
    1.12 +
    1.13 +
    1.14 +### Functions ###
    1.15 +
    1.16 +# Usage of utility
    1.17 +
    1.18 +usage() {
    1.19 +	cat <<EOT
    1.20 +$(basename $0), v. $VERSION
    1.21 +Make icon theme for SliTaz GNU/Linux
    1.22 +
    1.23 +Usage:
    1.24 +$(basename $0) [OPTIONS ...]
    1.25 +
    1.26 +Options:
    1.27 +-f <path>  The path to the original theme from which the icons will be taken
    1.28 +           Note that this folder contains the file index.theme
    1.29 +-t <path>  The path where the folder with a new theme will created
    1.30 +           Note that existing folder will be silently removed
    1.31 +-s <path>  Path to icon substitution definitions. Where <path> can point to file
    1.32 +           or to folder containing file <original theme name>.sub
    1.33 +-n 'name'  The name of the new theme (default will be taken from -t path)
    1.34 +
    1.35 ++is  -is   Whether to use Inkscape to convert svg icons to png (default: +is)
    1.36 ++op  -op   Whether to use Optipng to optimize png icons (default: +op)
    1.37 ++sl  -sl   Whether to replace the same icons by symlinks (default: +sl)
    1.38 +
    1.39 +-opmax     Maximal settings for Optipng (slow but save maximum bytes)
    1.40 +
    1.41 +-nocolor   Don't use color in the log
    1.42 +EOT
    1.43 +}
    1.44 +
    1.45 +
    1.46 +# Color output
    1.47 +colored() {
    1.48 +	if [ $color == 'yes' ]; then
    1.49 +		colorize $@
    1.50 +	else
    1.51 +		echo $2
    1.52 +	fi
    1.53 +}
    1.54 +
    1.55 +
    1.56 +# Find icon (use pre-generated list of icon files)
    1.57 +
    1.58 +findi() {
    1.59 +	grep -e "/$1.png" -e "/$1.svg" $ICONSLIST
    1.60 +}
    1.61 +
    1.62 +
    1.63 +# Copy icon
    1.64 +
    1.65 +c() {
    1.66 +	for SIZE in $SIZES; do
    1.67 +		FOUND=''
    1.68 +		for ICON in $(echo "$@" | sed 's|\([^ ]*\)|& gnome-mime-& gnome-dev-&|'); do
    1.69 +			FINDICON=$(findi $ICON | sed "s|$FROM||g" | grep -e "/$SIZE/" -e "/${SIZE}x$SIZE/")
    1.70 +
    1.71 +			if [ -n "$FINDICON" ]; then
    1.72 +				if [ $(echo "$FINDICON" | wc -l) != "1" ]; then
    1.73 +					# Multiple choice
    1.74 +					if [ "$(md5sum $(echo "$FINDICON" | sed 's|^.*$|'$FROM'&|g') | awk '{print $1}' | sort | uniq | wc -l)" != "1" ]; then
    1.75 +						# note: really different icons with different md5sum
    1.76 +						colored 33 "? $1($SIZE): Multiple choice:"
    1.77 +						echo "$FINDICON" | sed 's|^.*$|  * &|g'
    1.78 +					fi
    1.79 +					FINDICON="$(echo "$FINDICON" | head -n1)"
    1.80 +				fi
    1.81 +				mkdir -p $TO/${SIZE}x${SIZE}/$CATEGORY
    1.82 +
    1.83 +				BASE_FINDICON="$(basename $FINDICON .png)"
    1.84 +				BASE_FINDICON="$(basename $BASE_FINDICON .svg)"
    1.85 +
    1.86 +				if [ "$1" == "$BASE_FINDICON" ]; then
    1.87 +					colored 32 "+ $1($SIZE)"
    1.88 +				else
    1.89 +					colored 34 "+ $1($SIZE) <= $(basename $FINDICON)"
    1.90 +				fi
    1.91 +
    1.92 +				EXT=${FINDICON##*.}
    1.93 +				cp -aL $FROM/$FINDICON $TO/${SIZE}x${SIZE}/$CATEGORY/$1.$EXT
    1.94 +
    1.95 +				FOUND='yes'
    1.96 +				break
    1.97 +			fi
    1.98 +		done
    1.99 +		if [ -z "$FOUND" ]; then
   1.100 +			colored 31 "- $1($SIZE) NOT FOUND!"
   1.101 +		fi
   1.102 +	done
   1.103 +}
   1.104 +
   1.105 +
   1.106 +# Maybe copy stock icon
   1.107 +
   1.108 +s() {
   1.109 +	if [ "$BASED_ON" != "Faenza" ]; then
   1.110 +		c $@
   1.111 +	else
   1.112 +		echo ". $1"
   1.113 +	fi
   1.114 +}
   1.115 +
   1.116 +
   1.117 +# Return shortest line
   1.118 +
   1.119 +shortest_line() {
   1.120 +	S=$1; shift
   1.121 +	for L in $@; do
   1.122 +		[ "${#L}" -lt "${#S}" ] && S="$L"
   1.123 +	done
   1.124 +	echo "$S"
   1.125 +}
   1.126 +
   1.127 +
   1.128 +# Replace the same files by symlinks, $@ - list of identical files
   1.129 +
   1.130 +make_symlinks() {
   1.131 +	S=$(shortest_line $@)
   1.132 +	for file in $@; do
   1.133 +		[ "$S" != "$file" ] && ln -sf $S $file
   1.134 +	done
   1.135 +}
   1.136 +
   1.137 +
   1.138 +# Calculate size in bytes
   1.139 +
   1.140 +size() {
   1.141 +	echo -n "size: "
   1.142 +	find "$TO" -type f -exec stat -c %s {} \; | awk 'BEGIN{SUM=0}{SUM+=$1}END{print SUM}'
   1.143 +}
   1.144 +
   1.145 +
   1.146 +# Print out category
   1.147 +
   1.148 +echo_cat() {
   1.149 +	echo
   1.150 +	colored 35 $CATEGORY
   1.151 +	colored 35 $(echo -n $CATEGORY | tr -c '' '-')
   1.152 +}
   1.153 +
   1.154 +
   1.155 +
   1.156 +
   1.157 +
   1.158 +case "$1" in
   1.159 +	-h|--help) usage; exit 0 ;;
   1.160 +	-V|--version) echo "$(basename $0) v. $VERSION"; exit 0 ;;
   1.161 +esac
   1.162 +
   1.163 +
   1.164 +# Default parameters:
   1.165 +
   1.166 +IS='yes'; OP='yes'; SL='yes'; PNGOPT=''; SUBS=''; color='yes'
   1.167 +
   1.168 +while [ "x$1" != "x" ]; do
   1.169 +	case "$1" in
   1.170 +		-f)  FROM="$2"; shift; BASED_ON="$(basename ${FROM%/})" ;;
   1.171 +		-t)  TO="$2";   shift; NAME="$(basename ${TO%/})" ;;
   1.172 +		-s)  SUBS="$2"; shift; if [ -d "$SUBS" ]; then SUBS="${SUBS%/}/$BASED_ON.sub"; fi ;;
   1.173 +		-n)  NAME="$2"; shift ;;
   1.174 +		-is) IS='no'  ;;
   1.175 +		+is) IS='yes' ;;
   1.176 +		-op) OP='no'  ;;
   1.177 +		+op) OP='yes' ;;
   1.178 +		-sl) SL='no'  ;;
   1.179 +		+sl) SL='yes' ;;
   1.180 +		-opmax) PNGOPT="-o7 -zm1-9" ;;
   1.181 +		-nocolor) color='no' ;;
   1.182 +	esac
   1.183 +	shift
   1.184 +done
   1.185 +
   1.186 +if [ "x$FROM" == "x" -o "x$TO" == "x" ]; then
   1.187 +	echo "There are no required parameters (-f or -t)!"; exit 1
   1.188 +fi
   1.189 +
   1.190 +echo "Check components..."
   1.191 +if [ $IS == 'yes' ]; then
   1.192 +	echo -n "Inkscape: "
   1.193 +	if [ -x "$(which inkscape)" ]; then
   1.194 +		echo "$(which inkscape)"
   1.195 +	else
   1.196 +		colored 31 "not found! Force '-is'"; IS='no'
   1.197 +	fi
   1.198 +fi
   1.199 +if [ $OP == 'yes' ]; then
   1.200 +	echo -n "Optipng:  "
   1.201 +	if [ -x "$(which optipng)" ]; then
   1.202 +		echo "$(which optipng)"
   1.203 +	else
   1.204 +		colored 31 "not found! Force '-op'"; OP='no'
   1.205 +	fi
   1.206 +fi
   1.207 +echo -n "Symlinks: "
   1.208 +if [ -x "$(which symlinks)" ]; then
   1.209 +	echo "$(which symlinks)"
   1.210 +else
   1.211 +	colored 31 "not found! Abort."; exit 1
   1.212 +fi
   1.213 +echo
   1.214 +
   1.215 +echo "Options: Inkscape=\"$IS\" Optipng=\"$OP\" Symlinks=\"$SL\""
   1.216 +echo "From:    \"$FROM\""
   1.217 +echo "To:      \"$TO\""
   1.218 +echo "Subs:    \"$SUBS\""
   1.219 +echo "Name:    \"$NAME\""
   1.220 +echo
   1.221 +
   1.222 +
   1.223 +rm -rf $TO
   1.224 +
   1.225 +# make files list
   1.226 +ICONSLIST=$(mktemp)
   1.227 +find $FROM -type f -o -type l > $ICONSLIST
   1.228 +
   1.229 +
   1.230 +
   1.231 +
   1.232 +
   1.233 +#########################
   1.234 +# Standard Action Icons #
   1.235 +#########################
   1.236 +CATEGORY='actions'; SIZES='16'; echo_cat
   1.237 +
   1.238 +c address-book-new
   1.239 +s application-exit dialog-close			# gtk_stock 16,24		# elementary hack
   1.240 +c appointment-new
   1.241 +c call-start
   1.242 +c call-stop process-stop										# elementary hack
   1.243 +c contact-new
   1.244 +s document-new				# gtk_stock 16,24
   1.245 +s document-open				# gtk_stock 16,24
   1.246 +s document-open-recent		# gtk_stock 16,24
   1.247 +c document-page-setup
   1.248 +s document-print			# gtk_stock 16,24
   1.249 +s document-print-preview	# gtk_stock 16,24
   1.250 +s document-properties		# gtk_stock 16,24
   1.251 +s document-revert			# gtk_stock 16,24
   1.252 +s document-save				# gtk_stock 16,24
   1.253 +s document-save-as document-save		# gtk_stock 16,24		# elementary hack
   1.254 +c document-send document-export									# elementary hack
   1.255 +s edit-clear remove						# gtk_stock 16,24		# elementary hack
   1.256 +s edit-copy					# gtk_stock 16,24
   1.257 +s edit-cut					# gtk_stock 16,24
   1.258 +s edit-delete				# gtk_stock 16,24
   1.259 +s edit-find					# gtk_stock 16,24
   1.260 +s edit-find-replace edit-find			# gtk_stock 16,24		# elementary hack
   1.261 +s edit-paste				# gtk_stock 16,24
   1.262 +s edit-redo					# gtk_stock 16,24
   1.263 +s edit-select-all			# gtk_stock 16,24
   1.264 +s edit-undo					# gtk_stock 16,24
   1.265 +c folder-new
   1.266 +s format-indent-less		# gtk_stock 16,24
   1.267 +s format-indent-more		# gtk_stock 16,24
   1.268 +s format-justify-center		# gtk_stock 16,24
   1.269 +s format-justify-fill		# gtk_stock 16,24
   1.270 +s format-justify-left		# gtk_stock 16,24
   1.271 +s format-justify-right		# gtk_stock 16,24
   1.272 +c format-text-direction-ltr
   1.273 +c format-text-direction-rtl
   1.274 +s format-text-bold			# gtk_stock 16,24
   1.275 +s format-text-italic		# gtk_stock 16,24
   1.276 +s format-text-underline		# gtk_stock 16,24
   1.277 +s format-text-strikethrough	# gtk_stock 16,24
   1.278 +s go-bottom					# gtk_stock 16,24
   1.279 +s go-down					# gtk_stock 16,24
   1.280 +s go-first					# gtk_stock 16,24
   1.281 +s go-home					# gtk_stock 16,24
   1.282 +s go-jump					# gtk_stock 16,24
   1.283 +s go-last					# gtk_stock 16,24
   1.284 +s go-next					# gtk_stock 16,24
   1.285 +s go-previous				# gtk_stock 16,24
   1.286 +s go-top					# gtk_stock 16,24
   1.287 +s go-up						# gtk_stock 16,24
   1.288 +s help-about				# gtk_stock 16,24
   1.289 +s help-contents				# gtk_stock 16,24
   1.290 +c help-faq help-hint											# elementary hack
   1.291 +c insert-image
   1.292 +c insert-link
   1.293 +c insert-object
   1.294 +c insert-text
   1.295 +s list-add					# gtk_stock 16,24
   1.296 +s list-remove				# gtk_stock 16,24
   1.297 +c mail-forward
   1.298 +c mail-mark-important
   1.299 +c mail-mark-junk
   1.300 +c mail-mark-notjunk
   1.301 +c mail-mark-read
   1.302 +c mail-mark-unread
   1.303 +c mail-message-new
   1.304 +c mail-reply-all
   1.305 +c mail-reply-sender
   1.306 +c mail-send
   1.307 +c mail-send-receive
   1.308 +c media-eject list-remove									# Matrilineare hack
   1.309 +s media-playback-pause		# gtk_stock 16,24
   1.310 +s media-playback-start		# gtk_stock 16,24
   1.311 +s media-playback-stop		# gtk_stock 16,24
   1.312 +s media-record				# gtk_stock 16,24
   1.313 +s media-seek-backward go-previous		# gtk_stock 16,24		# Matrilineare hack
   1.314 +s media-seek-forward go-next			# gtk_stock 16,24		# Matrilineare hack
   1.315 +s media-skip-backward		# gtk_stock 16,24
   1.316 +s media-skip-forward		# gtk_stock 16,24
   1.317 +c object-flip-horizontal
   1.318 +c object-flip-vertical
   1.319 +c object-rotate-left
   1.320 +c object-rotate-right
   1.321 +s process-stop				# gtk_stock 16,24
   1.322 +c system-lock-screen lock									# Matrilineare hack
   1.323 +c system-log-out contact-new								# Matrilineare hack
   1.324 +s system-run				# gtk_stock 16,24
   1.325 +c system-search find										# Matrilineare hack
   1.326 +c system-reboot system-run									# Matrilineare hack
   1.327 +c system-shutdown system-shutdown-panel						# Matrilineare hack
   1.328 +s tools-check-spelling		# gtk_stock 16,24
   1.329 +s view-fullscreen			# gtk_stock 16,24
   1.330 +s view-refresh				# gtk_stock 16,24
   1.331 +s view-restore				# gtk_stock 16,24
   1.332 +s view-sort-ascending		# gtk_stock 16,24
   1.333 +s view-sort-descending		# gtk_stock 16,24
   1.334 +s window-close				# gtk_stock 16,20,24
   1.335 +c window-new
   1.336 +s zoom-fit-best				# gtk_stock 16,24
   1.337 +s zoom-in					# gtk_stock 16,24
   1.338 +s zoom-original				# gtk_stock 16,24
   1.339 +s zoom-out					# gtk_stock 16,24
   1.340 +#---------------------------
   1.341 +# PCManFM panel and menu
   1.342 +c tab-new
   1.343 +c view-choose
   1.344 +c view-filter
   1.345 +c view-sidetree
   1.346 +c gtk-execute			# LXPanel menu: run
   1.347 +c system-shutdown-panel-restart	# LXPanel menu: logout
   1.348 +c gtk-close			# Yad close button
   1.349 +
   1.350 +
   1.351 +############################
   1.352 +# Standard Animation Icons #
   1.353 +############################
   1.354 +CATEGORY='animations'; SIZES='16'; echo_cat
   1.355 +
   1.356 +c process-working
   1.357 +
   1.358 +
   1.359 +
   1.360 +##############################
   1.361 +# Standard Application Icons #
   1.362 +##############################
   1.363 +CATEGORY='apps'; SIZES='16 48'; echo_cat
   1.364 +
   1.365 +c accessories-calculator
   1.366 +c accessories-character-map
   1.367 +c accessories-dictionary
   1.368 +c accessories-text-editor
   1.369 +c help-browser
   1.370 +c multimedia-volume-control									# audio-volume-high
   1.371 +c preferences-desktop-accessibility
   1.372 +c preferences-desktop-font
   1.373 +c preferences-desktop-keyboard										# keyboard
   1.374 +c preferences-desktop-locale
   1.375 +c preferences-desktop-multimedia					# applications-multimedia
   1.376 +c preferences-desktop-screensaver
   1.377 +c preferences-desktop-theme
   1.378 +c preferences-desktop-wallpaper
   1.379 +c system-file-manager
   1.380 +c system-software-install											# synaptic
   1.381 +c system-software-update									# update-notifier
   1.382 +c utilities-system-monitor
   1.383 +c utilities-terminal
   1.384 +#-------------------
   1.385 +c gcolor2						# gcolor2.desktop
   1.386 +c gnome-glchess					# chess.desktop
   1.387 +c gpicview						# gpicview.desktop
   1.388 +c tazcalc gnumeric				# tazcalc.desktop
   1.389 +c alsaplayer gnome-audio		# alsaplayer.desktop
   1.390 +c leafpad						# leafpad.desktop
   1.391 +c midori						# midori.desktop
   1.392 +c mtpaint						# mtpaint.desktop
   1.393 +c xterm							# xterm.desktop
   1.394 +c burn-box brasero				# burn-box.desktop
   1.395 +c iso-image-burn				# burn-iso.desktop
   1.396 +c system-log-out				# lxde-logout.desktop
   1.397 +c sudoku gnome-sudoku			# sudoku.desktop
   1.398 +c utilities-log-viewer			# bootlog.desktop
   1.399 +c preferences-desktop-display	# lxrandr.desktop
   1.400 +c tazbug bug-buddy				# tazbug.desktop
   1.401 +c applets-screenshooter			# mtpaint-grab.desktop
   1.402 +c tazwikiss zim					# tazwikiss.desktop
   1.403 +c system-software-installer		# tazpanel-pkgs.desktop
   1.404 +c session-properties			# lxsession-edit.desktop
   1.405 +c terminal						# sakura.desktop
   1.406 +c user_auth						# passwd.desktop
   1.407 +c preferences-system-time		# tazbox-tz.desktop
   1.408 +c text-editor					# vi.desktop
   1.409 +c drive-harddisk-usb			# tazusb-box.desktop
   1.410 +c drive-optical					# tazlito-wiz.desktop
   1.411 +c network-wireless				# wifi-box.desktop
   1.412 +c gparted						# gparted.desktop
   1.413 +c epdfview acroread				# epdfview.desktop
   1.414 +c menu-editor					# libfm-pref-apps.desktop
   1.415 +c preferences-system-windows	# obconf.desktop
   1.416 +c twitter						# twitter.desktop
   1.417 +c network-server				# httpd.desktop
   1.418 +c pcmanfm system-file-manager	# pcmanfm.desktop
   1.419 +
   1.420 +
   1.421 +
   1.422 +###########################
   1.423 +# Standard Category Icons #
   1.424 +###########################
   1.425 +CATEGORY='categories'; SIZES='16 48'; echo_cat
   1.426 +
   1.427 +c applications-accessories
   1.428 +c applications-development
   1.429 +c applications-engineering
   1.430 +c applications-games
   1.431 +c applications-graphics eog									# Matrilineare hack
   1.432 +c applications-internet web-browser							# Matrilineare hack
   1.433 +c applications-multimedia
   1.434 +c applications-office
   1.435 +c applications-other
   1.436 +c applications-science
   1.437 +c applications-system
   1.438 +c applications-utilities
   1.439 +c preferences-desktop
   1.440 +c preferences-desktop-peripherals
   1.441 +c preferences-desktop-personal
   1.442 +c preferences-other
   1.443 +c preferences-system
   1.444 +c preferences-system-network
   1.445 +c system-help
   1.446 +
   1.447 +
   1.448 +
   1.449 +#########################
   1.450 +# Standard Device Icons #
   1.451 +#########################
   1.452 +CATEGORY='devices'; SIZES='16'; echo_cat
   1.453 +
   1.454 +c audio-card
   1.455 +c audio-input-microphone
   1.456 +c battery
   1.457 +c camera-photo
   1.458 +c camera-video
   1.459 +c camera-web
   1.460 +c computer
   1.461 +c drive-harddisk
   1.462 +c drive-optical
   1.463 +c drive-removable-media drive-harddisk-removable			# Matrilineare hack
   1.464 +c input-gaming
   1.465 +c input-keyboard
   1.466 +c input-mouse
   1.467 +c input-tablet
   1.468 +c media-flash
   1.469 +s media-floppy					# gtk_stock 16,24
   1.470 +s media-optical drive-optical	# gtk_stock 16,24			# Matrilineare hack
   1.471 +c media-tape
   1.472 +c modem
   1.473 +c multimedia-player
   1.474 +c network-wired
   1.475 +c network-wireless
   1.476 +c pda
   1.477 +c phone
   1.478 +c printer
   1.479 +c scanner
   1.480 +c video-display
   1.481 +#---------------------------
   1.482 +c camera camera-photo										# Matrilineare hack
   1.483 +
   1.484 +
   1.485 +#########################
   1.486 +# Standard Emblem Icons #
   1.487 +#########################
   1.488 +CATEGORY='emblems'; SIZES='16'; echo_cat
   1.489 +
   1.490 +c emblem-default
   1.491 +c emblem-documents x-office-document						# Matrilineare hack
   1.492 +c emblem-downloads
   1.493 +c emblem-favorite
   1.494 +c emblem-important
   1.495 +c emblem-mail
   1.496 +c emblem-photos
   1.497 +c emblem-readonly
   1.498 +c emblem-shared
   1.499 +c emblem-symbolic-link
   1.500 +c emblem-synchronized
   1.501 +c emblem-system
   1.502 +c emblem-unreadable
   1.503 +
   1.504 +
   1.505 +
   1.506 +##########################
   1.507 +# Standard Emotion Icons #
   1.508 +##########################
   1.509 +CATEGORY='emotions'; SIZES='16'; echo_cat
   1.510 +
   1.511 +c face-angel
   1.512 +c face-angry
   1.513 +c face-cool
   1.514 +c face-crying
   1.515 +c face-devilish
   1.516 +c face-embarrassed
   1.517 +c face-kiss
   1.518 +c face-laugh
   1.519 +c face-monkey
   1.520 +c face-plain
   1.521 +c face-raspberry
   1.522 +c face-sad
   1.523 +c face-sick
   1.524 +c face-smile
   1.525 +c face-smile-big
   1.526 +c face-smirk
   1.527 +c face-surprise
   1.528 +c face-tired
   1.529 +c face-uncertain
   1.530 +c face-wink
   1.531 +c face-worried
   1.532 +
   1.533 +
   1.534 +
   1.535 +################################
   1.536 +# Standard International Icons #
   1.537 +################################
   1.538 +
   1.539 +#flag-aa
   1.540 +#flag-RU
   1.541 +#flag-UA
   1.542 +
   1.543 +
   1.544 +
   1.545 +############################
   1.546 +# Standard MIME Type Icons #
   1.547 +############################
   1.548 +CATEGORY='mimetypes'; SIZES='48 16'; echo_cat
   1.549 +A='application'
   1.550 +
   1.551 +# generic icons described in the /usr/share/mime/packages/freedesktop.org.xml
   1.552 +c application-x-executable
   1.553 +c audio-x-generic
   1.554 +c font-x-generic
   1.555 +c image-x-generic
   1.556 +c package-x-generic
   1.557 +c text-html
   1.558 +c text-x-generic			# gtk_stock 16,24   but...
   1.559 +c text-x-generic-template
   1.560 +c text-x-script
   1.561 +c video-x-generic
   1.562 +c x-office-address-book
   1.563 +c x-office-calendar
   1.564 +c x-office-document
   1.565 +c x-office-presentation
   1.566 +c x-office-spreadsheet
   1.567 +#--------------------------------------
   1.568 +# special types
   1.569 +c $A-octet-stream
   1.570 +c $A-x-zerosize
   1.571 +
   1.572 +# archives
   1.573 +c $A-gzip
   1.574 +c $A-x-compressed-tar
   1.575 +c $A-x-7z-compressed
   1.576 +c $A-x-ace
   1.577 +c $A-x-arc
   1.578 +c $A-x-archive
   1.579 +c $A-x-rar
   1.580 +c $A-x-tar
   1.581 +c $A-zip
   1.582 +c $A-vnd.ms-cab-compressed
   1.583 +c $A-x-alz
   1.584 +c $A-x-arj
   1.585 +c $A-x-bcpio
   1.586 +c $A-x-bzip
   1.587 +c $A-x-bzip-compressed-tar
   1.588 +c $A-x-lha
   1.589 +c $A-x-lzma
   1.590 +c $A-x-lzma-compressed-tar
   1.591 +c $A-x-lzop
   1.592 +c $A-x-tzo
   1.593 +c $A-x-xar
   1.594 +c $A-x-xz
   1.595 +c $A-x-xz-compressed-tar
   1.596 +
   1.597 +# packages
   1.598 +c $A-vnd.android.package-archive
   1.599 +c $A-x-deb
   1.600 +c $A-x-java-archive
   1.601 +c $A-x-rpm
   1.602 +c $A-x-source-rpm $A-x-rpm
   1.603 +c $A-x-tazpkg
   1.604 +
   1.605 +c $A-illustrator
   1.606 +c $A-javascript
   1.607 +c $A-mbox
   1.608 +c $A-pdf
   1.609 +c $A-pgp-signature
   1.610 +c $A-rtf
   1.611 +c $A-x-apple-diskimage $A-x-cd-image
   1.612 +c $A-x-cbr
   1.613 +c $A-x-cd-image
   1.614 +c $A-x-core
   1.615 +c $A-x-designer
   1.616 +c $A-x-desktop
   1.617 +
   1.618 +c $A-x-theme
   1.619 +c $A-x-emerald-theme $A-x-theme
   1.620 +c $A-x-openbox-theme $A-x-theme
   1.621 +
   1.622 +c $A-x-generic
   1.623 +c $A-x-object
   1.624 +c $A-x-sharedlib
   1.625 +
   1.626 +c $A-x-gettext-translation
   1.627 +c text-x-gettext-translation
   1.628 +c text-x-gettext-translation-template
   1.629 +
   1.630 +c $A-x-gtk-builder
   1.631 +c $A-x-m4
   1.632 +c $A-xml
   1.633 +c $A-x-ms-dos-executable
   1.634 +
   1.635 +c $A-x-perl
   1.636 +c $A-x-python-bytecode
   1.637 +c $A-x-shellscript
   1.638 +c $A-x-sqlite3
   1.639 +c $A-x-trash
   1.640 +c $A-x-x509-ca-cert
   1.641 +
   1.642 +c audio-mpeg
   1.643 +c audio-x-vorbis+ogg
   1.644 +c audio-x-wav
   1.645 +c image-x-eps
   1.646 +c image-x-xcursor
   1.647 +c inode-blockdevice block-device
   1.648 +c inode-chardevice chardevice
   1.649 +c inode-directory
   1.650 +c inode-mount-point
   1.651 +c inode-symlink
   1.652 +c inode-x-generic
   1.653 +c text-css
   1.654 +c text-plain
   1.655 +c text-richtext
   1.656 +c text-x-authors
   1.657 +c text-x-changelog
   1.658 +c text-x-chdr
   1.659 +c text-x-copying
   1.660 +c text-x-csrc
   1.661 +c text-x-install
   1.662 +c text-x-log
   1.663 +c text-x-makefile
   1.664 +c text-x-markdown
   1.665 +c text-x-patch
   1.666 +c text-x-python
   1.667 +c text-x-readme
   1.668 +c text-x-tazpkg-receipt text-x-script
   1.669 +
   1.670 +
   1.671 +
   1.672 +########################
   1.673 +# Standard Place Icons #
   1.674 +########################
   1.675 +CATEGORY='places'; SIZES='16 48'; echo_cat
   1.676 +
   1.677 +c folder			# gtk_stock 16,24
   1.678 +c folder-remote		# gtk_stock 16,24
   1.679 +c network-server
   1.680 +c network-workgroup
   1.681 +c start-here
   1.682 +c user-bookmarks
   1.683 +c user-desktop		# gtk_stock 16,24
   1.684 +c user-home			# gtk_stock 16,24
   1.685 +c user-trash
   1.686 +#------------------
   1.687 +# PCManFM XDG home sub-folders
   1.688 +c folder-documents
   1.689 +c folder-download
   1.690 +c folder-music
   1.691 +c folder-pictures
   1.692 +c folder-publicshare
   1.693 +c folder-templates
   1.694 +c folder-videos
   1.695 +
   1.696 +
   1.697 +#########################
   1.698 +# Standard Status Icons #
   1.699 +#########################
   1.700 +CATEGORY='status'; SIZES='22'; echo_cat
   1.701 +
   1.702 +c appointment-missed
   1.703 +c appointment-soon
   1.704 +c audio-volume-high			# gtk_stock 24
   1.705 +c audio-volume-low			# gtk_stock 24
   1.706 +c audio-volume-medium		# gtk_stock 24
   1.707 +c audio-volume-muted		# gtk_stock 24
   1.708 +c battery-caution
   1.709 +c battery-low
   1.710 +c dialog-error				# gtk_stock 48
   1.711 +c dialog-information		# gtk_stock 16,24,48
   1.712 +c dialog-password			# gtk_stock 48
   1.713 +c dialog-question			# gtk_stock 48
   1.714 +c dialog-warning			# gtk_stock 48
   1.715 +c folder-drag-accept
   1.716 +c folder-open
   1.717 +c folder-visiting
   1.718 +c image-loading
   1.719 +c image-missing				# gtk_stock 16,24
   1.720 +c mail-attachment
   1.721 +c mail-unread
   1.722 +c mail-read
   1.723 +c mail-replied
   1.724 +c mail-signed
   1.725 +c mail-signed-verified
   1.726 +c media-playlist-repeat
   1.727 +c media-playlist-shuffle
   1.728 +c network-error
   1.729 +c network-idle				# gtk_stock 16,24
   1.730 +c network-offline
   1.731 +c network-receive
   1.732 +c network-transmit
   1.733 +c network-transmit-receive
   1.734 +c printer-error				# gtk_stock 16,24
   1.735 +c printer-printing
   1.736 +c security-high
   1.737 +c security-medium
   1.738 +c security-low
   1.739 +c software-update-available
   1.740 +c software-update-urgent
   1.741 +c sync-error
   1.742 +c sync-synchronizing
   1.743 +c task-due
   1.744 +c task-past-due
   1.745 +c user-available
   1.746 +c user-away
   1.747 +c user-idle
   1.748 +c user-offline
   1.749 +#c user-trash-full
   1.750 +c weather-clear
   1.751 +c weather-clear-night
   1.752 +c weather-few-clouds
   1.753 +c weather-few-clouds-night
   1.754 +c weather-fog
   1.755 +c weather-overcast
   1.756 +c weather-severe-alert
   1.757 +c weather-showers
   1.758 +c weather-showers-scattered
   1.759 +c weather-snow
   1.760 +c weather-storm
   1.761 +#------------------
   1.762 +SIZES="48 16"
   1.763 +c user-trash-full			# PCManFM desktop
   1.764 +
   1.765 +
   1.766 +
   1.767 +#####
   1.768 +
   1.769 +echo -n "Original     "; size
   1.770 +
   1.771 +#####
   1.772 +
   1.773 +if [ "$IS" == "yes" ]; then
   1.774 +		echo -n "Inkscape...  "
   1.775 +	# convert svg to png
   1.776 +	# rarely inkscape may fail, good that we leave original file
   1.777 +	find $TO -type f -iname '*.svg' \( -exec sh -c "export E={}; inkscape -z -f \$E -e \${E%svg}png" \; -exec rm {} \; \)
   1.778 +	size
   1.779 +fi
   1.780 +
   1.781 +#####
   1.782 +
   1.783 +if [ "$OP" == "yes" ]; then
   1.784 +	echo -n "Optipng...   "
   1.785 +	# re-compress png files
   1.786 +	find $TO -type f -iname '*.png' -exec optipng -quiet -strip all $PNGOPT {} \;
   1.787 +	size
   1.788 +fi
   1.789 +
   1.790 +#####
   1.791 +
   1.792 +if [ "$SL" == "yes" ]; then
   1.793 +	echo -n "Symlinks...  "
   1.794 +	MD5FILE=$(mktemp); find $TO -type f -exec md5sum {} \; | sort > $MD5FILE
   1.795 +	# substitute repeated files by symlinks
   1.796 +	for md in $(uniq -d -w32 $MD5FILE | cut -c1-32); do
   1.797 +		make_symlinks $(grep $md $MD5FILE | cut -c35-)
   1.798 +	done
   1.799 +	rm "$MD5FILE"
   1.800 +	# make all symlinks relative
   1.801 +	SL=$(symlinks -crs $TO 2> /dev/null)
   1.802 +	size
   1.803 +fi
   1.804 +
   1.805 +#####
   1.806 +
   1.807 +echo -n 'Make index.theme... '
   1.808 +{
   1.809 +	echo "[Icon Theme]"
   1.810 +	echo "Name=$NAME"
   1.811 +
   1.812 +	echo -n "Directories="
   1.813 +	cd "$TO"
   1.814 +	FOLDERS=$(find . -type d -mindepth 2 | sort | sed "s|^\./||g")
   1.815 +	FOLDERS_COMMA=$(echo "$FOLDERS" | tr '\n' ',')
   1.816 +	echo ${FOLDERS_COMMA%,}
   1.817 +
   1.818 +	for FOLDER in $FOLDERS; do
   1.819 +		echo
   1.820 +		echo "[$FOLDER]"
   1.821 +		echo -n "Size="; echo "$FOLDER" | sed 's|^\([0-9]*\).*|\1|'
   1.822 +		echo -n "Context="
   1.823 +		case ${FOLDER#*/} in
   1.824 +			actions)     echo 'Actions'       ;;
   1.825 +			animations)  echo 'Animations'    ;;
   1.826 +			apps)        echo 'Applications'  ;;
   1.827 +			categories)  echo 'Categories'    ;;
   1.828 +			devices)     echo 'Devices'       ;;
   1.829 +			emblems)     echo 'Emblems'       ;;
   1.830 +			emotes)      echo 'Emotes'        ;;
   1.831 +			filesystems) echo 'FileSystems'   ;;
   1.832 +			intl)        echo 'International' ;;
   1.833 +			mimetypes)   echo 'MimeTypes'     ;;
   1.834 +			places)      echo 'Places'        ;;
   1.835 +			status)      echo 'Status'        ;;
   1.836 +			*)           echo 'Other'         ;;
   1.837 +		esac
   1.838 +		echo "Type=Threshold"
   1.839 +	done
   1.840 +} > $TO/index.theme
   1.841 +echo 'Done'