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.48 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/dash-buttons/"* "$THEME_DIR/unity"
92
ln -s "$SRC_DIR/unity/dash-widgets.json" "$THEME_DIR/unity"
93
ln -s "$SRC_DIR/unity/launcher/"* "$THEME_DIR/unity"
94
ln -s "$SRC_DIR/unity/window-buttons${ELSE_LIGHT:-}/"* "$THEME_DIR/unity"
95
96
ln -sT "$SRC_DIR/xfwm4/xfwm4$color" "$THEME_DIR/xfwm4"
97
98
echo "Installed to '$THEME_DIR'"
99
}
100
101
case "${1:-}" in
102
"")
103
test '' ''
104
;;
105
compact)
106
test '' '-compact'
107
;;
108
dark)
109
test '-dark' ''
110
;;
111
dark-compact)
112
test '-dark' '-compact'
113
;;
114
light)
115
test '-light' ''
116
;;
117
light-compact)
118
test '-light' '-compact'
119
;;
120
all)
121
test '' ''
122
test '' '-compact'
123
test '-dark' ''
124
test '-dark' '-compact'
125
test '-light' ''
126
test '-light' '-compact'
127
;;
128
uninstall)
129
# SC2115: Protect /.
130
rm -rf "${DEST_DIR:?}/$THEME_NAME"{,-compact,-dark,-dark-compact,-light,-light-compact}
131
;;
132
*)
133
echo "Invalid argument: '${1:-}'"
134
echo "Valid arguments are: 'compact' 'dark' 'dark-compact' 'light' 'light-compact' 'all' 'uninstall'"
135
;;
136
esac
137