#!/bin/bash
# Debug script to find Nuke's actual process name

echo "=== Finding Nuke Process ==="
echo ""

echo "1. Trying various process name patterns:"
echo ""

echo "pgrep -f Nuke:"
pgrep -f Nuke
echo ""

echo "pgrep -f nuke:"
pgrep -f nuke
echo ""

echo "pgrep -i nuke:"
pgrep -i nuke
echo ""

echo "pgrep Nuke:"
pgrep Nuke
echo ""

echo "2. Searching all processes for 'nuke' (case-insensitive):"
ps aux | grep -i nuke | grep -v grep
echo ""

echo "3. Searching for Foundry-related processes:"
ps aux | grep -i foundry | grep -v grep
echo ""

echo "4. Searching for processes accessing Nuke directories:"
lsof 2>/dev/null | grep -i nuke | head -20
echo ""

echo "5. Checking /proc for Nuke:"
find /proc -maxdepth 2 -name cmdline -exec grep -l -i nuke {} \; 2>/dev/null | while read cmdline; do
    PID=$(echo "$cmdline" | cut -d/ -f3)
    echo "PID: $PID"
    echo "Command: $(cat "$cmdline" | tr '\0' ' ')"
    echo ""
done

echo "6. All currently running GUI applications:"
ps aux | awk '{print $11}' | sort -u | grep -E '^[A-Z]' | head -20
echo ""

echo "=== If Nuke is open, please look through the output above ==="
echo "=== and tell me which process name/PID belongs to Nuke ==="
