Our Java/SWT-based application uses a bash startup script on Linux. We need to find out whether to launch with GTK2 (older SWT version) or with GTK3 (newer SWT version), because the latest SWT versions don't support GTK2 any more and cause problems on older systems with no GTK3 support or older GTK3 versions. Especially the GTK3-themes (!= Adwaita or Ambiance) cause problems.
If the system supports GTK3, how to find out (in a bash script) what GTK3 theme is configured? Optional: find out what GTK3 themes are available on the system?
Update: a tiny C application similar to this answer also would be fine.