#!/usr/bin/env bash
set -u
APP_SRC=/usr/share/applications/forenclarity-control-panel.desktop
USER_HOME=${HOME:-$(getent passwd "$(id -un)" | cut -d: -f6)}
DESK_DIR="$USER_HOME/Desktop"
DESK="$DESK_DIR/ForenClarity Control Panel.desktop"
mkdir -p "$DESK_DIR"
cp "$APP_SRC" "$DESK"
chmod +x "$DESK"
if command -v gio >/dev/null 2>&1; then
  gio set "$DESK" metadata::trusted true >/dev/null 2>&1 || true
fi
if command -v update-desktop-database >/dev/null 2>&1; then update-desktop-database /usr/share/applications >/dev/null 2>&1 || true; fi
echo "Applications launcher: $APP_SRC"
echo "Desktop launcher: $DESK"
echo "Desktop launcher is executable. If Ubuntu still shows an untrusted launcher warning, right-click and choose Allow Launching."
