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.39 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.0')
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 command -v gnome-shell >/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
mkdir -p "$THEME_DIR/gtk-$version"
75
ln -s "$SRC_DIR/gtk/assets" "$THEME_DIR/gtk-$version"
76
ln -sT "$SRC_DIR/gtk/$version/gtk$color$size.css" "$THEME_DIR/gtk-$version/gtk.css"
77
[[ "$color" != '-dark' ]] && \
78
ln -sT "$SRC_DIR/gtk/$version/gtk-dark$size.css" "$THEME_DIR/gtk-$version/gtk-dark.css"
79
done
80
81
mkdir -p "$THEME_DIR/metacity-1"
82
ln -s "$SRC_DIR/metacity-1/"{assets,metacity-theme-3.xml} "$THEME_DIR/metacity-1"
83
ln -sT "$SRC_DIR/metacity-1/metacity-theme-2${ELSE_LIGHT:-}.xml" "$THEME_DIR/metacity-1/metacity-theme-2.xml"
84
85
mkdir -p "$THEME_DIR/plank"
86
ln -s "$SRC_DIR/plank/dock.theme" "$THEME_DIR/plank"
87
88
mkdir -p "$THEME_DIR/unity"
89
ln -s "$SRC_DIR/unity/"{*.svg,*.png,dash-widgets.json} "$THEME_DIR/unity"
90
ln -sT "$SRC_DIR/unity/assets${ELSE_LIGHT:-}" "$THEME_DIR/unity/assets"
91
92
mkdir -p "$THEME_DIR/xfwm4"
93
ln -s "$SRC_DIR/xfwm4/"{*.svg,themerc} "$THEME_DIR/xfwm4"
94
ln -sT "$SRC_DIR/xfwm4/assets${ELSE_LIGHT:-}" "$THEME_DIR/xfwm4/assets"
95
96
echo "Installed to '$THEME_DIR'"
97
}
98
99
case "${1:-}" in
100
"")
101
test '' ''
102
;;
103
compact)
104
test '' '-compact'
105
;;
106
dark)
107
test '-dark' ''
108
;;
109
dark-compact)
110
test '-dark' '-compact'
111
;;
112
light)
113
test '-light' ''
114
;;
115
light-compact)
116
test '-light' '-compact'
117
;;
118
all)
119
test '' ''
120
test '' '-compact'
121
test '-dark' ''
122
test '-dark' '-compact'
123
test '-light' ''
124
test '-light' '-compact'
125
;;
126
uninstall)
127
# SC2115: Protect /.
128
rm -rf "${DEST_DIR:?}/$THEME_NAME"{,-compact,-dark,-dark-compact,-light,-light-compact}
129
;;
130
*)
131
echo "Invalid argument: '${1:-}'"
132
echo "Valid arguments are: 'compact' 'dark' 'dark-compact' 'light' 'light-compact' 'all' 'uninstall'"
133
;;
134
esac
135