Mercurial > repos > other > usr-local-bin
annotate 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 |
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 |
15
1dfa242b3b38
Fix documentation for icon linking script
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
4 echo "Usage: ${0##*/} source_dir theme old-path new-path" >&2 |
1dfa242b3b38
Fix documentation for icon linking script
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
5 echo >&2 |
1dfa242b3b38
Fix documentation for icon linking script
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
6 echo " e.g. ${0##*/} /usr/share/icons/Tango TangoExtra mimetypes/gnome-mime-text-css mimetypes/text-css" >&2 |
13
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 exit 1 |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 elif [[ ! -d "$1" ]]; then |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 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
|
10 exit 1 |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 elif [[ "${1:0:1}" != "/" ]]; then |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 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
|
13 exit 1 |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 elif [[ ! -d ~/.icons/"$2" ]]; then |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 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
|
16 exit 1 |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 fi |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 SOURCE=$1 |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 THEME=$2 |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 ICON_OLD=$3 |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 ICON_NEW=$4 |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 fi |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
29 done |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
30 |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
31 NEW_PREFIX=~/.icons/"$THEME"/scalable |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 OLD_PREFIX="$SOURCE"/scalable |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 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
|
34 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
|
35 fi |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
36 |
8052b4f3d142
Add a little script for symlinking icons to other themes
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
37 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
|
38 gtk-update-icon-cache-3.0 ~/.icons/"$THEME" |