# This script is generated by FTWA
# /u/ links are only available for 24h
# Check the app store to find more apps: https://ftwa.mathix.dev/store

# Exit on error
set -e;

# Setup Firefox if needed
# Firefox setup skipped

echo "
Creating desktop entry...";
tmpdir="$(mktemp -d)";
tmp_desktop_file="$tmpdir/ftwa-gmail.desktop";

cat > $tmp_desktop_file <<EOF
[Desktop Entry]
Type=Application
Name=Gmail
Exec=/usr/bin/google-chrome-stable --app='https://mail.google.com'
Icon=ftwa-gmail
Terminal=false
StartupNotify=true
StartupWMClass=ftwa-gmail

# This file was generated using FTWA (https://ftwa.mathix.dev)
EOF

icon_path="$tmpdir/ftwa-gmail.png";
curl -fsSLo $icon_path 'https://static-00.iconduck.com/assets.00/gmail-icon-512x385-4c4746h1.png';

xdg-desktop-menu install $tmp_desktop_file;
xdg-icon-resource install --size 512 "${tmpdir}/ftwa-gmail.png" 'ftwa-gmail';

echo "Desktop entry created.";