A fork of the Materia GTK theme.

Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

 test.sh

View raw Download
text/x-shellscript • 5.22 kiB
Bourne-Again shell script, ASCII text executable
        
            
1
#!/bin/bash
2
#
3
# Once run the script, no need to run ./install.sh for testing. ;)
4
# Without an argument, this will install only normal variant.
5
# Valid arguments are:
6
#
7
# compact dark dark-compact light light-compact all uninstall
8
#
9
# FIXME: `unity` and `xfwm4` are not fully supported for now since `*.svg` link incorrect locales (with '-light' variant).
10
# FIXME: Multiple arguments should be allowed.
11
12
REPO_DIR=$(cd $(dirname $0) && pwd)
13
SRC_DIR=${REPO_DIR}/src
14
15
DEST_DIR=~/.themes
16
THEME_NAME=Materia.dev
17
COLOR_VARIANTS=('' '-dark' '-light')
18
SIZE_VARIANTS=('' '-compact')
19
20
GTK_VERSIONS=('3.18' '3.20' '3.22')
21
GS_VERSIONS=('3.18' '3.24' '3.26')
22
LATEST_GS_VERSION=${GS_VERSIONS[@]: -1}
23
24
# Set a proper gnome-shell theme version
25
if [[ $(which gnome-shell 2> /dev/null) ]]; then
26
CURRENT_GS_VERSION=$(gnome-shell --version | cut -d ' ' -f 3 | cut -d . -f -2)
27
for version in "${GS_VERSIONS[@]}"; do
28
if (( $(echo "$CURRENT_GS_VERSION <= $version" | bc) )); then
29
GS_VERSION=${version}
30
break
31
elif (( $(echo "$CURRENT_GS_VERSION > $LATEST_GS_VERSION" | bc) )); then
32
GS_VERSION=${LATEST_GS_VERSION}
33
break
34
fi
35
done
36
else
37
GS_VERSION=${LATEST_GS_VERSION}
38
fi
39
40
test() {
41
local color=${1}
42
local size=${2}
43
44
[[ ${color} == '-dark' ]] && local ELSE_DARK=${color}
45
[[ ${color} == '-light' ]] && local ELSE_LIGHT=${color}
46
47
local THEME_DIR=${DEST_DIR}/${THEME_NAME}${color}${size}
48
49
[[ -d ${THEME_DIR} ]] && rm -rf ${THEME_DIR}
50
51
mkdir -p ${THEME_DIR}
52
ln -sT ${SRC_DIR}/index${color}${size}.theme ${THEME_DIR}/index.theme
53
54
mkdir -p ${THEME_DIR}/gnome-shell
55
ln -s ${SRC_DIR}/gnome-shell/{extensions,pad-osd.css} ${THEME_DIR}/gnome-shell
56
ln -sT ${SRC_DIR}/gnome-shell/assets${ELSE_DARK} ${THEME_DIR}/gnome-shell/assets
57
ln -sT ${SRC_DIR}/gnome-shell/${GS_VERSION}/gnome-shell${color}${size}.css ${THEME_DIR}/gnome-shell/gnome-shell.css
58
59
mkdir -p ${THEME_DIR}/gtk-2.0
60
ln -s ${SRC_DIR}/gtk-2.0/{apps.rc,hacks.rc,main.rc} ${THEME_DIR}/gtk-2.0
61
ln -sT ${SRC_DIR}/gtk-2.0/assets${ELSE_DARK} ${THEME_DIR}/gtk-2.0/assets
62
ln -sT ${SRC_DIR}/gtk-2.0/gtkrc${color} ${THEME_DIR}/gtk-2.0/gtkrc
63
64
for version in "${GTK_VERSIONS[@]}"; do
65
if [[ ${version} == '3.18' ]]; then
66
mkdir -p ${THEME_DIR}/gtk-3.0
67
ln -s ${SRC_DIR}/gtk/assets ${THEME_DIR}/gtk-3.0
68
ln -sT ${SRC_DIR}/gtk/${version}/gtk${color}.css ${THEME_DIR}/gtk-3.0/gtk.css
69
[[ ${color} != '-dark' ]] && \
70
ln -sT ${SRC_DIR}/gtk/${version}/gtk-dark.css ${THEME_DIR}/gtk-3.0/gtk-dark.css
71
else
72
mkdir -p ${THEME_DIR}/gtk-${version}
73
ln -s ${SRC_DIR}/gtk/assets ${THEME_DIR}/gtk-${version}
74
ln -sT ${SRC_DIR}/gtk/${version}/gtk${color}${size}.css ${THEME_DIR}/gtk-${version}/gtk.css
75
[[ ${color} != '-dark' ]] && \
76
ln -sT ${SRC_DIR}/gtk/${version}/gtk-dark${size}.css ${THEME_DIR}/gtk-${version}/gtk-dark.css
77
fi
78
done
79
80
mkdir -p ${THEME_DIR}/metacity-1
81
ln -s ${SRC_DIR}/metacity-1/assets ${THEME_DIR}/metacity-1
82
ln -sT ${SRC_DIR}/metacity-1/metacity-theme-2${ELSE_LIGHT}.xml ${THEME_DIR}/metacity-1/metacity-theme-2.xml
83
ln -sT ${SRC_DIR}/metacity-1/metacity-theme-3${ELSE_LIGHT}.xml ${THEME_DIR}/metacity-1/metacity-theme-3.xml
84
85
mkdir -p ${THEME_DIR}/unity
86
ln -s ${SRC_DIR}/unity/{*.svg,*.png,dash-widgets.json} ${THEME_DIR}/unity
87
ln -sT ${SRC_DIR}/unity/assets${ELSE_LIGHT} ${THEME_DIR}/unity/assets
88
89
mkdir -p ${THEME_DIR}/xfwm4
90
ln -s ${SRC_DIR}/xfwm4/{*.svg,themerc} ${THEME_DIR}/xfwm4
91
ln -sT ${SRC_DIR}/xfwm4/assets${ELSE_LIGHT} ${THEME_DIR}/xfwm4/assets
92
93
echo Installed to ${THEME_DIR}
94
}
95
96
case "${1}" in
97
"")
98
test '' ''
99
;;
100
compact)
101
test '' '-compact'
102
;;
103
dark)
104
test '-dark' ''
105
;;
106
dark-compact)
107
test '-dark' '-compact'
108
;;
109
light)
110
test '-light' ''
111
;;
112
light-compact)
113
test '-light' '-compact'
114
;;
115
all)
116
test '' ''
117
test '' '-compact'
118
test '-dark' ''
119
test '-dark' '-compact'
120
test '-light' ''
121
test '-light' '-compact'
122
;;
123
uninstall)
124
rm -rf ${DEST_DIR}/${THEME_NAME}{,-compact,-dark,-dark-compact,-light,-light-compact}
125
;;
126
*)
127
echo "Invalid argument: ${1}"
128
echo "Valid arguments are: compact dark dark-compact light light-compact all uninstall"
129
;;
130
esac
131