#!/bin/sh
dirname=`dirname "$0"`
tmp="${dirname#?}"

if [ "${dirname%$tmp}" != "/" ]; then
dirname=$PWD/$dirname
fi

dirname=`realpath $dirname`

echo "#!/usr/bin/env xdg-open

[Desktop Entry]
Type=Application
Terminal=false
Exec=$dirname/delighter.sh
Icon=$dirname/delighter.png
Name=Agisoft Delighter
Comment=Remove shadows from model textures
Categories=Science;
StartupWMClass=Delighter" > "/tmp/agisoft-delighter.desktop"

xdg-desktop-menu install /tmp/agisoft-delighter.desktop

rm /tmp/agisoft-delighter.desktop

xdg-desktop-menu forceupdate