view link-icon @ 38:737061eac1d0 default tip

Skip more large videos and some permission issues
author IBBoard <dev@ibboard.co.uk>
date Wed, 18 Aug 2021 20:40:17 +0100
parents 1dfa242b3b38
children
line wrap: on
line source

#! /bin/bash

if [[ $# -ne 4 ]]; then
	echo "Usage: ${0##*/} source_dir theme old-path new-path" >&2
	echo >&2
	echo "  e.g. ${0##*/} /usr/share/icons/Tango TangoExtra 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"