#!/bin/sh
# Plinius: D-Bus activation of org.gnome.keyring.SystemPrompter, the keyring's password prompt
# (service file in /usr/share/plinius/dbus-1/services, found before gcr's own, see
# 50-plinius-callaudio.conf).
#
# At boot gnome-keyring asks for a prompter (about 36 s) before phosh owns the name (about 38 s,
# measured 03.11.); phosh shows the prompt full-screen in its own style. D-Bus therefore started
# gcr's bare GTK 3 window, light and unlike the rest of the phone. This waits until someone owns
# the name: the bus then hands the waiting prompt to that owner (phosh). Only when nobody takes
# it within 90 s (no phosh) does gcr's prompter run. As in misc-de/furios_app ("Keyring prompt in
# phosh style").
name=org.gnome.keyring.SystemPrompter
i=0
while [ "$i" -lt 90 ]; do
	busctl --user status "$name" >/dev/null 2>&1 && exit 0
	sleep 1
	i=$((i + 1))
done
exec /usr/lib/gcr-prompter
