#!/bin/bash

set -x

sudo rm -f /etc/xdg/kdeglobals /etc/xdg/kwinrc /etc/xdg/plasmarc /etc/xdg/plasma-org.kde.plasma.desktop-appletsrc

echo "Configuring the global theme..."
# WORKING!
wget https://winesapos.lukeshort.cloud/desktop/Amy-Light-Global-6.tar.gz
sudo tar -x -v -f Amy-Light-Global-6.tar.gz -C /usr/share/plasma/look-and-feel/
echo -e '[KDE][$i]\nLookAndFeelPackage=Amy-Light-Global-6' | sudo tee -a /etc/xdg/kdeglobals
echo "Configuring the global theme done."

echo "Configurng the plasma style..."
# WORKING!
wget https://winesapos.lukeshort.cloud/desktop/Amy-Light-Plasma.tar.gz
sudo tar -x -v -f Amy-Light-Plasma.tar.gz -C /usr/share/plasma/desktoptheme/
echo -e '[Theme][$i]\nname=Amy-Light-Plasma' | sudo tee -a /etc/xdg/plasmarc
echo "Configurng the plasma style done."

echo "Configuring windows decorations..."
# WORKING!
sudo mkdir -p /usr/share/aurorae/themes/
wget https://winesapos.lukeshort.cloud/desktop/Amy-Blur-Light-Aurorae-6.tar.gz
sudo tar -x -v -f Amy-Blur-Light-Aurorae-6.tar.gz -C /usr/share/aurorae/themes/
echo -e '[org.kde.kdecoration2][$i]\nlibrary=org.kde.kwin.aurorae\ntheme=__aurorae__svg__Amy-Blur-Light-Aurorae-6' | sudo tee -a /etc/xdg/kwinrc
echo "Configuring windows decorations done."

echo "Configuring icons..."
# WORKING!
wget https://winesapos.lukeshort.cloud/desktop/kora-1.6.5.zip
sudo unzip kora-1.6.5.zip -d /usr/share/icons/
sudo mv /usr/share/icons/kora-1.6.5/kora /usr/share/icons/
sudo rm -r -f /usr/share/icons/kora-1.6.5
echo -e '[Icons][$i]\nTheme=kora' | sudo tee -a /etc/xdg/kdeglobals
echo "Configuring icons done."

echo "Configuring color schemes..."
# WORKING!
wget https://winesapos.lukeshort.cloud/desktop/AmyLightColor.colors
sudo cp AmyLightColor.colors /usr/share/color-schemes/
echo '[General][$i]\nColorScheme=AmyLightColor' | sudo tee -a /etc/xdg/kdeglobals
echo "Configuring color schemes done."

echo "Configuring wallpaper..."
# NOT WORKING
#sudo mkdir -p /usr/share/wallpapers/green/
#sudo cp wallpaper-green.png /usr/share/wallpapers/green/
#echo -e '[Wallpapers][$i]\nusersWallpapers=/usr/share/wallpapers/green/wallpaper-green.png' | sudo tee -a /etc/xdg/plasmarc

#sudo mkdir -p /usr/share/wallpapers/green/
#sudo cp wallpaper-green.png /usr/share/wallpapers/green/
#echo -e '[Wallpapers][$i]\nusersWallpapers=/usr/share/wallpapers/green/wallpaper-green.png' | sudo tee -a /etc/xdg/plasmarc
#echo -e '[Containments][1][Wallpaper][org.kde.iamge][General][$i]\nImage=/usr/share/wallpapers/green/wallpaper-green.png' | sudo tee -a /etc/xdg/plasma-org.kde.plasma.desktop-appletsrc

#sudo mkdir -p /usr/share/wallpapers/green/
#sudo cp wallpaper-green.png /usr/share/wallpapers/green/
#echo -e '[Wallpapers][$i]\nusersWallpapers=/usr/share/wallpapers/green/wallpaper-green.png' | sudo tee -a /etc/xdg/plasmarc
#echo -e '[Containments][1][Wallpaper][org.kde.iamge][General][$i]\nImage=/usr/share/wallpapers/green/wallpaper-green.png\nSlidePaths=/usr/share/wallpapers/' | sudo tee -a /etc/xdg/plasma-org.kde.plasma.desktop-appletsrc

#sudo mkdir -p /usr/share/wallpapers/green/
#sudo cp wallpaper-green.png /usr/share/wallpapers/green/
#echo -e '[Wallpapers][$i]\nusersWallpapers=/usr/share/wallpapers/green/wallpaper-green.png' | sudo tee -a /etc/xdg/plasmarc
#echo -e '[Containments][1][Wallpaper][org.kde.image][General][$i]\nImage=/usr/share/wallpapers/green/wallpaper-green.png\nSlidePaths=/usr/share/wallpapers/' | sudo tee -a /etc/xdg/plasma-org.kde.plasma.desktop-appletsrc

# Testing
wget https://winesapos.lukeshort.cloud/desktop/wallpaper-green.png
sudo mkdir -p /usr/share/wallpapers/green/
sudo cp wallpaper-green.png /usr/share/wallpapers/green/
echo "Configuring wallpaper done."

echo "Configuring the start menu button..."
# NOT WORKING
#sudo mkdir -p /usr/share/icons/h/
#sudo cp h-logo-black.svg /usr/share/icons/h/
#echo -e '[Containments][2][Applets][3][Configuration][General][$i]\nicon=/usr/share/icons/h/h-logo-black.svg' | sudo tee -a /etc/xdg/plasma-org.kde.plasma.desktop-appletsrc

# Testing
wget https://winesapos.lukeshort.cloud/desktop/h-logo-black.svg
sudo mkdir -p /usr/share/icons/h/
sudo cp h-logo-black.svg /usr/share/icons/h/
echo "Configuring the start menu button done."
