#!/bin/bash

echo "Installing Prism..."

INSTALL_DIR="$HOME/Prism"
ZIP_URL="https://catcom.pages.dev/uploads/2026/02/prism/editor/b1/linux/prism.zip"
ZIP_FILE="/tmp/prism.zip"

# Download
echo "Downloading Prism..."
wget -O "$ZIP_FILE" "$ZIP_URL"

# Create install directory
echo "Creating install directory..."
mkdir -p "$INSTALL_DIR"

# Extract
echo "Extracting files..."
unzip -o "$ZIP_FILE" -d "$INSTALL_DIR"

# Make launcher executable
chmod +x "$INSTALL_DIR/run.sh"

# Create desktop entry
DESKTOP_FILE="$HOME/.local/share/applications/prism.desktop"

echo "Creating desktop entry..."

cat > "$DESKTOP_FILE" <<EOL
[Desktop Entry]
Name=Prism
Exec=$INSTALL_DIR/run.sh
Icon=$INSTALL_DIR/prism.png
Type=Application
Categories=Graphics;
Terminal=false
EOL

echo "Installation complete!"
echo "You can now launch Prism from your application menu."
