-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert_xresources
executable file
·73 lines (65 loc) · 1.49 KB
/
convert_xresources
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
#!/bin/sh
if [ "$1" == -h ]
then
echo "Usage: convert_xresources [OPTION]"
echo " -A Define accent color, default to CURCOL"
echo " -f Specify .Xresources file to convert"
echo " -Fm Specify monospace font default to Source Code Pro"
echo " -Fs Specify Sans Serif font default to Roboto"
exit
fi
while [ -n "$1" ]; do
case "$1" in
-f)
file=$2
shift
;;
-A)
accent=$2
shift
;;
-Fm)
monospace=$2
;;
-Fs)
sans=$2
;;
esac
shift
done
echo "" >> .Xresources
if [ -z "$file" ]
then
echo "No file specified"
exit
else
echo "! Generated with Minoflat's convert_xresources" > .Xresources
echo "" >> .Xresources
sed "s/\*\.color/#define C/ig" $file | sed "s/://ig" |sed "s/*.fore/#define F/ig"|sed "s/*.back/#define B/ig"|sed "s/ground/G/ig"|sed "s/*.cursorColor/#define CURCOL/ig" >> .Xresources
echo "" >> .Xresources
if [ -z "$accent" ]
then
echo "#define ACC CURCOL" >> .Xresources
else
echo "#define ACC C$accent" >> .Xresources
fi
echo "" >> .Xresources
echo "! Fonts" >> .Xresources
if [ -z "$monospace" ]
then
echo "#define xresources_monospace Source Code Pro" >> .Xresources
else
echo "#define xresources_monospace $monospace" >> .Xresources
fi
if [ -z "$sans" ]
then
echo "#define xresources_sansserif Roboto" >> .Xresources
else
echo "#define xresources_monospace $sans" >> .Xresources
fi
echo "" >> .Xresources
echo "! Includes" >> .Xresources
for f in ~/.Xresources.d/* ; do
echo "#include \"$f\"" >> .Xresources
done
fi