annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 #! /bin/bash
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 if [[ $# -ne 4 ]]; then
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 echo "Usage: ${0##*/} source-SOURCE theme old-path new-path" >&2
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 echo " e.g. ${0##*/} /usr/share/icons/Tango mimetypes/gnome-mime-text-css mimetypes/text-css" >&2
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 exit 1
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 elif [[ ! -d "$1" ]]; then
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 echo "Source SOURCE did not exist" >&2
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 exit 1
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 elif [[ "${1:0:1}" != "/" ]]; then
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 echo "Source must be absolute. For relative paths use link-icon-relative"
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 exit 1
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 elif [[ ! -d ~/.icons/"$2" ]]; then
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 echo "Destination theme does not exist"
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 exit 1
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 fi
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 SOURCE=$1
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 THEME=$2
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 ICON_OLD=$3
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 ICON_NEW=$4
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 for dir in 16 22 24 32 48 64 128 256 512; do
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 NEW_PREFIX=~/.icons/"$THEME"/${dir}x${dir}
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 OLD_PREFIX="$SOURCE"/${dir}x${dir}
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 if [[ -d "${NEW_PREFIX}"/"${ICON_NEW%/*}" ]] && [[ -f "${OLD_PREFIX}"/"${ICON_OLD}".png ]]; then
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 ln -s "${OLD_PREFIX}"/"${ICON_OLD}".png "${NEW_PREFIX}"/"${ICON_NEW}".png
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 fi
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 done
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 NEW_PREFIX=~/.icons/"$THEME"/scalable
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 OLD_PREFIX="$SOURCE"/scalable
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 if [[ -d "${NEW_PREFIX}"/"${ICON_NEW%/*}" ]] && [[ -f "${OLD_PREFIX}"/"${ICON_OLD}".svg ]]; then
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 ln -s "${OLD_PREFIX}"/"${ICON_OLD}".svg "${NEW_PREFIX}"/"${ICON_NEW}".svg
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 fi
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 gtk-update-icon-cache-2.0 ~/.icons/"$THEME"
8052b4f3d142 Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 gtk-update-icon-cache-3.0 ~/.icons/"$THEME"