blob: 87e36ae9d19e806e32e6c6421cf29fde5e47200d (
plain)
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
73
74
75
76
77
78
79
80
|
#!/usr/bin/env bash
CONFIG_DIR="$1"
if [ -z "$CONFIG_DIR" ]; then
echo "Usage: $0 <config_dir>" >&2
exit 1
fi
apply_qt_colors() {
local config_dir="$1"
local color_scheme_path
color_scheme_path="$(dirname "$config_dir")/.local/share/color-schemes/DankMatugen.colors"
if [ ! -f "$color_scheme_path" ]; then
echo "Error: Qt color scheme not found at $color_scheme_path" >&2
echo "Run matugen first to generate theme files" >&2
exit 1
fi
update_qt_config() {
local config_file="$1"
if [ -f "$config_file" ]; then
if grep -q '^\[Appearance\]' "$config_file"; then
if grep -q '^custom_palette=' "$config_file"; then
sed -i 's/^custom_palette=.*/custom_palette=true/' "$config_file"
else
sed -i '/^\[Appearance\]/a custom_palette=true' "$config_file"
fi
if grep -q '^color_scheme_path=' "$config_file"; then
sed -i "s|^color_scheme_path=.*|color_scheme_path=$color_scheme_path|" "$config_file"
else
sed -i "/^\\[Appearance\\]/a color_scheme_path=$color_scheme_path" "$config_file"
fi
else
{
echo ""
echo "[Appearance]"
echo "custom_palette=true"
echo "color_scheme_path=$color_scheme_path"
} >>"$config_file"
fi
else
{
echo "[Appearance]"
echo "custom_palette=true"
echo "color_scheme_path=$color_scheme_path"
} >"$config_file"
fi
}
qt5_applied=false
qt6_applied=false
if command -v qt5ct >/dev/null 2>&1; then
mkdir -p "$config_dir/qt5ct"
update_qt_config "$config_dir/qt5ct/qt5ct.conf"
echo "Applied Qt5ct configuration"
qt5_applied=true
fi
if command -v qt6ct >/dev/null 2>&1; then
mkdir -p "$config_dir/qt6ct"
update_qt_config "$config_dir/qt6ct/qt6ct.conf"
echo "Applied Qt6ct configuration"
qt6_applied=true
fi
if [ "$qt5_applied" = false ] && [ "$qt6_applied" = false ]; then
echo "Warning: Neither qt5ct nor qt6ct found" >&2
echo "Install qt5ct or qt6ct for Qt application theming" >&2
exit 1
fi
}
apply_qt_colors "$CONFIG_DIR"
echo "Qt colors applied successfully"
|