#!/usr/bin/env bash # PLWL portable shortcut creator — bundled inside the release tarball. # Installs the icon into the user icon theme and creates a .desktop entry # pointing at ./olcxja.plwl/olcxja.plwl in the folder this script lives in # (portable mode — no files are copied anywhere). set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" APP_DIR="$HOME/.local/share/applications" ICON_BASE="$HOME/.local/share/icons/hicolor" ICON_SRC="$SCRIPT_DIR/olcxja.plwl.png" EXE="$SCRIPT_DIR/olcxja.plwl/olcxja.plwl" [ -f "$EXE" ] || { echo "createshortcut.sh: olcxja.plwl runtime not found in $SCRIPT_DIR" >&2; exit 1; } chmod +x "$EXE" 2>/dev/null || true echo "1. Installing icon..." if [ -f "$ICON_SRC" ]; then for dir in 16x16 32x32 48x48 256x256; do mkdir -p "$ICON_BASE/$dir/apps" cp "$ICON_SRC" "$ICON_BASE/$dir/apps/olcxja.plwl.png" done fi echo "2. Creating shortcut..." mkdir -p "$APP_DIR" cat > "$APP_DIR/olcxja.plwl.desktop" << EOF [Desktop Entry] Type=Application Name=PLWL Comment=Portable Linux Wine Launcher Exec="$EXE" Icon=olcxja.plwl Terminal=false Categories=Game; EOF chmod +x "$APP_DIR/olcxja.plwl.desktop" command -v update-desktop-database >/dev/null 2>&1 && update-desktop-database "$APP_DIR" 2>/dev/null || true echo "Shortcut created: $APP_DIR/olcxja.plwl.desktop -> $EXE"