#!/bin/sh
# esstracker launcher — Ubuntu 20.04 / 22.04 / 24.04 compatible
export ESSTRACKER_ICON="${ESSTRACKER_ICON:-/usr/share/icons/hicolor/256x256/apps/esstracker.png}"
if [ -z "${ESSTRACKER_FORCE_WAYLAND:-}" ]; then
  export GDK_BACKEND="${GDK_BACKEND:-x11}"
fi
export XDG_CURRENT_DESKTOP="${XDG_CURRENT_DESKTOP:-$XDG_SESSION_DESKTOP}"
BIN="/opt/esstracker/timetrack-agent"
if [ ! -x "$BIN" ]; then echo "missing $BIN" >&2; exit 127; fi
if [ "$#" -eq 0 ]; then
  exec "$BIN" run
fi
exec "$BIN" "$@"
