-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCursorConvertPackage.sh
More file actions
executable file
·136 lines (115 loc) · 4.57 KB
/
CursorConvertPackage.sh
File metadata and controls
executable file
·136 lines (115 loc) · 4.57 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
echo "=================================================================================================================================="
echo "=================================================================================================================================="
echo "This is a Bash Shell script that converts and packages multiple Windows .ani cursors into installable Linux X11 cursors."
echo "The conversion into usable XCursor file for linux is done by the 'win2xcur' tool by 'quantum5'."
echo "=================================================================================================================================="
echo "=================================================================================================================================="
read -p "Enter the Name for this Cursor Package: " Package_name
read -p "Enter a description for the Cursor Package: " Package_desc
read -p "Enter the Directory of the .ani/.cur Windows cursors: " input_dir
read -p "Enter the Output Directory: " output_dir
read -p "Add Shadows to Cursors? (y/n): " shadows
output_dir="$output_dir"/"$Package_name"
# Symbolic Links for cursors are obtained from Breeze cursors and modified slightly.
symbolic0=("arrow" "left_ptr" "size-bdiag" "size-fdiag" "size-hor" "size-ver" "top_left_arrow")
symbolic1=("5c6cd98b3f3ebcb1f9c7f1c204630408" "d9ce0ab605698f320427677b458ad60b" "left_ptr_help" "question_arrow" "whats_this")
symbolic2=("00000000000000020006000e7e9ffc3f" "08e8e1c95fe2fc01f976f1e063a24ccd" "3ecb610c1bf2410f44200f48c40d3599" "half-busy" "left_ptr_watch")
symbolic3=("watch")
symbolic4=("cross" "tcross")
symbolic5=("ibeam" "xterm")
symbolic6=("draft")
symbolic7=("circle" "crossed_circle")
symbolic8=("00008160000006810000408080010102" "n-resize" "ns-resize" "s-resize" "sb_v_double_arrow" "v_double_arrow")
symbolic9=("e-resize" "ew-resize" "h_double_arrow" "sb_h_double_arrow" "w-resize")
symbolic10=("nw-resize" "nwse-resize" "se-resize")
symbolic11=("ne-resize" "nesw-resize" "sw-resize")
symbolic12=("4498f0e0c1937ffe01fd06f973665830" "9081237383d90e509aa00f00170e968f" "closedhand" "dnd-none" "fcf21c00b30f7e3f83fe0dfd12e71cff" "move" "all-scroll" "fleur" "size_all")
symbolic13=("link" "alias" "640fb0e74195791501fd1ed57b41487f" "3085a0e285430894940527032f8b26df" "a2a266d0498c3104214a47bd64ab0fc8")
symbolic14=("9d800788f1b08800ae810202380a0822" "e29285e634086352946a0e7090d73106" "hand1" "hand2" "pointing_hand")
symbolic=("symbolic0" "symbolic1" "symbolic2" "symbolic3" "symbolic4" "symbolic5" "symbolic6" "symbolic7" "symbolic8" "symbolic9" "symbolic10" "symbolic11" "symbolic12" "symbolic13" "symbolic14")
declare -a linux_names=(
[0]="default"
[1]="help"
[2]="progress"
[3]="wait"
[4]="crosshair"
[5]="text"
[6]="pencil"
[7]="not-allowed"
[8]="size_ver"
[9]="size_hor"
[10]="size_fdiag"
[11]="size_bdiag"
[12]="dnd-move"
[13]="up-arrow"
[14]="pointer"
)
declare -a windows_names=(
[0]="normal"
[1]="help"
[2]="working"
[3]="busy"
[4]="crosshair"
[5]="text"
[6]="handwriting"
[7]="unavailable"
[8]="vertical"
[9]="horizontal"
[10]="diagonal1"
[11]="diagonal2"
[12]="move"
[13]="alternate"
[14]="link"
)
function convert() {
echo "Converting .ani/.cur cursors"
mkdir -p "$output_dir/cursors"
win2xcur "$input_dir"/*.ani -o "$output_dir/cursors"
win2xcur "$input_dir"/*.cur -o "$output_dir/cursors"
}
function convert_shadows() {
echo "Converting .ani/.cur cursors"
mkdir -p "$output_dir/cursors"
win2xcur "$input_dir"/*.ani -o "$output_dir/cursors" -s
win2xcur "$input_dir"/*.cur -o "$output_dir/cursors" -s
}
function cursor_rename() {
echo "Renaming converted cursors into XCursor file names"
cd "$output_dir/cursors" || echo "Output path not found"
for wincursor in "${!windows_names[@]}"; do
file="${windows_names[$wincursor]}"
if [[ -e "$file" ]]; then
mv "$file" "${linux_names[$wincursor]}"
else
echo "File \"${windows_names[$wincursor]}\" not found"
fi
done
}
function symlinks() {
echo "Creating Symbolic links for cursors"
for lincursor in "${!linux_names[@]}"; do
declare -n symboliclink="${symbolic[$lincursor]}"
for symlink in "${!symboliclink[@]}"; do
ln -s "${linux_names[$lincursor]}" "${symboliclink[$symlink]}"
done
done
}
function index_maker() {
cd .. || exit
touch index.theme
(
echo "[Icon Theme]"
echo "Name=$Package_name"
echo "Comment=$Package_desc"
) >>index.theme
}
case $shadows in
[yY]*) convert_shadows ;;
[nN]*) convert ;;
*) echo "invalid response" ;;
esac
cursor_rename
symlinks
index_maker
echo "Finished."