Is it acceptable solution? Could you apply attached patch?
A less intrusive change would be to check if the output of the
--version command contains the word 'GNOME' (either using the 'in'
build-in operation or string.find). This is done in the same
function you modified in your previous patch.