# 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-github.desktop";

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

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

icon_path="$tmpdir/ftwa-github.png";
curl -fsSLo $icon_path 'https://ftwa.mathix.dev/icons/github/regular.png';

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

echo "Desktop entry created.";