Mercurial > repos > other > usr-local-bin
changeset 13:8052b4f3d142
Add a little script for symlinking icons to other themes
Mainly used for fixing file associations (e.g. mapping text/html icon
to application/x-extension-html)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 23 Feb 2018 21:21:25 +0000 |
parents | 3adc69ceb249 |
children | 92874671d6e1 |
files | link-icon |
diffstat | 1 files changed, 37 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/link-icon Fri Feb 23 21:21:25 2018 +0000 @@ -0,0 +1,37 @@ +#! /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"