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.19 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')
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/gnome-shell"
59
ln -s "$SRC_DIR/gnome-shell/"{extensions,pad-osd.css} "$THEME_DIR/gnome-shell"
60
ln -sT "$SRC_DIR/gnome-shell/assets${ELSE_DARK:-}" "$THEME_DIR/gnome-shell/assets"
61
ln -sT "$SRC_DIR/gnome-shell/$GS_VERSION/gnome-shell$color$size.css" "$THEME_DIR/gnome-shell/gnome-shell.css"
62
63
mkdir -p "$THEME_DIR/gtk-2.0"
64
ln -s "$SRC_DIR/gtk-2.0/"{apps.rc,hacks.rc,main.rc} "$THEME_DIR/gtk-2.0"
65
ln -sT "$SRC_DIR/gtk-2.0/assets${ELSE_DARK:-}" "$THEME_DIR/gtk-2.0/assets"
66
ln -sT "$SRC_DIR/gtk-2.0/gtkrc$color" "$THEME_DIR/gtk-2.0/gtkrc"
67
68
for version in "${GTK_VERSIONS[@]}"; do
69
if [[ "$version" == '3.18' ]]; then
70
mkdir -p "$THEME_DIR/gtk-3.0"
71
ln -s "$SRC_DIR/gtk/assets" "$THEME_DIR/gtk-3.0"
72
ln -sT "$SRC_DIR/gtk/$version/gtk$color.css" "$THEME_DIR/gtk-3.0/gtk.css"
73
[[ "$color" != '-dark' ]] && \
74
ln -sT "$SRC_DIR/gtk/$version/gtk-dark.css" "$THEME_DIR/gtk-3.0/gtk-dark.css"
75
else
76
mkdir -p "$THEME_DIR/gtk-$version"
77
ln -s "$SRC_DIR/gtk/assets" "$THEME_DIR/gtk-$version"
78
ln -sT "$SRC_DIR/gtk/$version/gtk$color$size.css" "$THEME_DIR/gtk-$version/gtk.css"
79
[[ "$color" != '-dark' ]] && \
80
ln -sT "$SRC_DIR/gtk/$version/gtk-dark$size.css" "$THEME_DIR/gtk-$version/gtk-dark.css"
81
fi
82
done
83
84
mkdir -p "$THEME_DIR/metacity-1"
85
ln -s "$SRC_DIR/metacity-1/assets" "$THEME_DIR/metacity-1"
86
ln -sT "$SRC_DIR/metacity-1/metacity-theme-2${ELSE_LIGHT:-}.xml" "$THEME_DIR/metacity-1/metacity-theme-2.xml"
87
ln -sT "$SRC_DIR/metacity-1/metacity-theme-3${ELSE_LIGHT:-}.xml" "$THEME_DIR/metacity-1/metacity-theme-3.xml"
88
89
mkdir -p "$THEME_DIR/unity"
90
ln -s "$SRC_DIR/unity/"{*.svg,*.png,dash-widgets.json} "$THEME_DIR/unity"
91
ln -sT "$SRC_DIR/unity/assets${ELSE_LIGHT:-}" "$THEME_DIR/unity/assets"
92
93
mkdir -p "$THEME_DIR/xfwm4"
94
ln -s "$SRC_DIR/xfwm4/"{*.svg,themerc} "$THEME_DIR/xfwm4"
95
ln -sT "$SRC_DIR/xfwm4/assets${ELSE_LIGHT:-}" "$THEME_DIR/xfwm4/assets"
96
97
echo Installed to "$THEME_DIR"
98
}
99
100
case "${1:-}" in
101
"")
102
test '' ''
103
;;
104
compact)
105
test '' '-compact'
106
;;
107
dark)
108
test '-dark' ''
109
;;
110
dark-compact)
111
test '-dark' '-compact'
112
;;
113
light)
114
test '-light' ''
115
;;
116
light-compact)
117
test '-light' '-compact'
118
;;
119
all)
120
test '' ''
121
test '' '-compact'
122
test '-dark' ''
123
test '-dark' '-compact'
124
test '-light' ''
125
test '-light' '-compact'
126
;;
127
uninstall)
128
# SC2115: Protect /.
129
rm -rf "${DEST_DIR:?}/$THEME_NAME"{,-compact,-dark,-dark-compact,-light,-light-compact}
130
;;
131
*)
132
echo "Invalid argument: ${1:-}"
133
echo "Valid arguments are: compact dark dark-compact light light-compact all uninstall"
134
;;
135
esac
136