I think that searching the GnuPG options file is wrong. Could the script instead look for "use-gpg-agent" in /etc/X11/Xsession instead? This is the same mechanism that the SSH agent uses to determine if it should start up when X is started.
-- Ed
signature.asc
Description: Digital signature