Mercurial > repos > other > usr-local-bin
view link-icon @ 14:92874671d6e1
Add and exclude more directories and files to focus it/limit file size
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 19 Mar 2018 19:32:37 +0000 |
parents | 8052b4f3d142 |
children | 1dfa242b3b38 |
line wrap: on
line source
#! /bin/bash if [[ $# -ne 4 ]]; then echo "Usage: ${0##*/} source-SOURCE theme old-path new-path" >&2 echo " e.g. ${0##*/} /usr/share/icons/Tango mimetypes/gnome-mime-text-css mimetypes/text-css" >&2 exit 1 elif [[ ! -d "$1" ]]; then echo "Source SOURCE did not exist" >&2 exit 1 elif [[ "${1:0:1}" != "/" ]]; then echo "Source must be absolute. For relative paths use link-icon-relative" exit 1 elif [[ ! -d ~/.icons/"$2" ]]; then echo "Destination theme does not exist" exit 1 fi SOURCE=$1 THEME=$2 ICON_OLD=$3 ICON_NEW=$4 for dir in 16 22 24 32 48 64 128 256 512; do NEW_PREFIX=~/.icons/"$THEME"/${dir}x${dir} OLD_PREFIX="$SOURCE"/${dir}x${dir} if [[ -d "${NEW_PREFIX}"/"${ICON_NEW%/*}" ]] && [[ -f "${OLD_PREFIX}"/"${ICON_OLD}".png ]]; then ln -s "${OLD_PREFIX}"/"${ICON_OLD}".png "${NEW_PREFIX}"/"${ICON_NEW}".png fi done NEW_PREFIX=~/.icons/"$THEME"/scalable OLD_PREFIX="$SOURCE"/scalable if [[ -d "${NEW_PREFIX}"/"${ICON_NEW%/*}" ]] && [[ -f "${OLD_PREFIX}"/"${ICON_OLD}".svg ]]; then ln -s "${OLD_PREFIX}"/"${ICON_OLD}".svg "${NEW_PREFIX}"/"${ICON_NEW}".svg fi gtk-update-icon-cache-2.0 ~/.icons/"$THEME" gtk-update-icon-cache-3.0 ~/.icons/"$THEME"