linutil/src/commands/system-setup/3-global-theme.sh

77 lines
2.2 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
# Check if the home directory and linuxtoolbox folder exist, create them if they don't
LINUXTOOLBOXDIR="$HOME/linuxtoolbox"
if [ ! -d "$LINUXTOOLBOXDIR" ]; then
2024-07-25 23:01:11 +01:00
printf "${YELLOW}Creating linuxtoolbox directory: %s${RC}\n" "$LINUXTOOLBOXDIR"
2024-07-23 22:14:17 +01:00
mkdir -p "$LINUXTOOLBOXDIR"
2024-07-25 23:01:11 +01:00
printf "${GREEN}linuxtoolbox directory created: %s${RC}\n" "$LINUXTOOLBOXDIR"
2024-07-23 22:14:17 +01:00
fi
cd "$LINUXTOOLBOXDIR" || exit
install_theme_tools() {
2024-07-25 23:01:11 +01:00
printf "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}\n"
2024-07-23 22:14:17 +01:00
case $PACKAGER in
apt-get)
sudo apt-get update
sudo apt-get install -y qt6ct kvantum
;;
zypper)
sudo zypper refresh
sudo zypper --non-interactive install qt6ct kvantum
;;
dnf)
sudo dnf update
sudo dnf install -y qt6ct kvantum
;;
pacman)
sudo pacman -Sy
sudo pacman --noconfirm -S qt6ct kvantum
;;
*)
2024-07-25 23:01:11 +01:00
printf "${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-07-25 23:01:11 +01:00
printf "${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-07-25 23:01:11 +01:00
printf "${GREEN}qt6ct configured successfully.${RC}\n"
# Add QT_QPA_PLATFORMTHEME to /etc/environment
if ! grep -q "QT_QPA_PLATFORMTHEME=qt6ct" /etc/environment; then
printf "${YELLOW}Adding QT_QPA_PLATFORMTHEME to /etc/environment...${RC}\n"
echo "QT_QPA_PLATFORMTHEME=qt6ct" | sudo tee -a /etc/environment > /dev/null
printf "${GREEN}QT_QPA_PLATFORMTHEME added to /etc/environment.${RC}\n"
else
printf "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}\n"
fi
2024-07-23 22:14:17 +01:00
}
configure_kvantum() {
2024-07-25 23:01:11 +01:00
printf "${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-07-25 23:01:11 +01:00
printf "${GREEN}Kvantum configured successfully.${RC}\n"
2024-07-23 22:14:17 +01:00
}
checkEnv
install_theme_tools
configure_qt6ct
configure_kvantum