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.73 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
set -ueo pipefail
12
13
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
14
SRC_DIR="$REPO_DIR/src"
15
16
DEST_DIR="$HOME/.themes"
17
THEME_NAME="Materia.dev"
18
# shellcheck disable=SC2034 # will this be used later?
19
COLOR_VARIANTS=('' '-dark' '-light')
20
# shellcheck disable=SC2034 # will this be used later?
21
SIZE_VARIANTS=('' '-compact')
22
23
GTK_VERSIONS=('3.18' '3.20' '3.22')
24
GS_VERSIONS=('3.18' '3.24' '3.26' '3.28' '3.30')
25
LATEST_GS_VERSION="${GS_VERSIONS[-1]}"
26
27
# Set a proper gnome-shell theme version
28
if [[ "$(which gnome-shell 2> /dev/null)" ]]; then
29
CURRENT_GS_VERSION="$(gnome-shell --version | cut -d ' ' -f 3 | cut -d . -f -2)"
30
for version in "${GS_VERSIONS[@]}"; do
31
if (( "$(bc <<< "$CURRENT_GS_VERSION <= $version")" )); then
32
GS_VERSION="$version"
33
break
34
elif (( "$(bc <<< "$CURRENT_GS_VERSION > $LATEST_GS_VERSION")" )); then
35
GS_VERSION="$LATEST_GS_VERSION"
36
break
37
fi
38
done
39
else
40
GS_VERSION="$LATEST_GS_VERSION"
41
fi
42
43
test() {
44
local color="$1"
45
local size="$2"
46
47
[[ "$color" == '-dark' ]] && local ELSE_DARK="$color"
48
[[ "$color" == '-light' ]] && local ELSE_LIGHT="$color"
49
50
local THEME_DIR="${DEST_DIR:?}/$THEME_NAME$color$size"
51
52
# SC2115: Protect /.
53
[[ -d "$THEME_DIR" ]] && rm -rf "${THEME_DIR:?}"
54
55
mkdir -p "$THEME_DIR"
56
ln -sT "$SRC_DIR/index$color$size.theme" "$THEME_DIR/index.theme"
57
58
mkdir -p "$THEME_DIR/cinnamon"
59
ln -s "$SRC_DIR/cinnamon/assets" "$THEME_DIR/cinnamon"
60
ln -s "$SRC_DIR/cinnamon/thumbnail.png" "$THEME_DIR/cinnamon"
61
ln -sT "$SRC_DIR/cinnamon/cinnamon$color$size.css" "$THEME_DIR/cinnamon/cinnamon.css"
62
63
mkdir -p "$THEME_DIR/gnome-shell"
64
ln -s "$SRC_DIR/gnome-shell/"{extensions,pad-osd.css,process-working.svg} "$THEME_DIR/gnome-shell"
65
ln -sT "$SRC_DIR/gnome-shell/assets${ELSE_DARK:-}" "$THEME_DIR/gnome-shell/assets"
66
ln -sT "$SRC_DIR/gnome-shell/$GS_VERSION/gnome-shell$color$size.css" "$THEME_DIR/gnome-shell/gnome-shell.css"
67
68
mkdir -p "$THEME_DIR/gtk-2.0"
69
ln -s "$SRC_DIR/gtk-2.0/"{apps.rc,hacks.rc,main.rc} "$THEME_DIR/gtk-2.0"
70
ln -sT "$SRC_DIR/gtk-2.0/assets${ELSE_DARK:-}" "$THEME_DIR/gtk-2.0/assets"
71
ln -sT "$SRC_DIR/gtk-2.0/gtkrc$color" "$THEME_DIR/gtk-2.0/gtkrc"
72
73
for version in "${GTK_VERSIONS[@]}"; do
74
if [[ "$version" == '3.18' ]]; then
75
mkdir -p "$THEME_DIR/gtk-3.0"
76
ln -s "$SRC_DIR/gtk/assets" "$THEME_DIR/gtk-3.0"
77
ln -sT "$SRC_DIR/gtk/$version/gtk$color.css" "$THEME_DIR/gtk-3.0/gtk.css"
78
[[ "$color" != '-dark' ]] && \
79
ln -sT "$SRC_DIR/gtk/$version/gtk-dark.css" "$THEME_DIR/gtk-3.0/gtk-dark.css"
80
else
81
mkdir -p "$THEME_DIR/gtk-$version"
82
ln -s "$SRC_DIR/gtk/assets" "$THEME_DIR/gtk-$version"
83
ln -sT "$SRC_DIR/gtk/$version/gtk$color$size.css" "$THEME_DIR/gtk-$version/gtk.css"
84
[[ "$color" != '-dark' ]] && \
85
ln -sT "$SRC_DIR/gtk/$version/gtk-dark$size.css" "$THEME_DIR/gtk-$version/gtk-dark.css"
86
fi
87
done
88
89
mkdir -p "$THEME_DIR/metacity-1"
90
ln -s "$SRC_DIR/metacity-1/"{assets,metacity-theme-3.xml} "$THEME_DIR/metacity-1"
91
ln -sT "$SRC_DIR/metacity-1/metacity-theme-2${ELSE_LIGHT:-}.xml" "$THEME_DIR/metacity-1/metacity-theme-2.xml"
92
93
mkdir -p "$THEME_DIR/unity"
94
ln -s "$SRC_DIR/unity/"{*.svg,*.png,dash-widgets.json} "$THEME_DIR/unity"
95
ln -sT "$SRC_DIR/unity/assets${ELSE_LIGHT:-}" "$THEME_DIR/unity/assets"
96
97
mkdir -p "$THEME_DIR/xfwm4"
98
ln -s "$SRC_DIR/xfwm4/"{*.svg,themerc} "$THEME_DIR/xfwm4"
99
ln -sT "$SRC_DIR/xfwm4/assets${ELSE_LIGHT:-}" "$THEME_DIR/xfwm4/assets"
100
101
echo "Installed to '$THEME_DIR'"
102
}
103
104
case "${1:-}" in
105
"")
106
test '' ''
107
;;
108
compact)
109
test '' '-compact'
110
;;
111
dark)
112
test '-dark' ''
113
;;
114
dark-compact)
115
test '-dark' '-compact'
116
;;
117
light)
118
test '-light' ''
119
;;
120
light-compact)
121
test '-light' '-compact'
122
;;
123
all)
124
test '' ''
125
test '' '-compact'
126
test '-dark' ''
127
test '-dark' '-compact'
128
test '-light' ''
129
test '-light' '-compact'
130
;;
131
uninstall)
132
# SC2115: Protect /.
133
rm -rf "${DEST_DIR:?}/$THEME_NAME"{,-compact,-dark,-dark-compact,-light,-light-compact}
134
;;
135
*)
136
echo "Invalid argument: '${1:-}'"
137
echo "Valid arguments are: 'compact' 'dark' 'dark-compact' 'light' 'light-compact' 'all' 'uninstall'"
138
;;
139
esac
140