#!/usr/bin/env bash
sudo apt install -y gnome-themes-extra
sudo apt install -y mate-themes
sudo apt install -y albatross-gtk-theme
sudo apt install -y blackbird-gtk-theme
sudo apt install -y greybird-gtk-theme
sudo apt install -y adwaita-icon-theme
sudo apt install -y adwaita-qt adwaita-qt6

sudo apt install -y gtk2-engines-murrine gtk2-engines-pixbuf

cd /var/tmp || exit
git clone --depth 1 http://github.com/vinceliuice/stylish-gtk-theme /var/tmp/stylish-gtk-theme
pushd /var/tmp/stylish-gtk-theme || exit
./Install
popd || exit
rm -rf /var/tmp/stylish-gtk-theme

dbus-launch --exit-with-session gsettings set org.gnome.desktop.interface gtk-theme "Stylish-Dark-Laptop"
dbus-launch --exit-with-session gsettings set org.gnome.desktop.wm.preferences theme "Stylish-Dark-Laptop"

## Dark for qt4/5
# qt4
sed -i '/[Qt]/a style=GTK+' "${DEST}"/.config/Trolltech.conf

# install both qt5 and qt6 theme setting programs
sudo apt install -y qt6ct qt5ct

# ~/.config/qt5ct/qt5ct.conf
# ~/.config/qt6ct/qt6ct.conf

# [Appearance]
# custom_palette=false
# style=Adwaita-Dark

QT_STYLE="Adwaita-Dark"

if grep -q "QT_STYLE_OVERRIDE=${QT_STYLE}" /etc/environment/99-qt-style.conf; then
	mkdir -p /etc/environment.d
	cat <<-EOF | sudo tee /etc/environment.d/99-qt-style.conf

		QT_STYLE_OVERRIDE=${QT_STYLE}
	EOF
else
	echo "QT theme already set."
fi

## Nordic
#cd /var/tmp
#
#wget -c https://github.com/EliverLara/Nordic/releases/download/v2.2.0/Nordic-darker-v40.tar.xz
#cd /usr/share/themes
#sudo tar xzvf /var/tmp/Nordic-darker-v40.tar.xz
#
#
#gsettings set org.gnome.desktop.interface gtk-theme "Nordic"
#gsettings set org.gnome.desktop.wm.preferences theme "Nordic"

## firefox
#cd /var/tmp
#git clone --depth 1 https://github.com/EliverLara/firefox-nordic-theme
#cd firefox-nordic-theme
#
#echo "firefox nordic theme"
#MOZILLA_HOME='~/.mozilla/firefox/'
#MOZILLA_PROFILE='*.default'
#checkinstall bash -c "./scripts/install.sh -f ${MOZILLA_HOME} -p ${MOZILLA_PROFILE}"

# tor
# echo "tor nordic theme"
#MOZILLA_HOME='/home/default/.local/share/torbrowser/tbb/x86_64/tor-browser_en-US/Browser/TorBrowser/Data/Browser/'
#MOZILLA_PROFILE='profile.default'
#checkinstall bash -c "./scripts/install.sh -f ${MOZILLA_HOME} -p ${MOZILLA_PROFILE}"

## waterfox
#echo "waterfox nordic theme"
#MOZILLA_HOME='/home/default/.waterfox/2efrqxjh.default-default'
#MOZILLA_PROFILE='2efrqxjh.default-default'
#checkinstall bash -c "./scripts/install.sh -f ${MOZILLA_HOME} -p ${MOZILLA_PROFILE}"

#cd /var/tmp
#git clone https://github.com/horst3180/Vertex-theme --depth 1
#cd Vertex-theme
#
#sudo rm -rf /usr/share/themes/{Vertex,Vertex-Dark,Vertex-Light,Vertex-Gnome-Shell,Vertex-Gnome-Shell-3.16,Vertex-Cinnamon}
#rm -rf ~/.local/share/themes/{Vertex,Vertex-Dark,Vertex-Light,Vertex-Gnome-Shell,Vertex-Gnome-Shell-3.16,Vertex-Cinnamon}
#rm -rf ~/.themes/{Vertex,Vertex-Dark,Vertex-Light,Vertex-Gnome-Shell,Vertex-Gnome-Shell-3.16,Vertex-Cinnamon}
#
#git fetch --tags
#git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
#
#./autogen.sh --prefix=/usr
#sudo make install

#echo 'deb http://download.opensuse.org/repositories/home:/Horst3180/Debian_8.0/ /' | sudo tee /etc/apt/sources.list-available/vertex-theme_Horst3180.list
#sudo ln -s /etc/apt/sources.list-available/vertex-theme_Horst3180.list /etc/apt/sources.list.d/vertex-theme_Horst3180.list
#curl -fsSL https://download.opensuse.org/repositories/home:Horst3180/Debian_8.0/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_Horst3180.gpg > /dev/null
#sudo apt update
#sudo apt install vertex-theme
