forked from dgsasha/dg-libadwaita
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·72 lines (63 loc) · 2.01 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /usr/bin/env bash
color_variants=('orange' 'bark' 'sage' 'olive' 'viridian' 'prussiangreen' 'lightblue' 'blue' 'purple' 'magenta' 'pink' 'red')
theme_variants=('light' 'dark')
color="orange"
theme="light"
suffix=""
variant="macos"
gtk4_conf_dir="${HOME}/.config/gtk-4.0"
gtk4_dir="${HOME}/.local/share/themes"
nc='\033[0m'
bold='\033[1m'
red='\033[0;31m'
bgreen='\033[1;32m'
while getopts 't:c:sh' flag; do
case "${flag}" in
t) theme="${OPTARG}" ;;
c) color="${OPTARG}" ;;
s) variant="symbolic" ;;
h)
echo "OPTIONS:"
echo " -t <theme_variant>. Set theme variant."
echo " [light|dark] (Default: light)"
echo " -c <color_name>. Specify accent color."
echo " [orange|bark|sage|olive|viridian|prussiangreen|lightblue|blue|purple|magenta|pink|red]"
echo " (Default: orange)"
echo " -s Enable symbolic libadwaita style window controls."
echo " -h Show this message."
exit 0
;;
*)
exit 1
;;
esac
done
if ! printf '%s\0' "${color_variants[@]}" | grep -Fxqz -- "${color}"; then
>&2 echo "ERROR: Unrecognized accent color '${color}'."
exit 1
fi
if ! printf '%s\0' "${theme_variants[@]}" | grep -Fxqz -- "${theme}"; then
>&2 echo "ERROR: Unrecognized theme variant '${color}'."
exit 1
fi
if [[ "${theme}" == "dark" ]]; then
suffix="-dark"
fi
# Accent colors
cp -rf "gtk-4.0/_accent-colors.scss" "gtk-4.0/_accent-colors-temp.scss"
sed -i "/\$accent_color:/s/orange/${color}/" "gtk-4.0/_accent-colors-temp.scss"
# Install gtk4 configuration
if [[ "$(command -v sassc)" ]]; then
echo -e "${bgreen}Installing${nc} the ${bold}${color} ${theme} qualia Libadwaita theme ${nc}in ${bold}${gtk4_conf_dir}${nc}"
mkdir -p "${gtk4_conf_dir}"
if [[ ${variant} == "macos" ]]; then
cp -rf "gtk-4.0/assets/mac-icons/" "${gtk4_conf_dir}"
else
rm -rf "${gtk4_conf_dir}/mac-icons"
fi
sassc -M -t expanded "gtk-4.0/gtk${suffix}-${variant}.scss" "${gtk4_conf_dir}/gtk.css"
rm -rf "gtk-4.0/_accent-colors-temp.scss"
else
>&2 echo "ERROR: 'sassc' not found."
exit 1
fi