#!/bin/bash

# Define the temporary file name for the .desktop file
SCRIPT="/tmp/shortcut-$(date +%s).desktop"

# Create the .desktop file with the required content
echo "[Desktop Entry]" >> $SCRIPT
echo "Version=1.0" >> $SCRIPT
echo "Name=AVVIO PROGRAMMA COLLAUDO" >> $SCRIPT
echo "Comment=Shortcut to AVVIO PROGRAMMA COLLAUDO" >> $SCRIPT
echo "Exec=$HOME/PycharmProjects/st-ten-1/runmenoautotest.sh" >> $SCRIPT
echo "Icon=$HOME/PycharmProjects/st-ten-1/src/ui/imgs/neo_red.ico" >> $SCRIPT
echo "Terminal=false" >> $SCRIPT
echo "Type=Application" >> $SCRIPT
echo "Categories=Utility;" >> $SCRIPT

# Prompt for sudo password and copy the .desktop file to the user's Desktop
sudo cp $SCRIPT "$HOME/Desktop/AVVIO PROGRAMMA COLLAUDO NO AUTOTEST.desktop"

# Make the .desktop file executable
sudo chmod +x "$HOME/Desktop/AVVIO PROGRAMMA COLLAUDO NO AUTOTEST.desktop"

# Remove the temporary .desktop file
rm $SCRIPT

echo "Shortcut created on Desktop"