#!/bin/bash
# Budgie 10.x integration script for Firefox

# Set as default browser
if command -v xdg-settings >/dev/null 2>&1; then
    xdg-settings set default-web-browser firefox-budgie-nightly.desktop 2>/dev/null || true
fi

# Budgie panel integration
if pgrep -x "budgie-panel" > /dev/null 2>&1; then
    # Add to favorites if gsettings available
    if command -v gsettings >/dev/null 2>&1; then
        CURRENT_FAVES=$(gsettings get com.solus-project.budgie-panel favorites 2>/dev/null || echo "[]")
        if [[ "$CURRENT_FAVES" != *"firefox-budgie-nightly.desktop"* ]]; then
            NEW_FAVES=$(echo $CURRENT_FAVES | sed 's/\]/, "firefox-budgie-nightly.desktop"\]/')
            gsettings set com.solus-project.budgie-panel favorites "$NEW_FAVES" 2>/dev/null || true
        fi
    fi
    echo "Firefox Budgie Nightly integrated with Budgie 10.x"
fi
