#!/bin/bash
install_packages meson python3 python3-gi python3-gi-cairo libglib2.0-bin libgdk-pixbuf-2.0-dev '|' libgdk-pixbuf2.0-dev libxml2-utils x11-xserver-utils gir1.2-gtk-3.0 gir1.2-glib-2.0 gir1.2-pango-1.0 gir1.2-gdkpixbuf-2.0 gtk2-engines gtk2-engines-murrine gtk2-engines-pixbuf bash bc sed grep parallel sassc imagemagick optipng librsvg2-bin inkscape python3-pillow python3-pystache python3-yaml make automake libgtk-3-dev breeze-icon-theme || exit 1

cd $HOME
rm -rf oomox
status "This will take some time as --recurse-submodules flag is passed."
git clone https://github.com/themix-project/themix-gui.git --recurse-submodules -b 1.15.1 oomox || error "Failed to clone oomox repository!"
echo "cd $HOME/oomox && exec python3 -m oomox_gui "'$@' | sudo tee /usr/local/bin/oomox-gui &>/dev/null || error "Failed to create /usr/local/bin/oomox-gui"
sudo chmod +x /usr/local/bin/oomox-gui || error "Failed to make /usr/local/bin/oomox-gui executable!"
#create menu shortcut
echo "[Desktop Entry]
Type=Application
Name=Oomox Theme Designer
Comment=A tool to customize icons, xrdb and GTK themes. 
Icon=$(dirname "$0")/icon-64.png
Exec=oomox-gui
StartupNotify=true
Categories=Graphics;
Keywords=color;gtk;highlight;theme;widget;numix;
StartupWMClass=Oomox
X-GNOME-Gettext-Domain=Oomox
X-Desktop-File-Install-Version=0.22" > ~/.local/share/applications/oomox.desktop
