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

88 lines
2.5 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() {
printf "%b\n" "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}"
2024-09-17 13:23:23 +01:00
case "$PACKAGER" in
2024-09-16 15:04:15 +01:00
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y qt6ct kvantum
2024-07-23 22:14:17 +01:00
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install qt6ct kvantum
2024-07-23 22:14:17 +01:00
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y qt6ct kvantum
2024-07-23 22:14:17 +01:00
;;
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qt6ct kvantum
2024-07-23 22:14:17 +01:00
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
2024-07-23 22:14:17 +01:00
exit 1
;;
esac
}
applyTheming() {
printf "%b\n" "${YELLOW}Applying global theming...${RC}"
case "$XDG_CURRENT_DESKTOP" in
KDE)
lookandfeeltool -a org.kde.breezedark.desktop
successOutput
exit 0
;;
GNOME)
gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark"
gsettings set org.gnome.desktop.interface icon-theme "Adwaita"
successOutput
exit 0
;;
*)
return
;;
esac
}
2024-07-23 22:14:17 +01:00
configure_qt6ct() {
printf "%b\n" "${YELLOW}Configuring qt6ct...${RC}"
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
printf "%b\n" "${GREEN}qt6ct configured successfully.${RC}"
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
printf "%b\n" "${YELLOW}Adding QT_QPA_PLATFORMTHEME to /etc/environment...${RC}"
echo "QT_QPA_PLATFORMTHEME=qt6ct" | "$ESCALATION_TOOL" tee -a /etc/environment > /dev/null
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME added to /etc/environment.${RC}"
2024-07-25 23:01:11 +01:00
else
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}"
2024-07-25 23:01:11 +01:00
fi
2024-07-23 22:14:17 +01:00
}
configure_kvantum() {
printf "%b\n" "${YELLOW}Configuring Kvantum...${RC}"
2024-07-23 22:14:17 +01:00
mkdir -p "$HOME/.config/Kvantum"
cat <<EOF > "$HOME/.config/Kvantum/kvantum.kvconfig"
[General]
theme=KvArcDark
2024-07-23 22:14:17 +01:00
EOF
printf "%b\n" "${GREEN}Kvantum configured successfully.${RC}"
2024-07-23 22:14:17 +01:00
}
successOutput() {
printf "%b\n" "${GREEN}Global theming applied successfully.${RC}"
}
2024-07-23 22:14:17 +01:00
checkEnv
2024-08-23 14:12:47 +01:00
checkEscalationTool
applyTheming
2024-07-23 22:14:17 +01:00
install_theme_tools
configure_qt6ct
configure_kvantum
successOutput