forked from PapirusDevelopmentTeam/papirus-icon-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-from-theme.sh
executable file
·63 lines (52 loc) · 1.49 KB
/
get-from-theme.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env bash
#
# This script copies icons from the main theme to the directory
set -eo pipefail
readonly SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
readonly SOURCE_DIR="$SCRIPT_DIR/../.."
case "$1" in
all) CONTEXT_DIR="/" ;;
actions|ac*) CONTEXT_DIR="/actions/" ;;
apps|ap*) CONTEXT_DIR="/apps/" ;;
devices|d*) CONTEXT_DIR="/devices/" ;;
emblems|emb*) CONTEXT_DIR="/emblems/" ;;
emotes|emo*) CONTEXT_DIR="/emotes/" ;;
mimetypes|m*) CONTEXT_DIR="/mimetypes/" ;;
panel|pa*) CONTEXT_DIR="/panel/" ;;
places|pl*) CONTEXT_DIR="/places/" ;;
status|st*) CONTEXT_DIR="/status/" ;;
*)
cat <<-EOF
This script copies icons from the main theme to the directory.
Usage:
$0 context PATTERN
available contexts:
all
[ac]tions
[ap]ps
[d]evices
[emb]lems
[emo]tes
[m]imetypes
[pa]nel
[pl]aces
[st]atus
Examples:
$0 apps clementine.svg
$0 panel mumble-indicator.svg
$0 mime text-x-ruby.svg
EOF
exit 2
;;
esac
find "$SOURCE_DIR/Papirus" -type f -name '*.svg' | grep "$CONTEXT_DIR" | \
grep -i "${2:?PATTERN not set!}" | while read -r file; do
src_dir=$(dirname "$file")
top_dir=$(dirname "$src_dir")
base_dir=$(basename "$(dirname "$top_dir")")
size=$(basename "$top_dir")
context=$(basename "$src_dir")
filename=$(basename "$file" .svg)
mkdir -p "$SCRIPT_DIR/$base_dir/$context/"
cp -v "$file" "$SCRIPT_DIR/$base_dir/$context/$filename@$size.svg"
done