#!/bin/bash
# GTK OLED Theme Setup Script
# Symlinks oled-black theme CSS to GTK config directories

set -e

REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/gtk-themes/oled-black" && pwd)"
HOME_CONFIG_GTK3="$HOME/.config/gtk-3.0"
HOME_CONFIG_GTK4="$HOME/.config/gtk-4.0"

echo "Setting up OLED black theme for GTK3 and GTK4..."

# GTK4 setup
echo "Configuring GTK4..."
rm -f "$HOME_CONFIG_GTK4/gtk.css"
ln -s "$REPO_DIR/gtk-4.0.gtk.css" "$HOME_CONFIG_GTK4/gtk.css"
echo "  → Linked GTK4: $HOME_CONFIG_GTK4/gtk.css → $REPO_DIR/gtk-4.0.gtk.css"

# GTK3 setup (using same CSS file - it will work for basic overrides)
echo "Configuring GTK3..."
ln -sf "$REPO_DIR/gtk-4.0.gtk.css" "$HOME_CONFIG_GTK3/gtk.css" 2>/dev/null || {
    mkdir -p "$HOME_CONFIG_GTK3"
    ln -s "$REPO_DIR/gtk-4.0.gtk.css" "$HOME_CONFIG_GTK3/gtk.css"
}
echo "  → Linked GTK3: $HOME_CONFIG_GTK3/gtk.css → $REPO_DIR/gtk-4.0.gtk.css"

echo "Done! Restart GTK apps to see changes."
