linutil/tabs/system-setup/3-global-theme.sh

66 lines
2.0 KiB
Bash
Raw Normal View History

2024-07-23 22:14:17 +01:00
#!/bin/sh -e
. ../common-script.sh
2024-07-23 22:14:17 +01:00
install_theme_tools() {
2024-09-12 21:14:50 +01:00
printf "%b\n" "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}\n"
2024-07-23 22:14:17 +01:00
case $PACKAGER in
2024-09-16 15:04:15 +01:00
apt-get|nala)
$ESCALATION_TOOL "${PACKAGER}" update
$ESCALATION_TOOL "${PACKAGER}" install -y qt6ct kvantum
2024-07-23 22:14:17 +01:00
;;
zypper)
2024-09-16 15:04:15 +01:00
$ESCALATION_TOOL "${PACKAGER}" refresh
$ESCALATION_TOOL "${PACKAGER}" --non-interactive install qt6ct kvantum
2024-07-23 22:14:17 +01:00
;;
dnf)
2024-09-16 15:04:15 +01:00
$ESCALATION_TOOL "${PACKAGER}" update
$ESCALATION_TOOL "${PACKAGER}" install -y qt6ct kvantum
2024-07-23 22:14:17 +01:00
;;
pacman)
2024-09-16 15:04:15 +01:00
$ESCALATION_TOOL "${PACKAGER}" -S --needed --noconfirm qt6ct kvantum
2024-07-23 22:14:17 +01:00
;;
*)
2024-09-12 21:14:50 +01:00
printf "%b\n" "${RED}Unsupported package manager. Please install qt6ct and kvantum manually.${RC}\n"
2024-07-23 22:14:17 +01:00
exit 1
;;
esac
}
configure_qt6ct() {
2024-09-12 21:14:50 +01:00
printf "%b\n" "${YELLOW}Configuring qt6ct...${RC}\n"
2024-07-23 22:14:17 +01:00
mkdir -p "$HOME/.config/qt6ct"
cat <<EOF > "$HOME/.config/qt6ct/qt6ct.conf"
[Appearance]
style=kvantum
color_scheme=default
icon_theme=breeze
EOF
2024-09-12 21:14:50 +01:00
printf "%b\n" "${GREEN}qt6ct configured successfully.${RC}\n"
2024-07-25 23:01:11 +01:00
# Add QT_QPA_PLATFORMTHEME to /etc/environment
if ! grep -q "QT_QPA_PLATFORMTHEME=qt6ct" /etc/environment; then
2024-09-12 21:14:50 +01:00
printf "%b\n" "${YELLOW}Adding QT_QPA_PLATFORMTHEME to /etc/environment...${RC}\n"
2024-08-23 14:12:47 +01:00
echo "QT_QPA_PLATFORMTHEME=qt6ct" | $ESCALATION_TOOL tee -a /etc/environment > /dev/null
2024-09-12 21:14:50 +01:00
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME added to /etc/environment.${RC}\n"
2024-07-25 23:01:11 +01:00
else
2024-09-12 21:14:50 +01:00
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}\n"
2024-07-25 23:01:11 +01:00
fi
2024-07-23 22:14:17 +01:00
}
configure_kvantum() {
2024-09-12 21:14:50 +01:00
printf "%b\n" "${YELLOW}Configuring Kvantum...${RC}\n"
2024-07-23 22:14:17 +01:00
mkdir -p "$HOME/.config/Kvantum"
cat <<EOF > "$HOME/.config/Kvantum/kvantum.kvconfig"
[General]
theme=Breeze
EOF
2024-09-12 21:14:50 +01:00
printf "%b\n" "${GREEN}Kvantum configured successfully.${RC}\n"
2024-07-23 22:14:17 +01:00
}
checkEnv
2024-08-23 14:12:47 +01:00
checkEscalationTool
2024-07-23 22:14:17 +01:00
install_theme_tools
configure_qt6ct
configure_kvantum