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.57 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.26' '3.28' '3.30' '3.32' '3.34' '3.36')
25
LATEST_GS_VERSION="${GS_VERSIONS[-1]}"
26
27
if test -z "${GS_VERSION:-}"; then
28
# Set a proper gnome-shell theme version
29
if command -v gnome-shell >/dev/null; then
30
CURRENT_GS_VERSION="$(gnome-shell --version | cut -d ' ' -f 3 | cut -d . -f -2)"
31
for version in "${GS_VERSIONS[@]}"; do
32
if (( "$(bc <<< "$CURRENT_GS_VERSION <= $version")" )); then
33
GS_VERSION="$version"
34
break
35
else
36
GS_VERSION="$LATEST_GS_VERSION"
37
fi
38
done
39
else
40
GS_VERSION="$LATEST_GS_VERSION"
41
fi
42
fi
43
44
test() {
45
local color="$1"
46
local size="$2"
47
48
[[ "$color" == '-dark' ]] && local ELSE_DARK="$color"
49
[[ "$color" == '-light' ]] && local ELSE_LIGHT="$color"
50
51
local THEME_DIR="${DEST_DIR:?}/$THEME_NAME$color$size"
52
53
# SC2115: Protect /.
54
[[ -d "$THEME_DIR" ]] && rm -rf "${THEME_DIR:?}"
55
56
mkdir -p "$THEME_DIR"
57
ln -sT "$SRC_DIR/index$color$size.theme" "$THEME_DIR/index.theme"
58
59
mkdir -p "$THEME_DIR/cinnamon"
60
ln -s "$SRC_DIR/cinnamon/assets" "$THEME_DIR/cinnamon"
61
ln -s "$SRC_DIR/cinnamon/thumbnail.png" "$THEME_DIR/cinnamon"
62
ln -sT "$SRC_DIR/cinnamon/cinnamon$color$size.css" "$THEME_DIR/cinnamon/cinnamon.css"
63
64
mkdir -p "$THEME_DIR/gnome-shell"
65
ln -s "$SRC_DIR/gnome-shell/"{extensions,pad-osd.css,process-working.svg} "$THEME_DIR/gnome-shell"
66
ln -sT "$SRC_DIR/gnome-shell/assets${ELSE_DARK:-}" "$THEME_DIR/gnome-shell/assets"
67
ln -sT "$SRC_DIR/gnome-shell/$GS_VERSION/gnome-shell$color$size.css" "$THEME_DIR/gnome-shell/gnome-shell.css"
68
69
mkdir -p "$THEME_DIR/gtk-2.0"
70
ln -s "$SRC_DIR/gtk-2.0/"{apps.rc,hacks.rc,main.rc} "$THEME_DIR/gtk-2.0"
71
ln -sT "$SRC_DIR/gtk-2.0/assets${ELSE_DARK:-}" "$THEME_DIR/gtk-2.0/assets"
72
ln -sT "$SRC_DIR/gtk-2.0/gtkrc$color" "$THEME_DIR/gtk-2.0/gtkrc"
73
74
for version in "${GTK_VERSIONS[@]}"; do
75
mkdir -p "$THEME_DIR/gtk-$version"
76
ln -s "$SRC_DIR/gtk/assets" "$THEME_DIR/gtk-$version"
77
ln -s "$SRC_DIR/gtk/icons" "$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
done
82
83
mkdir -p "$THEME_DIR/metacity-1"
84
ln -s "$SRC_DIR/metacity-1/"{assets,metacity-theme-3.xml} "$THEME_DIR/metacity-1"
85
ln -sT "$SRC_DIR/metacity-1/metacity-theme-2$color.xml" "$THEME_DIR/metacity-1/metacity-theme-2.xml"
86
87
mkdir -p "$THEME_DIR/plank"
88
ln -s "$SRC_DIR/plank/dock.theme" "$THEME_DIR/plank"
89
90
mkdir -p "$THEME_DIR/unity"
91
ln -s "$SRC_DIR/unity/"{*.svg,*.png,dash-widgets.json} "$THEME_DIR/unity"
92
ln -sT "$SRC_DIR/unity/assets${ELSE_LIGHT:-}" "$THEME_DIR/unity/assets"
93
94
if [[ "$color" == '-light' ]]; then
95
ln -sT "$SRC_DIR/xfwm4/light" "$THEME_DIR/xfwm4"
96
elif [[ "$color" == '-dark' ]]; then
97
ln -sT "$SRC_DIR/xfwm4/dark" "$THEME_DIR/xfwm4"
98
else
99
ln -sT "$SRC_DIR/xfwm4/default" "$THEME_DIR/xfwm4"
100
fi
101
102
echo "Installed to '$THEME_DIR'"
103
}
104
105
case "${1:-}" in
106
"")
107
test '' ''
108
;;
109
compact)
110
test '' '-compact'
111
;;
112
dark)
113
test '-dark' ''
114
;;
115
dark-compact)
116
test '-dark' '-compact'
117
;;
118
light)
119
test '-light' ''
120
;;
121
light-compact)
122
test '-light' '-compact'
123
;;
124
all)
125
test '' ''
126
test '' '-compact'
127
test '-dark' ''
128
test '-dark' '-compact'
129
test '-light' ''
130
test '-light' '-compact'
131
;;
132
uninstall)
133
# SC2115: Protect /.
134
rm -rf "${DEST_DIR:?}/$THEME_NAME"{,-compact,-dark,-dark-compact,-light,-light-compact}
135
;;
136
*)
137
echo "Invalid argument: '${1:-}'"
138
echo "Valid arguments are: 'compact' 'dark' 'dark-compact' 'light' 'light-compact' 'all' 'uninstall'"
139
;;
140
esac
141