#!/bin/sh
set -eu

# FlatPark entry point for OneKeePass.
#
# The app is a Tauri (WebKitGTK) binary that apply_extra stages at
# /app/extra/usr/bin/OneKeePass. Every library it links against - webkit2gtk-4.1,
# gtk-3, libsoup-3, libdbus-1 - comes from org.gnome.Platform, and the binary
# declares no tray icon, so the Ayatana appindicator stack is not needed.
#
# The whole usr tree is kept because the relative layout is load-bearing: the
# binary resolves its UI translations, diceware wordlists and custom SVG icons
# through ../lib/OneKeePass/_up_/resources/public, so usr/bin must stay next to
# usr/lib/OneKeePass.
#
# App state (settings, recently-opened list, key files) goes to
# $XDG_CONFIG_HOME/$XDG_DATA_HOME, which Flatpak points inside
# ~/.var/app/io.github.onekeepass.desktop/. The .kdbx vaults themselves stay
# wherever the user keeps them; only xdg-documents is granted by default.
#
# Browser integration (usr/bin/onekeepass-proxy) is shipped as part of the
# upstream tree but is not wired up by this package: connecting it would require
# writing a native-messaging manifest into the host browser's directory.

# WebKitGTK's DMABUF renderer paints a blank window under many drivers inside the
# Flatpak sandbox. Disabling it is the reliable default for a WebKitGTK app.
export WEBKIT_DISABLE_DMABUF_RENDERER=1

exec /app/extra/usr/bin/OneKeePass "$@"
